#help-development

1 messages · Page 1675 of 1

lost matrix
#
    JsonObject jsonObject = ...
    
    JsonArray dataArray = jsonObject.get("data").getAsJsonArray();
    JsonObject firstObject = dataArray.get(0).getAsJsonObject();
#

If thats a question: Spigot provides jdbc drivers for MySQL. Otherwise you need to shade the driver you want into your plugin.

formal dome
lean gull
#

can anyone help? it says it's not used and it doesn't do anything
i have this in main class in onEnable:
MobileCraftingTable getMobileCraftingTable = new MobileCraftingTable();
and this in MobileCraftingTable class:

    public void MobileCraftingTable() {
        createMobileCraftingTable();
    }```
lost matrix
lean gull
#

ok

wary harness
#

hey got problem with palceholderapi loading before my plugin

#

and it is softdepandancy

lost matrix
wary harness
#

but it loads after

keen lake
#

I am trying to make some blocks glowing and it is working. But this glow is not visible from far distance. Is there a way to make them visible from further?

wary harness
#

my bad

wary harness
#

xd

lost matrix
#

[PlaceholderAPI]

wary harness
#

I do use proper names

lost matrix
#

Ouch

wary harness
lost matrix
#

All good. I just forgot how it is to write public plugins and support a bunch of other garbage.

wary harness
#

I mean it is hard

#

this is one cutomer having problem

#

some how

lost matrix
wary harness
#

server is 1.165

#

BeastTokens

lost matrix
#

Hm. Did you try to replicate this?

wary harness
#

well didn't try with all plugins they have

#

but it work papi on my test server get's loaded before my plugin

lean gull
#

can someone help? im getting this error:
https://paste.md-5.net/upeyewoyis.pl
from these lines:
mobileCraftingTableRecipe.shape("WW", "WW", ""); and
oakPlanksRecipe.shape("L", "", "");

i tried adding spaces to the empty ones but then it said the crafting must be rectangular

lost matrix
lean gull
#

i'll try adding spaces so it's 3 letters each row

lost matrix
lean gull
#

alright thanks

halcyon mica
#

How can I cast a class that extends the nms zombie entity to a spigot interface mob so that other plugins can deal with it easier

lost matrix
halcyon mica
#

That is not what I was asking

#

I need the other way around, from nms zombie to spigot abstraction

lost matrix
#

Ah i see. Most nms classes have getBukkitXYZ implemented. So

    final EntityZombie nmsZombie = ...;
    final Zombie zombie = (Zombie) nmsZombie.getBukkitEntity();

But you can always create an instance of the CraftBukkit wrapper.

    final EntityZombie nmsZombie = ...;
    final Zombie zombie = new CraftZombie(nmsZombie.getMinecraftServer().server, nmsZombie);

But the first method is recommended. @halcyon mica

halcyon mica
#

I see

proud basin
#

How do yall name your utils calls like TestUtils or just Test

lost matrix
eternal oxide
#

depends on what they are

wary harness
proud basin
#

What would the class if it was a logger

wary harness
#

xd

#

and loadbefore

#

that is braking everything

lost matrix
#

Thats what i mean by "a bunch of garbage"

wary harness
#

that is some plugin

#

which was braking my dependancy

#

this plugin was braking my plugin softdepandacy not loading proparly

lean gull
#

question: can you not use static in a class that implements Listener or did i do something wrong

crimson terrace
#

Where are, you using it?

lean gull
lost matrix
lean gull
#

it also says i can't use the field variable cause it's a non static context or whatever

crimson terrace
#

Void

#

You forgot the return type

lean gull
#

-_- im stupid

crimson terrace
#

😊

eternal oxide
#

a static method requires static Fields

lost matrix
#
  1. He has a return value so he needs a non void return type
  2. He is trying to return a local variable from a static method. Which is not possible.,
tardy delta
#

will this cancel the runnable when cancel is true?

lean gull
#

ok i fixed it

tardy delta
#

ah

crimson terrace
#

Didnt lookt at it closely so i just said both. Also on phone, forgive me @7smile7

lost matrix
gaunt saffron
tardy delta
#

ah lemme just cancel the bukkittask with process id pid

lost matrix
tardy delta
#

no?

#

what else?

lean gull
#

yoo my code works for once les gooo baby

crimson terrace
#

Les gooo

tardy delta
#

?paste

undone axleBOT
lost matrix
tardy delta
#

oh actually a runnable instead of cancelling

tardy delta
#

😳

lost matrix
#

Separation of concerns just went behind the shed and killed himself

open vapor
#

mobs killed from an explosion from World.createExplosion don't drop anything
how do i fix this

undone axleBOT
tardy delta
#

oh i was using the java.lang runnable

lost matrix
lean gull
#

hush

open vapor
crimson terrace
#

Dropped items just get deleted in an explosion, no loot.

#

If youre talking about a blown up chest the items will drop

open vapor
#

if i use a normal explosion like tnt, the loot still drops

crimson terrace
#

Make sure its not 2 explosions

tardy delta
#

this better?

new BukkitRunnable() {
            @Override
            public void run() {
                if (cancel) this.cancel();
                player.getWorld().spawnParticle(Particle.FIREWORKS_SPARK, player.getLocation(), 3, 0, 0.5, 0, 0L, 5L);
            }
        }.runTaskTimerAsynchronously(plugin, 1L, 5L);
lost matrix
tardy delta
#

why not really?

crimson terrace
#

If its 2 explosions and the first one kills the mob then the second one kills the items no matter how little time there is between them

open vapor
#

oh

lost matrix
lost matrix
open vapor
#

also, how do you increase explosion damage without increasing range

burnt current
#

Hey quick question: I'm trying to connect my plugin to a database and I'm following this tutorial: https://www.spigotmc.org/wiki/connecting-to-databases-mysql/

It says in one part that you should call the following method in your onEnable() method of the Main class and the returned data source should be cached in a private DataSource dataSource field. :

private DataSource initMySQLDataSource() throws SQLException {
        MysqlDataSource dataSource = new MysqlConnectionPoolDataSource();

            File file = new File("my File Path");
            YamlConfiguration yamlConfiguration = YamlConfiguration.loadConfiguration(file);
                dataSource.setServerName(yamlConfiguration.getString("host"));
                dataSource.setPortNumber(yamlConfiguration.getInt("port"));
                dataSource.setDatabaseName(yamlConfiguration.getString("database"));
                dataSource.setUser(yamlConfiguration.getString("user"));
                dataSource.setPassword(yamlConfiguration.getString("password"));

                testDataSource(dataSource);
                return dataSource;```
However, I cannot call this method in my OnEnable method. My guess now would be that it doesn't work because my methods are private. That's why I'm confused, because in the tutorial private methods were also used. can anyone help me there?
Then I wanted to ask what exactly is meant by caching the returned DataSource in a `private DataSource dataSource` field. Does it mean that I should store it in a variable?
tardy delta
#

"quick"

hybrid spoke
lost matrix
#

In your onEnable you should call this method once and cache the result in a variable

this.dataSource = dbProviderInstance.initMySQLDataSource();

And then distribute this variable to points where its needed.
private makes this method ONLY accessible withing the own class.
@burnt current

tardy delta
#

pog

ivory sleet
#

?

atomic gyro
#

hey there y'all, just wanted to see if theres a way to have this listener only apply to a specific inventory?

public void onInventoryClick(InventoryClickEvent event) {
        //if statement to only apply while the inventory is open?
        event.setCancelled(true);
        return;
    }```
ivory sleet
#

Agree to disagree sir

lost matrix
open vapor
#

when you open the inventory, create a new class with the player name and inventory. then the class can check if the inventory is the right one

lean gull
#

so i have this thing on PlayerInteractEvent:
if (e.getItem().getItemMeta().getPersistentDataContainer().has(key, PersistentDataType.STRING)) {

but then if i don't have anything in hand it sends an error to console, how do i fix this

open vapor
#

each class handles its own inventory

lost matrix
#

📤 Cheers

open vapor
#

thats what i use

eternal oxide
open vapor
#

wait i might have misunderstood the question

eternal oxide
#

that means it can return null and no item

lean gull
#

alright, what do i do to fix it

eternal oxide
#

if its does return null and you try to chain .getItemMeta() there is no item for that to happen on

lean gull
#

how 2 fix

eternal oxide
#

if (e.getItem() != null && e.getItem()...

ivory sleet
#

Hasn’t he blocked you 2Hex?

eternal oxide
#

if at any stage you can have a null value always test it

ivory sleet
#

Yeah well I can’t help much since I am apparently "stealing" his code

open vapor
eternal oxide
#

This is why javadocs are so important

ivory sleet
#

🥴

lean gull
#

im actually suprised 2hex is not banned yet

tardy delta
#

:/

lean gull
#

he's being hating on me and only me for days

tardy delta
#

my cutie isnt banned yet?

quaint mantle
#

hello i'm asking for how to get all blocks from from location and remove it
example:
get all blocks from x:1 to x:7 and remove it

#

is there any way to do it

lean gull
#

pfft

eternal oxide
#

I don't mind those willing to learn. I can't stand those who are too lazy

lean gull
#

2hex go bully someone else will you

quaint mantle
#

like that?

eternal oxide
#

yes

quaint mantle
#

LOL

#

i'll try

tardy delta
#

is string.concat actually something?

quaint mantle
#

hes trying to help you

#

so shut up and stop whining, do research yourself

#

please

#

for the love of god

#

if there IS a god

lean gull
#

please

#

fuck off

quaint mantle
#

bruh

lean gull
#

thanks

quaint mantle
#

wasnt gonna go that far

#

¯_(ツ)_/¯

#

some people are just ignorant and dont want help, oh well

lean gull
#

i want help, not bullying

#

2hex

#

please, i do not want your "help"

#

this is how i learn

quaint mantle
#

ok

lean gull
#

now please, stop talking to me

quaint mantle
#

ur bad at learning

#

ok

lean gull
#

thank god

quaint mantle
#

can i still talk tho @lean gull

#

or have u decided for me to not speak ever again

lean gull
#

im allowing you to talk

quaint mantle
#

ok thanks master

lean gull
#

you may talk :p

eternal oxide
#

@lean gull Are you using maven to build?

lean gull
#

idk

eternal oxide
#

do you have a pom.xml?

lean gull
#

where would that be

quaint mantle
#

idk

eternal oxide
#

in your project

lean gull
#

yes but where

#

what folder

eternal oxide
#

root

quaint mantle
#

bruh

lean gull
#

external libraries or?

quaint mantle
#

learn

eternal oxide
#

no

quaint mantle
#

your

#

IDE

#

and learn

#

java

eternal oxide
#

Same level as your src folder

lean gull
#

oh then no i don't have one

eternal oxide
#

when you build you click the artifacts?

#

I assume you are using Intelij

lean gull
#

yes

quaint mantle
#

nOtEpAD

hybrid spoke
#

notepad is great

quaint mantle
#

yeah

lean gull
#

i click build > build artifacts > projectname.jar > build

quaint mantle
#

same w/ eclipse afaik

#

unless you minimize the project folder

eternal oxide
#

I was asking as with maven its really easy to add javadocs (if they IDE) doesn't do it for you

quaint mantle
#

did u forgor

#

he didnt want ur heblp

#

:(

#

💀

#

playerinteractevent

#

@lean gull

lean gull
#

dont want ur help

quaint mantle
#

oh

#

oh sorry

#

¯_(ツ)_/¯

#

im just trying to actually help

#

and hes denying it

#

its very toxic

lean gull
#

i want help from non toxic people thanks

quaint mantle
#

@quaint mantle what do u think about this toxic person

lean gull
#

no, elgar's pog

quaint mantle
#

hes like a bad hypixel player

narrow furnace
quaint mantle
#

thinking that everyone is hacking

lean gull
#

about 1 or 2

eternal oxide
#

lol

quaint mantle
#

LOL

#

elgar

eternal oxide
#

nah, I'm in teh good books now. you are on your own 😄

lean gull
#

you do realise he just tagged a helper and your spammin

narrow furnace
quaint mantle
#

how do i be elgar :(

quaint mantle
#

dear comrade

lean gull
#

no you are the unsmart

quaint mantle
#

ok

ivory sleet
#

Guys can we just drop this

quaint mantle
narrow furnace
#

can we drop buenny

#

dropkick*

quaint mantle
#

that too

narrow furnace
#

👀

quaint mantle
#

its a request

ivory sleet
#

Block him if he annoys you

quaint mantle
#

in hopes we can grant freedom

#

oh yeah

open vapor
ivory sleet
#

But don’t harass him

quaint mantle
#

i forgor that was a thing

narrow furnace
#

can we have a serverwide vote

#

on banning buenny

quaint mantle
#

we were told to drop it*

eternal oxide
#

Nope. Democracy is not allowed

quaint mantle
#

HEX

#

dont fall down the pit

narrow furnace
quaint mantle
#

just agree with mr helper :(

quaint mantle
quaint mantle
inland scaffold
#
for(String s : mainClass.getConfig().getStringList("discordmessage")) {
                    player.sendMessage(s);
                }

how come when for example
I have in the config

  • &6&lTest1
  • &1&lTest2
    it doesnt send to the player in color?
quaint mantle
#

idk config things

inland scaffold
#

it changed to ChatColor.translateAlternateColorCodes('&', s); @grim ice

quaint mantle
#

i just made my own thing for that

#

i call it mcMsgFrom(String str)

#

and it returns a string

#

with HEX

#

and/or

#

chatoclur

inland scaffold
#

still no color

#
if (cmd.getName().equals("discord")) {
            if (player.hasPermission("slashtools.discord")) {
                for(String s : mainClass.getConfig().getStringList("discordmessage")) {
                    ChatColor.translateAlternateColorCodes('&', s);
                    player.sendMessage(s);
                }
            } else {
                if (!player.hasPermission("slashtools.discord")) {
                    for(String s : mainClass.getConfig().getStringList("nopermissionmessage")) {
                        ChatColor.translateAlternateColorCodes('&', s);
                        player.sendMessage(s);
                    }
                }
            }
        }
eternal oxide
#

You never stored s

crimson terrace
#

I love watching the drama, it gives me life.

eternal oxide
#
    Text containing the ChatColor.COLOR_CODE color code character.```
inland scaffold
#

I just wanna fix this

quaint mantle
#

strings are immutable

eternal oxide
#

player.sendMessage(ChatColor.translateAlternateColorCodes('&', s));

inland scaffold
#

this is for something else,

#

Illegal modifier for parameter mainClass; only final is permitted

#

private Main mainClass = Main.getInstance();

#

wait nvm

#

fixed it

#

XD

undone axleBOT
quaint mantle
#

Good di isn’t just passing your main class everywhere

#

Your main class shouldn’t go anywhere for that fact

quaint mantle
#

Breaks dip

#

Your main is your highest order class therefore it shouldn’t be passed anywhere

#

Shutup bonzi buddy

#

he forgor 💀

hushed marlin
#

okey

#
import net.minecraft.server.v1_8_R3.IChatBaseComponent.ChatSerializer;
import net.minecraft.server.v1_8_R3.PacketPlayOutChat;
import net.minecraft.server.v1_8_R3.PacketPlayOutPlayerListHeaderFooter;
import net.minecraft.server.v1_8_R3.PacketPlayOutTitle;
import net.minecraft.server.v1_8_R3.PlayerConnection;

it's not working for me | it says it's not in my library

narrow furnace
#

because its not

hushed marlin
#

please help

narrow furnace
#

did you put it there?

#

if not its not there

#

and it isnt

waxen plinth
#

please help

#

Literally he is trying to help you and you're not giving any additional info

quaint mantle
waxen plinth
#

You have to add the server jar to your classpath to import nms

hushed marlin
#

I'm from Poland and I don't understand some of your words

narrow furnace
#

before u ask how to do that

hushed marlin
#

so understand me

narrow furnace
#

i will preemptively

#

?google

undone axleBOT
quaint mantle
#

Imagine being an info stealer

#

?

tardy delta
#

does it work

#

it doesnt

#

😦

narrow furnace
#

no

#

just google it and copy the link 🤔

tardy delta
#

no

narrow furnace
#

ok

summer scroll
tardy delta
#

lmao 404

tardy delta
#

whoa

#

https

ivory sleet
narrow furnace
#

wait why did u need that link anyway

waxen plinth
#

I dunno why that message was deleted

formal dome
#

i'm tryign to link to a database

waxen plinth
#

But gradle can use maven dependencies

narrow furnace
quaint mantle
tall dragon
tardy delta
#

cool

formal dome
#

alright so next question. in the build.gradle file wehre does it go

#
implementation group: 'mysql', name: 'mysql-connector-java', version: '8.0.26'```
waxen plinth
#

You don't need that

#

Spigot already has sql drivers shaded

tall dragon
#

^

waxen plinth
#

And please look up gradle guides, this is a very simple and googleable thing

ivory sleet
#

Did someone say gradle?

#

😛

tardy delta
#

i said cornflakes

waxen plinth
tall dragon
#

🧢

ivory sleet
quaint mantle
#

ANT

ivory sleet
#

There’s only so much maven can offer

waxen plinth
#

lmao this dude added a thumbsup to his own message

narrow furnace
#

lol

lost matrix
#

Thank you but i would like my dependency manager to not fail every second java LTS version

waxen plinth
#

Gradle has never failed me except when I messed up

ivory sleet
#

Idk how you achieve such hatred from gradle

quaint mantle
#

gradle breaking every minor update PU_PeepoLaugh

ivory sleet
#

But generally gradle likes people (:

waxen plinth
#

An artist I found on reddit

narrow furnace
#

lmao

waxen plinth
#

Ok sorry but can you fuck off

#

Why did you ping me just for that

narrow furnace
#

same

unreal quartz
#

their art is great

quaint mantle
#

bad joke

narrow furnace
waxen plinth
#

bruh

waxen plinth
#

insults you lol bro chill its just a prank

#

there is no joke

narrow furnace
#

LOL

waxen plinth
#

you're just being a dickhead

tall dragon
#

why are you so mean

narrow furnace
#

2hex stop

unreal quartz
#

fr

ivory sleet
#

Yeah guys fr

narrow furnace
#

it wasnt

ivory sleet
#

It was just straight out mean

waxen plinth
#

.-.

tall dragon
#

why the hell would you tag someone on a spigot development chat just to tell them their pfp is shit

waxen plinth
#

Yeah that's just...

#

It's not

#

It's obnoxious

quaint mantle
#

?kick @grim ice mature.

tardy delta
#

i list my creditcard in this chat

lost matrix
#

Oh. I found something that i might use a bit more often in the next time XD

undone axleBOT
#

Done. That felt good.

tardy delta
#

lol

formal dome
waxen plinth
#

Shaded means it's included in the server jar

quaint mantle
#

shaded = compiled & included

quaint mantle
waxen plinth
#

So you don't need to add any dependencies to use mysql or sqlite with spigot

ivory sleet
#

The sql driver is just containing some useful classes for managing sql related stuff

waxen plinth
#

Yep

#

They're a pain to use though lol

ivory sleet
#

Assuming you’re not mocking it

waxen plinth
#

Dependency injection bad???

#

News to me

ivory sleet
#

But even then it’s kinda awkward

#

No

waxen plinth
#

No

formal dome
ivory sleet
#

It’s the violation of abstraction hierarchy

waxen plinth
#

It was just you continuing to be an asshole

narrow furnace
#

yes

#

it was

quaint mantle
ivory sleet
#

It makes it very tightly coupled

atomic gyro
#

hey there yall, this is throwing an error at me; what can I replace null with?

Inventory inv = Bukkit.createInventory(player, 9, "testInv");
Set<Inventory> codedInventory = null;
codedInventory.add(inv);```
waxen plinth
#

new HashSet<>()

ivory sleet
#

Assume you want to reuse a component, in that case you’d have to pass your plugin instance to it because the constructor might require it

#

So ye

waxen plinth
#

Of course you can't call a method on something you initialized as null

waxen plinth
atomic gyro
narrow furnace
#

how do u .add to null

quaint mantle
waxen plinth
#

It's probably bad practice but I wrote abstraction layers that get the plugin

#

So you don't need to pass it around at all

#

It's either that or a static getter

narrow furnace
#

null is not an Inventory object

#

its just null

quaint mantle
#

doesnt JavaPlugin.getPlugin exist for a reason

ivory sleet
#

Yeah well I have a plethora of bad designed plugins so no shame

waxen plinth
#

That's a static getter lol

quaint mantle
#

pretty sure it just accesses a map

ivory sleet
#

Nope

waxen plinth
#

It doesn't

#

It gets the classloader

#

And the classloader is specific to the plugin

ivory sleet
#

Yeah

waxen plinth
#

So it has the plugin as a field

quaint mantle
#

why is that better than having it all in a map?

waxen plinth
#

It's faster

#

And uses less memory

narrow furnace
#

how is that sus

quaint mantle
#

can you not. you're about to be kicked again

ivory sleet
#

Anyways static singletons for your plugin instance is imo weak because we have to violate the design pattern and rely on Bukkit that the plugin instance is the only one to exist.

waxen plinth
#

2hex what if you stopped talking in all caps about things completely unrelated to development or this conversation in this channel

ivory sleet
#

?ban @grim ice trolling

undone axleBOT
#

Done. That felt good.

waxen plinth
#

Thank god

narrow furnace
#

bro

waxen plinth
#

Anyways

quaint mantle
waxen plinth
#

What design pattern are you talking about?

quaint mantle
#

Good job conclure

ivory sleet
#

Singleton

waxen plinth
#

Ah, right

open vapor
#

so apparently the nbt on one of my items is so big it now bans ppl who get killed by it

waxen plinth
#

I get really lazy with singletons

ivory sleet
#

Yeah same sometimes lol

waxen plinth
#

Generally I either do a static getter and don't really try hard to enforce single instantiation

#

Or I make a manager that reflectively instantiates all the classes that should be instantiated

ivory sleet
#

I mean most cases it doesn’t matter a jack shit

waxen plinth
#

It doesn't

atomic gyro
#

I've never really used HashSet before, any advice? So far, it doesn't seem to be working for what I'm trying to do.

public void onInventoryClick(InventoryClickEvent event) {
        HumanEntity player = event.getWhoClicked();
        Inventory inv = Bukkit.createInventory(player, 9, "testInv");
        Set<Inventory> codedInventory = new HashSet<Inventory>();
        codedInventory.add(inv);
        
        if(codedInventory.contains(event.getInventory())) {
            event.setCancelled(true);
            return;
        }
        return;
    }```
waxen plinth
#

A HashSet is an unordered collection which cannot contain duplicates

#

What are you trying to do here?

quaint mantle
waxen plinth
#

You create an inventory

#

Then check it to the set

#

Then check if the set contains the event inventory

#

Which will never be true

atomic gyro
#

if inventory is open, and it matches one that the system has made, dont let players take stuff from it

#

this specific case wont ever be true

#

but im going to add more inventories later from another class

ivory sleet
atomic gyro
#

im more or less just checking if the system opened the inventory, and if they did, dont let the player touch it

waxen plinth
#

So you create the inventory elsewhere and open it for the player

#

And you're trying to check if the inventory they have open is the one you created previously?

atomic gyro
#

yes

waxen plinth
#

You need to store that inventory somewhere else then

#

Creating a new inventory doesn't make sense

crimson terrace
#

Maybe try something with the invetorys name? Is that possible?

#

Add the invetory you create to a list and check if the inventory the player is trying to click in is in that list?

waxen plinth
#

No

#

Just create a set elsewhere and add the inventory to the set when it is created

quaint mantle
waxen plinth
#

Then cancel the click event if the set contains the inventory

quaint mantle
#

I really just use it for events/scheduler

ivory sleet
#

Alr yeah

atomic gyro
waxen plinth
#

And make sure to remove the inventory when it's closed to you don't leak memory

ivory sleet
#

Was thinking in case you have 10 mocks of Plugin

waxen plinth
#

Yes, probably

crimson terrace
quaint mantle
#

sets faster

#

set doesnt require an order

crimson terrace
#

Aite

quaint mantle
waxen plinth
#

A set is faster for contains

ivory sleet
#

ArrayList is faster in terms of iteration

waxen plinth
#

You should consider the differences between list and set

ivory sleet
#

And probably index insertion

waxen plinth
#

A list is ordered, can contain duplicates, and can be indexed

#

But contains and remove are slow

atomic gyro
#

list is better if you know where its going to be, yeah?

crimson terrace
#

So if you have a set you cant open the same inv twice

waxen plinth
#

They take more time the longer the list is

#

Set is unordered, cannot contain duplicates, and cannot be indexed

#

contains and remove are fast, they take the same amount of time no matter how large the set is (on average)

ivory sleet
#

Thing is a Set alone does not inherently grant faster speed or for that part optimization, it’s just a mere interface, it’s the implementation that really matters x)

atomic gyro
#

so wait, i should be making the inventory, adding it to the set, running the whole process of making sure they cant click in it, and then once its closed remove it from the set?

waxen plinth
#

HashSet

crimson terrace
#

Will keep that in mind, thanks

waxen plinth
#

But all of the set implementations I'm aware of have fast contains and remove

#

HashSet, TreeSet, LinkedHashSet

#

O(1), O(logn), O(1)

quaint mantle
karmic grove
#

in your opinion is intellij or eclipes easier to use i just want something simple

waxen plinth
#

Intellij

crimson terrace
#

Unless the plugin is for a large server the speed usually doesnt matter much

#

Its java its crappy in speed anyway. A couple milliseconds wont mattet

waxen plinth
#

Java is not crappy in speed

atomic gyro
#

i use eclipse because its the first one i found lol

waxen plinth
#

And a couple of milliseconds absolutely matters

ivory sleet
night garnet
#

Hi, I'm trying to remove invisibility effect from my custom potion but idk why it doesn't remove it. Is clearCustomEffects() still working on potion meta on spigot 1.17.1 ?

waxen plinth
#

You get 50ms per tick if you want to stay at 20tps

#

The server will use probably about 25 of those on its own

#

Every plugin you add will take up some more of that budget

#

A few ms can be the difference between 20tps and 16tps

waxen plinth
crimson terrace
#

Welp, gonna go bury myself in the dust now. Have a good day

quiet ice
#

And beware that lagspikes may not be included in the 25 ms used by the server

waxen plinth
#

Yeah vanilla can take more than 25 depending on what's going on on the server

ivory sleet
#

Yatopia was made to fix this!

quiet ice
#

but no, the paper team wanted to merge yatopia into paper

ivory sleet
#

Did that happen?

#

Thought it got disbanded

quiet ice
#

nah, they only merged tuinity

ivory sleet
#

Ah right

waxen plinth
#

That happened yesterday I think

quiet ice
#

But given that yatopia is mostly based on these patches it might as well be the case

waxen plinth
#

I'm glad it got merged, there are way too many forks

ivory sleet
#

True and true

night garnet
waxen plinth
#

No clue

#

I've never made custom potions

red apex
#

how to check for section in specified section in config file?

night garnet
ivory sleet
red apex
#

yes

waxen plinth
#

You can do getConfigurationSection("section1.section2")

ivory sleet
#

^

#

Then null check

waxen plinth
#

Or getConfigurationSection("section1").getConfigurationSection("section2")

ivory sleet
#

or isConfigurationSection iirc

atomic gyro
#

How should I make my set carry between classes? Can I define it as public static, or import it?

waxen plinth
#

It belongs to that class, try to keep it so nothing else is messing with it

ivory sleet
waxen plinth
#

If absolutley necessary then make public methods that mutate the set in ways you know won't mess it up

quiet ice
#

if it is a constant-type thing you can define it as a public static final

waxen plinth
#

It's not constant

quiet ice
#

(+ use ImmutableSet for best practise)

ivory sleet
#

Set::of Set::copyOf (:

atomic gyro
#

so i should be defining the set in the class that doesnt include the inventory, so how do i have the inventory shift between classes?

quiet ice
#

What do you mean with shift?

atomic gyro
#

One class is making an inventory, adding it to a set, then opening that inventory.
The other class is listening for clicks in that inventory to prevent them, but it's currently having issues discerning the opened inventory from any inventory.

#

The set is supposed to act as a sort of "filter" to prevent it from cancelling clicks in any inventory that isn't within the set, but it can't tell what is in the set because the set is defined in a separate class.

quiet ice
#

I'd just dependency inject the set instance through the classes's constructor, but that won't be that conventional if you'd ask other people

#

The danger there is that debugging can be more complicated since you wont see at a glance where you are modifying the set

atomic gyro
#

I've just realized something; since I'm only going to be making one inventory at a time for what I'm doing, can't I just have it restrict based on the name of the inventory?

waxen plinth
#

You could

#

Not a bad idea to learn how to do this sort of thing though

#

It will help you down the road

atomic gyro
#

Definitely will, I'll bookmark the JavaDoc for it and go back to it soon enough. Thanks for your guys' help!

atomic gyro
#

How would I get the name of an inventory? .getTitle() doesn't work for some reason.
edit: figured it out.

hardy pivot
#

Hi

quiet ice
#

hellon't

hardy pivot
#

i was wondering if is warmful to update a value of a db every second?

quiet ice
#

warmful?

hardy pivot
#

i mean harmful xd

quiet ice
#

ah

ivory sleet
#

Nope

#

LuckPerms does it if you use mysql

quiet ice
#

Well, it depends on how the db is set up, but if it is done properly, no

ivory sleet
#

And probably many other plugins

quiet ice
#

For example if the DB is on the other side of the world you might see issues

hardy pivot
#

:v

#

i have a class that extends of the mysql connection

#

and that class is called by creating an object in class main

#

It's okay?

atomic gyro
#

Finally got it working, thanks yall!

waxen plinth
#

There are a few cases I could see you needing this for, but it's probably better to not do this

#

There's a few ways to avoid it

#

If you're updating a timer or something, you should be using timestamps instead

#

If you're updating a volatile value, you should be at least using a transaction, but ideally using a local cache

hardy pivot
#

im updating a hasmap value

#

uuid, int

#

every second

silent galleon
#

Does the Grindstone emit the EnchantItemEvent?

opal juniper
#

why would it do that

ivory sleet
#

And use a ConcurrentHashMap or a SingleThreadedExecutorService to mutate it

atomic gyro
#

Then just log in, use a grindstone, and see if it says smth.

silent galleon
#

Alright, but first I'm going to reread the events list.

opal juniper
ivory sleet
#

I know too little to give you a concrete example

opal juniper
#

you will have to use the inventoryClickEvent

silent galleon
ivory sleet
#

Me seeing MachoPiggies typing for a long time PES3_Sus

fading lake
#

pls

ivory sleet
#

🥲

#

To my knowledge no, doesn’t seem like it

#

Maybe on the fork I shall not name

#

😫

hasty prawn
#

There's not an event but a packet is sent

#

I don't remember what it's called either though KEKW

ivory sleet
#

🥲

silent galleon
#

Wait is there even an event emitted by the Grindstone?

ivory sleet
#

Presumably ye

quiet ice
#

InventoryClickEvent

#

at least that is what I use

silent galleon
#

huh

hasty prawn
#

Sounds right catyes

silent galleon
# quiet ice at least that is what I use

Could you help me with detecting when it is used? I'd presume I need to use InventoryAction, but it doesn't seem to have anything regarding an item being altered.

red apex
#

how can i cancel click inventory event when i do this: if (e.getView().getTitle().equalsIgnoreCase("randominventory") { e.setCancelled(true) } it will cancel click in players inventory

opal juniper
#

Use the inventory holder

ivory sleet
opal juniper
#

he wants to know the name i presume

red apex
#

or how to cancel specific inventory click

quaint mantle
opal juniper
#

this doesn't help with the holders

quaint mantle
#

"implementing inventory holder breaches the api"

ivory sleet
#

it does ye

quiet ice
# silent galleon Could you help me with detecting when it is used? I'd presume I need to use `Inv...

I personally use

        if (evt.getInventory().getType() == InventoryType.GRINDSTONE) {
            GrindstoneInventory gi = (GrindstoneInventory) evt.getInventory();
            World world = evt.getViewers().get(0).getWorld();
            if (evt.getSlot() == 2) {
                removeOutputEnchants(gi, world);
            } else {
                Bukkit.getScheduler().scheduleSyncDelayedTask(Storage.plugin, () -> {
                    removeOutputEnchants(gi, world);
                }, 0);
            }
        }

but of course that may or may not apply to you

ivory sleet
#

but most likely gonna be fine

silent galleon
waxen barn
#

Why does .disconnect require BaseComponent? can I use hover event there?
bungee btw

quiet ice
#

I dont think hover is supported there, but I am not too sure

ivory sleet
#

it isnt

waxen barn
#

it would be cool if it would be supported

quiet ice
#

Most of the main menu doesn't support complex components

ivory sleet
#

Yeah it's really weird imo that BaseComponent got these methods, should be a derivative

quiet ice
#

Not per se a protocol issue, you'd really have to blame mojang for only implementing stuff half-way

waxen barn
#

if it can only have formating

ivory sleet
#

Components are arguably better in an object oriented perspective

#

kinda why paper chose to use them over strings, also cause minecraft itself has a similar system

quiet ice
#

legacy chat stuff (i. e. strings) are deprecated for about a decade now. I would consider it futureproofing

wary harness
#

any one has some symple method

#

to convert numbers to roman numbers

#

so I don't need to write one

#

😂 feel lazy

opal juniper
#

ok so i am being an idiot but if plugins contains a list of the "plugins"

#

how do i get each of their data

quaint mantle
#

getConfigurationSection

stone sinew
ivory sleet
#

thats a List of ConfigurationSection that has a List of ConfigurationSection?

quaint mantle
#

why is it a list

quiet ice
quaint mantle
#

loop through this

#

section.get(id), section.get(version)

eternal oxide
#

remove the - on id and version and it becomes a map

opal juniper
#

it doesn't have to be this format

#

ok

#

i just need a list of strings that point to teh id & version

#

like this?

eternal oxide
#

yep

opal juniper
#

oke

quaint mantle
#

remove the - on the keys too? they're useless

eternal oxide
#

getConfigrationSection("2323232").get("id")

#

nah his keys are his list

quaint mantle
#
    @NotNull
    public static ConfigurationSection[] getConfigurationSections(@NotNull ConfigurationSection section) {
        return section.getKeys(false).stream()
            .filter(section::isConfigurationSection)
            .map(section::getConfigurationSection)
            .toArray(ConfigurationSection[]::new);
    }
stone sinew
eternal oxide
#

true

opal juniper
#

lol

#

imajin being ignored

stone sinew
#

You're getting a config section and not a list

quaint mantle
quiet ice
#

Well, you can always use Arrays::toList to convert the array into a list

quaint mantle
#

this channel is killing me

stone sinew
eternal oxide
#

I guess the real question should be, how is he generating the yaml

opal juniper
#

by hand 😎

quiet ice
quaint mantle
stone sinew
opal juniper
#

it literally doesnt matter how it is formatted xD

stone sinew
#

I provided code that would work with how he showed us

quiet ice
#

Again, if you don't want an array, use Arrays.asList

quaint mantle
opal juniper
#

to me i mean

quaint mantle
#

map vs list

eternal oxide
#

in that case, do as imagine said. remove all -

#

then its all MemorySections

quaint mantle
#

then remove the dashes and get that sexy stream

#
    @NotNull
    public static ConfigurationSection[] getConfigurationSections(@NotNull ConfigurationSection section) {
        return section.getKeys(false).stream()
            .filter(section::isConfigurationSection)
            .map(section::getConfigurationSection)
            .toArray(ConfigurationSection[]::new);
    }
stone sinew
quaint mantle
#

Bro what

#

I fucking made this for a ConfigurationSection

stone sinew
#

Give me a min to finish my game. Ill dumb it down further

quaint mantle
#

he is removing the dashes

#

this will return the configuration sections inside of plugins

#

and this is for a MAP

#
a:
  b:
    id: 5
#

pass a, get the configuration section of b

opal juniper
#

yeah it works thanks imajin

quaint mantle
#

Jesus yappery

dire marsh
#

Is there a way to check if a player is colliding with another player

stone sinew
# quaint mantle he is removing the dashes

If he removed the dashes then yes it would work but thats not what I was answering. I was answering him leaving it as a list of configuration sections... Jesus imaginedev

quaint mantle
stone sinew
#

🤦

#

Final message i'm sending on this subject 😉 This is what I was responding to and your method would not work here.

opal juniper
#

It dont matter

#

its all working now

#

what is the way to trigger the restart script via the api?

wary harness
#

                
                Collection<ItemStack> bDrops = block.getDrops(p.getItemInHand());
                Bukkit.broadcastMessage("drops "+ bDrops);```
#

any one can tell me how to get drops

opal juniper
#

well what was the itemstack?

#

that you were holding

wary harness
#

well blocks

#

oh

#

pickaxe

opal juniper
#

well there you go

wary harness
#

I am braking stone block

opal juniper
#

well a pickaxe has no drops

wary harness
#

I am confused

opal juniper
#

Ohhhh

wary harness
#

this is block which is mined

#

on blockbrakeevent

opal juniper
#

wait i misunderstood

wary harness
#

I am getting blocks around the one in the middle

#

they are getting broken and they drop stuff on floor

#

but I can't grab there drops

opal juniper
#

surely you should get the drops before you break the block?

#

cause if it is broken, surely it will return the drops of the air block in its place

wary harness
#

thanks

#

my bad didn't think that way

#

but it is apsolutly logical

#

xd

#

thanks

#

🍻

opal juniper
#

lol no problem

wary harness
#

so should I just set it AIR

#

I am adding those blocks to inventory

quaint mantle
#

yep

wary harness
#

partical effect

#

of broken block

stone sinew
wary harness
#

and event is not called

#

on block.breakNaturally(e.getPlayer().getItemInHand());

#

you need to call it manually and manually remove block

quaint mantle
#

play the particle effect

#

🙂

stone sinew
wild reef
#

hey I wanted to ask how to display a particle for a certain amount of time.
How I am spawning one rn:

location.getWorld().spawnParticle(particle, location, 1);

Is there already a given method for that by spigot or do you have to put an timer arround it - with which method could u delete the particle at all again?

quaint mantle
#

just run the task for a while

#

then stop?

severe oracle
#

how do i loop trough every amor stand in a specific world ?

wild reef
quaint mantle
wary harness
#

found this post

#

same problem

quaint mantle
#

what are you trying to do?

#

break block without drops?

wary harness
#

so I am calling brakeNaturally on block because I want to keep partical and sound

#

but I can't clear drops

#

because I am putting them direcly to inventory

wary harness
quaint mantle
#

removeDrops
breakBlock
playSound
spawnParticle

wary harness
#

well u can't remove drops of Block

#

getDrops return copy of it

quaint mantle
#

setDropItems(false)

#

blockbreakevent

wary harness
#

block.breakNaturally(e.getPlayer().getItemInHand());

quaint mantle
#

custom block break?

wary harness
#

yes

#

sphear pickaxe

proud basin
#

Anyone know the what the class is that you can modify the main menu with mixins?

quaint mantle
#

setAir
playSound
spawnParticle
giveItems

@wary harness

wary harness
#

yep

silent galleon
#

Is there a way to remove lore from a preview in the Grindstone? After I remove the chestplate from the Grindstone, the lore disappears, but I'd like to remove it from the preview as well.

wary harness
silent galleon
#

Ah, I forgot the Prepare events existed, thank you!

quaint mantle
#

whats the best, and easiest way to use read/write from/to multiple yaml files

tender vault
#

What is the api-version for 1.17.1?

quaint mantle
#

1.17

tender vault
#

ah

thin venture
#

I want to be able to get the player who ever placed down a chest

worldly ice
eternal oxide
#

detect a chest when its placed then use the pdc to store who placed it on the chest pdc

#

?pdc

thin venture
#

ok thanks

thin venture
#

How would i lock the chest and only have the player who placed it down be able to access it and no one else can

proud basin
#

so my image is in the resources folder and i have this ```java
ResourceLocation background = new ResourceLocation("resources/background.png");

eternal oxide
#

is it in the resources folder of your project? or you actually created a resources folder in your final jar?

proud basin
#

yes the resources folder in my project

eternal oxide
#

then it will not be in resources in your jar

#

The contents of resources is copied to the root of your final jar

proud basin
#

so I should make a folder?

eternal oxide
#

no

proud basin
#

where would it be then?

eternal oxide
#

what are you trying to do with the png?

proud basin
#

just drawing it

eternal oxide
#

if your pom is setup correctly it would have been copied to the root of yoru jar

proud basin
#

gradle

eternal oxide
#

same difference

proud basin
#

so I should just put background.png?

tender vault
#

I'm getting the error java: incompatible types: org.bukkit.Material cannot be converted to boolean, how can I fix this?

proud basin
#

Because I did that before and it still didn't find it

eternal oxide
#

write your code so you are not testing a Material as a boolean

tender vault
#

ok

eternal oxide
proud basin
#

it ain't a jar

eternal oxide
#

all plugins/mods compile down to jars

proud basin
#

yes

#

but I haven't bothered to compile it into a jar yet

eternal oxide
#

where the file is in your project will not be the same when its compiled

#

it all depends on how you have your grade/maven setup

#

having yoru ide see it will be different to yoru final jar

worldly ice
proud basin
#

hm ok

#

let me go add shadowjar

proud basin
#

so what am I suppose to do

#

if I put the image in the same package it still can't find it

eternal oxide
#

only files you specify will be copied to your jar. its not just the location

#

in src folders only class files are copied

#

in resources, it depends on your setup

thin venture
worldly ice
#

Well first off you would need to store the player who placed the chest inside of the chest's pdc

#

?pdc

proud basin
#

this is dumb

proud basin
eternal oxide
#

I can;t tell you that with gradle, I use maven

proud basin
#

aw

woeful holly
#

ParticleProblem

quaint mantle
#

to get a 1.12 map working in 1.16, do i have to incrementally bump the mc version and open it?

eternal oxide
# proud basin aw

With gradle it seems By default any files you add to src/main/resources will be included in the jar.

proud basin
#

so then I should be able to find it then

eternal oxide
#

yes, they will be copied to the root of your jar

#

so just using the resources name should find then

quaint mantle
#

my b didnt realise the channel was in use

#

its fine

#

as long as it isnt crowded

eternal oxide
#

multiple chats are fine

#

Its only when it gets really busy that threads are needed

quaint mantle
#

Sheesh

olive valve
#

hello! im kinda new to spigot coding and i have one problem projectile.setVelocity(); what do i put in the ()?

hexed hatch
#

Vector I believe

woeful holly
#

projectile.setVelocity(new Vector(x,y,z));

eternal oxide
wary harness
#

got a bit problematic situation

#

BetterFarming plugin is returning false/positive cancel event

eternal oxide
#

I guess not, looking at it

olive valve
wary harness
#

some time returns iscanceled false when block is not broken

proud basin
wary harness
#

should I try with priority

#

thing

#

with event

#

because we are using same event

quaint mantle
#

Hello hi i'm asking for how to add effect practlice into hash map
public HashMap<String, List<Effect>> effects = new HashMap<String, List<Effect>>();
now i want to add Heart Effect how do i can do that?

#

Effect effect = Effect.HEART; ?

#

effect.add(effects);

#

not work for me

eternal oxide
wary harness
#

and I am checking if event is cancled and it is anoying when u get false positive because of other plugin event

woeful holly
eternal oxide
proud basin
#

no

eternal oxide
#

Might be an idea to look

proud basin
#

yea it is

eternal oxide
#

are you just trying to access it (InputStream) to use it?

proud basin
#

no

#

This sir, ```java
ScaledResolution sr = new ScaledResolution(mc);
ResourceLocation background = new ResourceLocation("background.png");
mc.getTextureManager().bindTexture(background);
Gui.drawModalRectWithCustomSizedTexture(0, 0, 0.0F, 0.0F, sr.getScaledWidth(), sr.getScaledHeight(), sr.getScaledWidth(), sr.getScaledHeight());

eternal oxide
#

being nms?

proud basin
#

nooo

eternal oxide
#

the only reference to ResourceLocation I find is in nms

lavish hemlock
#

thhhhaaaaatttt looks kinda like Forge code tbh

eternal oxide
#

That would make sense

lavish hemlock
#

ScaledResolution also doesn't appear to exist in Spigot?

#

this is all rendering code too

#

which I don't think Spigot supports

eternal oxide
proud basin
#

ModId?

eternal oxide
#

if its Forge

proud basin
#

pure mixin

eternal oxide
#

your mod has an id

#

ok, lets start again. You are using ScaledResolution and ResourceLocation. These are nms/Forge classes

#

so what is your project?

proud basin
#

ahuh

#

to change the background

eternal oxide
#

on the client? so its a forge mod?

proud basin
#

On the client

lavish hemlock
#

Could be Sponge if he's using mixin

eternal oxide
#

I feel like i'm trying to wring blood from a stone

lavish hemlock
#

@proud basin What are you using? Forge, Spigot, Sponge, etc.?

eternal oxide
#

Tell us something and stop hiding shit. We can't advise unless we know what you are using

proud basin
#

I ain't hiding anything

#

forge

eternal oxide
#

Just trying to find what you are using so I know what classes you are using and from where has been a painful ordeal.

#

See I already asked that and you were evasive.

#

using forge you will have a mod id

#

all resources should be accessed using that id new ResourceLocation("modid", "image.png");

proud basin
#

forge gradle

eternal oxide
#

4th post down

eternal oxide
#

yes

proud basin
#

I don't have a mod id

quaint mantle
#

every mod has a mod id

#

you define it as far back as when you create a mod

proud basin
#

It ain't forge

quaint mantle
#

you just said it was...?

eternal oxide
#

you just said it was

proud basin
eternal oxide
#

gradle is just the build method

quaint mantle
#

that is literally the same-

eternal oxide
#

thats forge being built using gradle

#
    [[mods]]
      modId="examplemod"
      version="1.0.0.0"```
quaint mantle
#

not even sure if maven can be used with forge

#

its stupid

proud basin
#

again it's pure mixin

eternal oxide
#

Good luck with that

proud basin
#

how come

eternal oxide
proud basin
#

oh I do have that

#

It's called archivesBaseName

worldly ice
#

why are you asking about a mod question in a spigot server anyways

eternal oxide
proud basin
#

why not datasian

worldly ice
#

because its a spigot server not a forge server?

proud basin
#

my mixin is set up properly

eternal oxide
#

If you did everything properly it would be working

proud basin
#

so?

#

my build.gradle

#

is a bit different though

worldly ice
#

so just ask in a forge server (if they have one)

eternal oxide
#

did you create your assets folder?

proud basin
#

they don't support that kind of stuff

#

yeah in the resources

eternal oxide
#

and inside that a folder with the name of your modid?

#

src/main/resources/assets/modid/image.png

proud basin
#

yea

eternal oxide
#

and you put your png inside teh folder with yoru modid ?

proud basin
#

yea

eternal oxide
#

not as folder called modid a folder with the name YOU set your modId to