#help-development

1 messages · Page 662 of 1

smoky oak
#

thats little to do with putting it into a variable

native bramble
#

But i have match

undone axleBOT
#

It’s hard to answer a programming question without code
Oh no! You ran into a problem. But no worries, people are willing to help, but first they need to see your code. This is because otherwise, they would be providing help based on guesses instead of concrete knowledge. Whether it be a compile error, runtime error, or an unexpected output, I'm sure that if you were to provide code, you'd receive a quick solution.

native bramble
#

wait

#
public static void saveDataToDatabase(String tableName, Map<String, Object> data) {
        try (Connection connection = MainDataHandler.getConnection()) {
            String query = "SELECT * FROM " + tableName + " WHERE uuid = ?";
            try (PreparedStatement statement = connection.prepareStatement(query)) {
                try (ResultSet resultSet = statement.executeQuery()) {
                    if (resultSet.next()) {
                        String updateQuery = generateUpdateQuery(tableName, data);
                        logger.log(Level.SEVERE, updateQuery);
                        try (PreparedStatement updateStatement = connection.prepareStatement(updateQuery)) {
                            setUpdateStatementObjects(updateStatement, data);
                            updateStatement.executeUpdate();
                        }
                    } else {
                        String insertQuery = generateInsertQuery(tableName, data);
                        logger.log(Level.SEVERE, insertQuery);
                        try (PreparedStatement insertStatement = connection.prepareStatement(insertQuery)) {
                            setInsertStatementObjects(insertStatement, data);
                            insertStatement.executeUpdate();
                        }
                    }
                }
            }
        } catch (SQLException e) {
            e.printStackTrace();
        }
    }```
#

cant really understand what u mean

sterile breach
#

Hello. I'm coming back to pluginsmessages because I still don't understand :.

If I send a message plugin from my proxy to the lobyy server which has 2 players (toto and zozo).

In my spigot plugin, in the onpluginmessagereceiver function which has player as parameter, who will player be equal to? A chosen player or random? (I've been told it's not).

Or will the message be sent to each player on the server, so the event will be called 2 times (because there are 2 players)?

native bramble
#

yeah

#

no

#

set what?

#

OH

#

man ty

whole blaze
#

what language best to learn to develop

smoky oak
#

well if you do spigot id say java

#

if not, depends on what you're doing

native bramble
#

what about kotlin?

#

for spigot which is better?

#

why?

orchid trout
#

it just does

hazy parrot
compact haven
#

kotlin >>

#

idk every industry/enterprise developer I’ve talked to likes Kotlin. this server is just a massive hive mind of haters

hazy parrot
#

Someone started hate and they just continue with it

#

No one actually tried writing in kt

compact haven
#

yeah doge_kek

lost matrix
#

For me its the opposite. Enterprise devs hate kotlin. Its such a hipster language without any standards.
There are 20 ways to achieve the same thing and there is no standardized way of approaching designs.
Its a mess in enterprise.

hazy parrot
#

Wdym without standards?

timid hedge
#

Can someone please help, it isnt sending anything in the console and i am not getting blindness

        boolean attackerPermission = attackerPlayer.hasPermission("vagt");
        boolean victimPermission = victimPlayer.hasPermission("vagt");

        ItemStack attackerWeapon = attackerPlayer.getItemInHand();
        Material weaponType = attackerWeapon.getType();


        if (attackerPermission && !victimPermission) {
            attackerPlayer.sendMessage("You hit " + victimPlayer.getName());
            System.out.println("1");
            if (weaponType != Material.STICK) return;
            System.out.println("2");
            if (attackerPlayer.getItemInHand().getItemMeta().getDisplayName().equalsIgnoreCase("§aSTICK")) {
                System.out.println("3");
                if (attackerPlayer.getWorld().getName().equalsIgnoreCase("A")) {
                    System.out.println("4");
                    victimPlayer.addPotionEffect(PotionEffectType.BLINDNESS.createEffect(100, 1));
                }
hazy parrot
lost matrix
timid hedge
compact haven
#

“hipster language” developed by the same company that makes your IDE. Though, I will admit that’s not a valid counter.
Yes, there are a lot of ways to achieve things. Same in Java, you can DI, static singleton, or you can factory pattern, a giant fucking switch statement, whatever. It’s up to your company to create valid systems to keep the code consistent

hazy parrot
compact haven
#

not to mention, Java is quite quickly adding features that coincide with Kotlin

#

you can write dumb kotlin just like you can write dumb java

hazy parrot
#

Only thing I know you can do different in kotlin is having actual functions (not tied to object), but that will be implemented in java too

#

Maybe I'm just not that deep into it

lost matrix
#

The patterns themselves not, but the implementation of those patterns.
Take extension methods for example. Its such a pattern breaking feature
that i dont see any justification for it being in a jvm language at all.

#

Only cool thing about Kotlin is its null safety

hazy parrot
#

Well ext methods are just synthetical sugar

eternal oxide
#

I used to hate null, now I love it

hazy parrot
#

You can also argue that statics are breaking whole oop concept

lilac dagger
#

how so? they're still prone to problems

#

i mean about null

lost matrix
hazy parrot
#

That's true

compact haven
#

No, you probably shouldn’t use them in an enterprise project

#

Once again, the team create a code style to make well designed code

#

You don’t need to use every feature in Kotlin, just like you don’t need to use every feature in Java

tender shard
buoyant viper
#

im more of a Scala person

compact haven
#

Like, for example, in Kotlin you can == on a string (or any object) and it replaces with #equals. That’s a good feature that probably should be used, and yet can be overridden with triple equals. As for operator overloading += on a registry manager, while you can, you probably shouldn’t because it’s bad design.

#

in Java you can pass a Map<String, Object> as parameters instead of a builder pattern, doesn’t mean you should

lost matrix
#

And here standards break. If you use an external lib then you wont immediately know if they overloaded anything.
In Java .equals() is an implementation detail and == checks for identity.

compact haven
#

you as the developer know if you need to call === or == rofl

#

You never use == in Java unless you’re checking reference, same with === in Kotlin

#

it’s just turning a method into an operator, as it should’ve been in Java

buoyant viper
#

[hides in only uses .equals on Strings]

#

jk (kind of)

lost matrix
#

There is just too much stuff with implications in kotlin for me. Infix functions. Or overloading invoke operators.
All of those generate quite a bit of code which is not appearent immediately when reading code.

quick shadow
#

hi, im trying to setup an nio socket communication ! (because i need to communicate without players online and i cant have redis because of vps ) , i did send a message to a other server but when i try to make each other send and receive messages , this doesnt work , it is impossible with sockets ?

kindred sentinel
#
  @EventHandler
    public void onClick(InventoryClickEvent event) {
        if(event.getWhoClicked() instanceof Player){
            Player player = (Player) event.getWhoClicked();
            ItemStack currentItem = event.getCurrentItem();
            int chosedSlot = event.getSlot();
            int mainHandSlot = player.getInventory().getHeldItemSlot();
                if(!currentItem.getType().isAir() && chosedSlot == mainHandSlot) {
                    ItemMeta a = currentItem.getItemMeta();
                    a.setLore(Arrays.asList("ABC", "DEF"));
                    currentItem.setItemMeta(a);
                    event.setCurrentItem(currentItem);
                    System.out.println("READY");
                }
        }
    }

This is example

buoyant viper
#

?jd-s

undone axleBOT
kindred sentinel
#

oh ok i got it sorry

buoyant viper
#

i mean that was really just for me to look at

lost matrix
buoyant viper
#

but if i had to guess, id guess ur point of failure is at chosedSlot == mainHandSlot

remote swallow
small iron
buoyant viper
#

if mainHandSlot is what i think it is

buoyant viper
lost matrix
kindred sentinel
#

Ok i'll try something else, i'll try to use BukkitScheduler.runTask(Plugin, Runnable) in inventory click event but then i have another problem, i couldn't change meta of event.getCursor() and event.getCurrentItem() using arguments

cunning crater
#

yea but every time a player joins doesn't that use too much processing power? or is it normal to do it like that?

tender shard
#

does anyone know how gson's type adapters work?

quick shadow
tender shard
#

app?

quick shadow
tender shard
#

no clue what rabbitmq is. but installing redis is basically just one apt / yum command

young knoll
#

It’s another messaging thingy

tender shard
#

i am still confused what's meant with "without the app" and why it should not be possible to install redis on a VPS

#

isn't the whole point of a VPS that you can install whatever you want

river oracle
quick shadow
#

i only have minecraft hosting multi server service , i can use redis using only this ?

tender shard
# river oracle the Serializer interfaces? or TypeAdapter class?

I got this: https://github.com/JEFF-Media-GbR/JsonConfigurationSerialization/tree/master

Now I also wanna have a public static final TypeAdapter<ConfigurationSerializable> but I have no clue how, it only allows me to use those weird JsonWriters and JsonReaders instead of just giving me a string and/or letting me return a string lol

GitHub

Contribute to JEFF-Media-GbR/JsonConfigurationSerialization development by creating an account on GitHub.

tender shard
river oracle
remote swallow
#

^^

quick shadow
river oracle
tender shard
remote swallow
#

use the code i sent earlier

river oracle
# tender shard why? how?

why is it gross because using streams for formatting code is hard to visualize and annoying to format

#

implement JsonSerializer<ConfigurationSerializable>, JsonDeserializer<ConfigurationSerializable>

#

you can then work with JsonElements instead of streams which imho is nicer way. If you absolutely need the speed figuring out how to make the Streams nice is annoying as fuck

remote swallow
#
public class ConfigurationSerializableAdapter implements JsonSerializer<ConfigurationSerializable>, JsonDeserializer<ConfigurationSerializable> {

    final Type objectStringMapType = new TypeToken<Map<String, Object>>() {}.getType();

    @Override
    public ConfigurationSerializable deserialize(JsonElement json,Type typeOfT,JsonDeserializationContext context) throws JsonParseException {
        final Map<String, Object> map = new LinkedHashMap<>();

        for (Map.Entry<String, JsonElement> entry : json.getAsJsonObject().entrySet()) {
            final JsonElement value = entry.getValue();
            final String name = entry.getKey();

            if (value.isJsonObject() && value.getAsJsonObject().has(ConfigurationSerialization.SERIALIZED_TYPE_KEY)) {
                map.put(name, this.deserialize(value, value.getClass(), context));
            } else {
                map.put(name, context.deserialize(value, Object.class));
            }
        }

        return ConfigurationSerialization.deserializeObject(map);
    }

    @Override
    public JsonElement serialize(ConfigurationSerializable src,Type typeOfSrc,JsonSerializationContext context){
        final Map<String, Object> map = new LinkedHashMap<>();
        map.put(ConfigurationSerialization.SERIALIZED_TYPE_KEY, ConfigurationSerialization.getAlias(src.getClass()));
        map.putAll(src.serialize());
        return context.serialize(map, objectStringMapType);
    }
}
#

thats what i do

tender shard
#

what is a JsonElement? I'd much rather just get a string as input and output

river oracle
remote swallow
#

basically its an object in json

#

it can have sub objects, arrays etc

tender shard
#

what's the "Type" parameter supposed to be?

river oracle
tender shard
#

is there really no way to just get the input and output as string?

tender shard
river oracle
remote swallow
#

not really

river oracle
remote swallow
tender shard
fluid river
#
final Type objectStringMapType = new TypeToken<Map<String, Object>>() {}.getType();```
#

my eyes

river oracle
#
Map<String, Object> stuffs = new HashMap<>();
JsonObject parentObject = element.asJsonObject(); // assumes lead is object which should be consistent unless you use this adapter for something it shouldn't be used for
parentObject.entrySet().forEach((Entry<String, JsonElement> element) -> {
  stuffs.put(element.getKey(), element.getValue().getAsString()); // assumes all elements are string you may need some extra filtering
});
#

@tender shard is this still "bad"?

lost matrix
tender shard
river oracle
tender shard
#

why can't I just get the JsonElement as Map<String,Object>

river oracle
#

this is for a JsonDeserializer from json

tender shard
#

and how would I even use the Serializer in Gson?

river oracle
#

though I suppose you could just loop over the leemnt itself

river oracle
#

use is exactly the same

lost matrix
#
SomeObj obj = ...;
String json = gson.toJson(obj);

// Later on
String json = ...;
SomeObj obj = gson.fromJson(json, SomeObj.class);

Thats all you should have to use gson for. If you have to manually
tinker with JsonObjects then you didnt configure your Gson instance properly.

river oracle
#

I'm not talking about manually doing that every time

lost matrix
#

Ah then its ok

#

Let me scroll up

#

...

tender shard
#

this feels so stupid, I'd literally have to create a new map with the same contents

eternal oxide
#

if you just want a Map Map<?, ?> map = gson.fromJson(reader, Map.class);

river oracle
#

^ I suppose that would work to though I'd say the output is less nice to deal with

#

ig thinking in that facet you could run a context cal

#

I mean that's what context is for

river oracle
#

you could also use a type token instead of a Map.class and get the exact (String, Object) map

#

then you have no weird errors and unchecked casting to deal with on your end

lilac dagger
#

i like that spigot comes with the simple json as well

#

so useful

tender shard
#
private static final Gson gson = new GsonBuilder().registerTypeAdapter(ConfigurationSerializable.class, JsonConfigurationSerialization.ADAPTER).create();

    @Subcommand("itemToJson")
    public static void itemToJson(Player player) {
        ItemStack item = player.getInventory().getItemInMainHand();
        String json = JsonConfigurationSerialization.serialize(item); // works fine
        String json2 = gson.toJson(item); // Error, DebugCommand line 101

Stacktrace: https://paste.md-5.net/iharozecaq.md

JsonConfigurationSerialization class: https://github.com/JEFF-Media-GbR/JsonConfigurationSerialization/blob/master/src/main/java/com/jeff_media/jsonconfigurationserialization/JsonConfigurationSerialization.java

#

why does gson want to make any fields accessible in the first place?

lost matrix
#

Looks like its not using your TypeAdapter

tender shard
#

does it not understand that ItemStack is ConfiguratzionSeriazable?

lost matrix
#

How did you register your adapter?

tender shard
#

it's in the codeblock above

lilac dagger
#

are itemstacks gson serializable?

lost matrix
#

You need to register it as a type hierarchy adapter

lilac dagger
#

ah, but that's still work

#

not like the yaml one provided by bukkit where you can just put an itemstack and poof it's serialized

tender shard
lost matrix
#

Uhm.

#

Try enabling complex map key serialization for your gson instace

#

(wild guess)

tender shard
#

the gson instance used in the serializer lib, or the gson instance used in the test plugin (where I registered my hierarchy type "adapter" which isn't actually a typeadapter)?

#

oh I think I got it working

lost matrix
#

What was the problemo

tender shard
#

tbh I have no idea. I did another mvn clean package because I noticed the lines in the stacktrace make no sense, but I don't remember having changed anything lol

lost matrix
#

🤷 dont touch it then

tender shard
#

yeah lol. thanks!

#

but does this really make any sense? I mean my adapter basically only calls the methods I already had

mortal hare
#

lmao

#

my intellij indexes files for 40 mins

tender shard
#

also does it make sense to also extend TypeAdapter? I don't really understand the difference between JsonSerializer/JsonDeserializer and a TypeAdapter, and it also makes little sense to me that GsonBuilder#registerTypeHierarchyAdapter takes in an Object instead of a TypeAdapter and/or JsonSerializer/Deserializer

mortal hare
#

something is really wrong here

sullen marlin
#

There's subtle differences but type adapter is easy iirc

#

(de)Serialiser works on the Json stream itself whereas adapter works after parsed

tender shard
#

TypeAdapter only gives me JsoNReaders and JsonWriters and I have no clue how to turn those into the underlyin Map<String,Object>

sullen marlin
#

So slower but easier

river oracle
#

@tender shard I just made a basic type adapter for ConfigSerializable's

#

idk if you got yours working

tender shard
#

a real TypeAdapter?

river oracle
#

no just teh serialize deserialize

tender shard
river oracle
remote swallow
tender shard
#

I only need a Type Adapter so I know how to call my serializer/deserializer for the javadocs

river oracle
#

I mean unless you're serializing and deserializing a ton during run time does it really matter?

tender shard
remote swallow
#

that will work as a type adapter

remote swallow
#

1 is extending TypeAdapter

#

the other is implementing 2 things

#

both will work in gson with the type adapter stuff

tender shard
#

this is my issue. What am I supposed to say i nthe javadocs what this is, if it's not actually extending TypeAdapter`?

#

I can't claim it's a type adapter if it isn't extending it

remote swallow
#

it will still be a type adapter

#

it doesnt have to extend TypeAdapter

tender shard
#

then imho it isn't one

remote swallow
#

you have 2 options then

#

call it a type adapter with json de/serializer or figure out json reader/writer

tender shard
#

I really hate gson

river oracle
river oracle
#

I mean its fine if you literally want to use a type adapter, but I whipped the equivalent of one up in like 5 minutes

river oracle
#

the code I sent earlier

#

is quite literally the equivalent of a type adapter that isn't somewhat annoying to write

#

it works tested it with an item stack

tender shard
river oracle
river oracle
#

I thought the ItemStack serializer would just do that

tender shard
#

I won't call something TypeAdapter if this does not work

TypeAdapter<?> myAdapter = new MyTypeAdapter();
#

and since this will not work, it is not a TypeAdapter

river oracle
#

why are you so hell bent on using a TypeAdapter if its performance I'm fine with the reason if its not you're being overly stubborn

tender shard
#

well shall I just call it Something or what

#

I can't simply call something TypeAdapter if it isnt a TypeAdapter

river oracle
#

call it a "converter" or something then if you're so strict with the vocabulary

remote swallow
#

idk what the issue is rn

#

both will work as a type adapter in gson builder

#

that is all it should ever work and be used in

quaint mantle
#

Is there a limit on how many packets/s the client can send in BungeeCord? Like, how many plugin messages could a plugin send before "collapsing" or "harming" the channel?

river oracle
remote swallow
#

i dont think it would be that hard

quaint mantle
#

Embed fail

river oracle
remote swallow
#

y2k are you a bd or a vc using

river oracle
#

lol

tender shard
# remote swallow idk what the issue is rn

the issue is that I cannot call something TypeAdapter if it does not extend TypeAdapter, otherwise people will try TypeAdapter<Something> adapter = new MyTypeAdapter(); and then java obviously complains

sullen marlin
quaint mantle
#

I use vencord, but I have nothing that breaks discord TOS

sullen marlin
#

there's an old PR on it, but needs some changes

quaint mantle
#

Just my custom RPC

river oracle
#

the current place that the event is called from wouldn work if we added BlockState

#

beacuse it would be pretty much overriden as soon as you apply it unless my assumptions about how BlockState works are wrong

sullen marlin
#

the event should be changed to entirely the block state and the string array should be convenience method to block state

remote swallow
river oracle
quaint mantle
#

What can you do with BlockState btw?

river oracle
#

beacuse currently the event is called in TileEntitySign#setMessages a private method, however if I go to apply the block state from the event it'll just apply the old data after again no?

sullen marlin
#

should just call event with a blockstate that has all the changes, then call .update after the event

river oracle
sullen marlin
#

Uh those look ok

#

The second line is for update packet?

river oracle
#

yeah that's not my code though that's the NMS

native bramble
#
[00:03:36 ERROR]: Could not pass event PlayerInteractEvent to TestMelody vbeta-v0.1
java.lang.NoSuchFieldError: BOOLEAN
        at plugin.sisska.Player.PlayerSettings.Gui.ProfileGui.getFullNameItem(ProfileGui.java:67) ~[TestMelody-0.1.jar:?]
        at plugin.sisska.Player.PlayerSettings.Gui.ProfileGui.openSettingsGui(ProfileGui.java:31) ~[TestMelody-0.1.jar:?]
        at plugin.sisska.Player.PlayerSettings.Gui.ProfileGuiListener.onPlayerInteractCampfire(ProfileGuiListener.java:50) ~[TestMelody-0.1.jar:?]```
code - https://pastebin.com/QZFu6cEw
`NamespacedKey keyDefaultName = new NamespacedKey(TestMelody.getInstance(),"is-default");`
river oracle
#
this.updateText((signtext) -> {
    return this.setMessages(entityhuman, list, signtext); // event runs in this method
}, flag, entityhuman); // CraftBukkit - add parameter EntityHuman
this.setAllowedPlayerEditor((UUID) null);
this.level.sendBlockUpdated(this.getBlockPos(), this.getBlockState(), this.getBlockState(), 3);
sullen marlin
#

Ye that code seems fine

river oracle
#

hmm okay Idk why but I thought it wouldn't work like that thanks

tender shard
#

guess I'll call it ConfigurationSerializableTypeHierarchyAdapter as that does not literally say "TypeAdapter" but only TypeHierarchyAdapter which doesn't seem to be an actual class name

river oracle
# sullen marlin Ye that code seems fine

btw idk if you've seen the jira there was one with SignChangeEvent for a cause, I'm pretty sure that's impossible to reasonably implement, we'd probably need to add NBT to a block to do that seeing as the same packet is sent both for change on place and change on edit.

sullen marlin
#

There was an open event recently

#

Wasn't that you

river oracle
river oracle
#

oh I opened another sign one thought you were on about that

remote swallow
#

technically are toddlers @ApiStatus.Experimental

remote swallow
undone axleBOT
kind hatch
native bramble
native bramble
kind hatch
#

That would be why.

#

The Boolean PersistentDataType was added in 1.19.4

remote swallow
#

oh i forgot about that lol

native bramble
#

plugin is 1.20

#

my bad

#

plugin is 1.20.1 vers, but server is 1.19.4

remote swallow
#

that doesnt add up

#

you cant run a 1.20 plugin on 1.19

#

but update ur server

native bramble
remote swallow
#

update 1.19.4

tender shard
#

I have a public static field of a class instance - currently I have copied the javadocs of the class to the field - is it possible to somehow tell javadoc to do this automatically? So I don't have to write the same javadocs twice?

river oracle
#

or just downgrade your plugin

lilac dagger
#

well, you could run it if there's no nms or newer features in the plugin

remote swallow
#

run builtools for it again

native bramble
#

make plugin 1.19.4 vers?

quaint mantle
#

You could try to use BYTE and use byte values of 0 and 1

#

0 = false | 1 = true

river oracle
#

^ you could use byte and just do a simple byte == 0 ? false : true

native bramble
#

yeah, im using in another data this

mortal hare
kind hatch
native bramble
#

but still why this error appers?

quaint mantle
native bramble
#

if pdc added in 1.19.4

quaint mantle
#

Blame java for not having bit native 😎

hazy parrot
remote swallow
mortal hare
#

c

quaint mantle
#
bit bIt = 0;
boolean b = (boolean) bIt;
#

Imagine

hazy parrot
#

You can do while(1) in cpp?

mortal hare
#

yes

#

iirc

native bramble
#

thank u guys

mortal hare
#

you can do while(165256) and it still work as true

hazy parrot
#

I'm not sure

#

That is c

mortal hare
#

it works in cpp too

kind hatch
#

C++ is just C with classes, isn't it?

alpine urchin
#

cpu thing

quaint mantle
mortal hare
#

objective c

#

is c with classes

alpine urchin
#

whats python

quaint mantle
hazy parrot
mortal hare
#

snek

alpine urchin
#

with classes

mortal hare
alpine urchin
mortal hare
#

what im talking about that you cant use true and false on data types that are bigger than boolean data range

#

in java

#

and you always use either if statement or ternary operator

#

which sucks in my opinion

alpine urchin
#

booleans and bytes are same size

#

you can’t simply allocate one bit

#

smallest data you can allocate is a byte

#

so you saying bigger than boolean implies byte is bigger

mortal hare
#

it doesnt matter >= should work too still

#

i meant by data range

#

byte has from [0-255] and boolean from [0-1]

young knoll
#

Aktually

mortal hare
#

why cant byte store true or false in that case

young knoll
#

Byte is -127 to 128

mortal hare
#

ik

alpine urchin
#

you could although be a cheapskate and a weirdo and store multiple booleans inside a byte

quaint mantle
alpine urchin
#

therefore instead of allocating a bit

mortal hare
#

im just using unsigned char as an example

alpine urchin
#

you treat it as individuals ones

kind hatch
alpine urchin
#

yes

#

in java theres a bitset class

mortal hare
#

eh i sometimes prefer bitwise operations 😄

alpine urchin
#

but this is not supposed to be done to save ram

#

lol

#

maybe do it to save bandwith when transmitting data over a network

#

minecraft does this

#

but don’t fool yourself tryna spare a boolean variable

#

@mortal hare why are you typing for so long

mortal hare
#
public void setBit(boolean value) {
  data = (~(1<< index) & data) | value;
}
mortal hare
#

im trying to remember how to do bit manipulations manually

alpine urchin
#

if words were spelled the way they are spoken

mortal hare
#

from my head thats why

quaint mantle
#

But explained in a different way

mortal hare
#

twos complement vs unsigned

young knoll
#

I'll show you unsigned

alpine urchin
#

java doesn’t have that

#

so he doesn’t know what it is

#

its ok

#

coll

#

welcome to pro coding

#

we use unsigned data types to feel cooler

young knoll
#

It hold bigger number

#

Big number go brrrr

alpine urchin
#

unsigned sex

silent steeple
#

Why doesn’t my jni native method get put in a shared library using gcc

remote swallow
#

garbage collection collection

silent steeple
#

public native jniMessageBox(String message, int icon, String title);

worldly ingot
silent steeple
#

Impl: MessageBoxA(message, title, nullptr);

#

But it doesn’t happen when called

sullen marlin
#

Jni ☠️

silent steeple
#

Anyone know

#

Cuz all my other jni method works

silent steeple
remote swallow
#

its garbage collection collection

worldly ingot
#

oh okay

alpine urchin
#

jna is firer

#

so idiots can use jni

quaint mantle
#

Fuck JNI, I always say; Me and the bros go assembly 😎

river oracle
#

@sullen marlin I'm assuming its intended that you should beable to edit the sign data during SignChangeEvent? because if so this is not the case currently. If its supposed to be a read only thing I'll add that to the docs. The thing with block state is it makes it annoying to ensure updates are actually made

#
final Sign state = event.getState();
state.getSide(event.getSide()).setLine(1, "Changed");
state.getSide(event.getSide()).setColor(DyeColor.LIME);
event.getPlayer().sendMessage("Running SignChangeEvent");
``` for example nothing will change with the sign if I use the BlockState it'll be overriden, without using block state you can simply altar the Strings being set for the title but as soon as you expand beyond that the event's current placement becomes tricky
quaint mantle
#

Burn him to death

#

Or demote him to trial user

#

Or even worst, promote him to discord moderator

worldly ingot
#

event.setLine()

river oracle
#

however placement of the event becomes problematic once you add block state to support other things such as sign coloring etc

#

in its previous position in PlayerConnection it seemed fairly easy to do this minus a few changes, but the events moved into TileEntitySign, it seems difficult to me to actually introduce BlockState there

remote swallow
remote swallow
worldly ingot
#

SignChangeEvent only happens on the side that's changed

worldly ingot
#

Which is how that event's always worked

quaint mantle
remote swallow
#

he would be if he was real

#

?ischocoreal

undone axleBOT
#

No, Choco is not real. I was not programmed to say this by Sam.

river oracle
quaint mantle
#

he's a simulation

#

Sorry

#

It is*

remote swallow
#

atleast sam is real

#

?issamreal

undone axleBOT
#

Yes Sam is real. I was not programmed to say this by Sam.

quaint mantle
#

Is he?

#

I mean

#

That was not told by a sign

#

So CafeBabe might be lying to us

remote swallow
#

it was told by cafebabe

#

cafebebe is in all of our plugins

#

so it has to be true

quaint mantle
#

Hmmm, that logic is just... so good

#

Must be true

#

Oh no, what could we do? We have a non-real thing in spigotmc

sullen marlin
worldly ingot
#

Oh is Y2K in the process of doing that? lol

sullen marlin
#

I'm really not sure what the issue is

river oracle
sullen marlin
#

Why

#

Just use the state from the event

river oracle
#

@sullen marlin so you'd say go about it like this correct?

// CraftBukkit start
Player player = ((EntityPlayer) entityhuman).getBukkitEntity();
final org.bukkit.block.Block signBlock = CraftBlock.at(this.level, this.worldPosition);
final org.bukkit.block.Sign signState = (org.bukkit.block.Sign) CraftBlockStates.getBlockState(signBlock);
SignChangeEvent event = new SignChangeEvent(CraftBlock.at(this.level, this.worldPosition), player, signState, (front) ? Side.FRONT : Side.BACK);
org.bukkit.Bukkit.getPluginManager().callEvent(event);
event.getState().update();
if (event.isCancelled()) {
    return originalText;
}
// CraftBukkit end

return signtext;
``` once the event gets back update the block state regardless? I mean I'm just struggling as I'm not seeing how this can be done in the spot where the event currently is realistically speaking
golden turret
#

why this is not working and how to fix?

undone axleBOT
#

"Does not working" is a useless statement. Please describe what exactly is not working, what you expect it to do, and what actually happens. If you get any console errors, also ?paste the entire stacktrace.

tender shard
#

it even printed out your "data" map

#

the [] part

golden turret
#

nop

#

it is another thing

#

I also added some breakpoints before

#

and only the first line was being called

tender shard
#

then what's that?

golden turret
#

the [] is me trying to fetch the data to see if it was being added

#

lists are [] and maps are {}

tender shard
#

well then simply don't pass "null" into your insert method?

golden turret
#

it is not null

tender shard
#

is insert running in an async thread?

golden turret
#

yes

tender shard
#

wrap the whole insert method into a try/catch(Throwable ...) block and then do printStackTrace

golden turret
#

alright

#

just added it and said the exception

#

just a null value to Map.of 🤡

#

thanks

tender shard
#

np

ivory sleet
#

well null is a bit evil so not 🤡 but Pog

opal juniper
#

Null > null

#

hehe

ivory sleet
#

Agree 101%

tender shard
#

whenever someone has birthday, I'm a Supplier<Void>

opal juniper
#

i do like how you can return Null though meaning you can inline method calls and return statements

lilac dagger
#

uglier runnable

opal juniper
#

like in python

tender shard
#

i need a plugin idea for a suspicious stew plugin

#

idk what it's going to do but it has to have something to do with sus stews

ivory sleet
#

How suspicious should it be?

tender shard
#

very

#

!

ivory sleet
#

I reckon it must be suspiciously suspicious at least

tender shard
#

yeah at least - if not more

kind hatch
#

Make the stew sit on a pedestal.

#

An ominous looking one.

tender shard
#

lmao that'd be awesome tbh

#

I'll install displayeditor and try sth

simple schooner
#

Good morning chat

tender shard
#

hewwo

warm mica
# lilac dagger uglier runnable

🤓 Runnable's are intended to be executed by a starting thread while suppliers are intended as a general-purpose callback. Thus, strictly speaking, the supplier<void> would be more fitting

lilac dagger
#

They're functional interfaces now, it doesn't matter

#

If i wanted to be more specific i would make my own Callback functional interface

flint coyote
#

Idk why this keeps happening but I woke up in the middle of the night and my thoughts won't let me sleep anymore.

Currently wondering: Lets say plugin A is released under GPL and Plugin B uses Plugin A's API and is also released under GPL. Then Plugin C used the API of Plugin B and does not release under GPL. Can the owner of plugin A sue the owner of Plugin C?

Probably could, right?

Now what if Plugin B already uses a wrong license? Is the owner of Plugin C liable for violating Plugin A's license because he just checked Plugin B's license?

river oracle
#

Plugins have to be under GPL pretty sure its in one of GPL's clauses so whoever sued for not following "their license" would get owned in court

flint coyote
#

I am aware that plugins technically have to be GPL but only craftbukkit and spigot can enforce this and probably never will

river oracle
warm mica
#

It doesn't count for APIs as you don't include the source code

warm mica
flint coyote
#

you don't include spigots source code into a plugin either. Still applies

ivory sleet
#

No

#

It doesn’t say that marcely

#

It says something similar

#

But not that

warm mica
ivory sleet
#

Yep, but if you scroll down you will find another paragraph which tells you something else, and strictly speaking that quote there only talks about java.lang.Runnable and java.lang.Thread (their relationship)

warm mica
gray saddle
#

yo obfuscation breaking my plugin bro

#

am using proguard

flint coyote
lilac dagger
#

i'm pretty sure i've seen some official example of functional interfaces somewhere that used runnable

ivory sleet
#

Freestyler yes

#

You can put it the other way around

warm mica
ivory sleet
#

If a class is intended to have instances solely to be executed by a thread then somewhere a runnable needs to be created

ivory sleet
warm mica
warm mica
ivory sleet
#

No thats not true at all

lilac dagger
#

Wait but now it's the discussion of the birthday present, do you guys give the present at the end or at the beginning?

ivory sleet
#

There is nothing in that paragraph, or on that javadoc for that part that discourages let alone warns one to not use Runnable as a general purpose callback. Moreover Runnable is used as a general purpose callback, just look at the JDK?

flint coyote
warm mica
#

You are basically explaining modding and it's a thing since always

ivory sleet
#

The only truth regarding Runnable is that it used to be the actualization of Java’s command object design pattern to address the design of their threading.

#

But that’s long time ago

warm mica
#

I am using Runnable myself a the time. I am only talking about strictly speaking

gray thicket
#

Hello there, I get the error "The import org.bukkit cannot be resolved" in Eclipse.
I added the spigot api shaded jar into the libraries. What can I do?

flint coyote
ivory sleet
#

You can go back to java 4 or even way back if u want and read it

#

You can ask the author of that javadoc

#

They will give similar answers to what I’d give you

warm mica
flint coyote
#

That's interesting. I wonder why so many people state that plugins have to be GPL then.

#

I googled that multiple times (not today) and that's all I found - people complaining about the license, then others saying "don't worry, they won't enforce it"

wet breach
flint coyote
#

frost since you know a lot about various different topics can you confirm that a license does not apply as long as you don't compile the licensed code into your own code?

#

What Marcely stated sounds reasonable - I just wonder why so many people state otherwise

wet breach
#

They state it has to be gpl because of the api

#

The api license applies similar how the eula would still apply

flint coyote
#

Yes but you don't include the api in your deliverable

wet breach
#

The exception to this rule is if the api is not inherent to its functionality

wet breach
flint coyote
warm mica
wet breach
#

Derivatives are subject to the license on what it is based on

wet breach
#

So for instance spigot is not allowed to mess with the drm stuff aka login etc

#

Except on what is already provided

#

There is many grey areas around the line an pretty much game creators and mods right now have this nice equilibrium in respecting each other for the most part

flint coyote
#

That sounds reasonable. It gets rough when an api based on the api is used.
Like using WE/WG api (which are GPL) in one of your plugins

#

I mean it's pretty save to say that spigot/craftbukkit won't sue you for releasing your plugin with another license. WE/WG still could though.

#

And if that plugin is also some kind of lib/engine, then the owner of that plugin could sue you, too. The more nested apis you use, the more at risk you are when releasing anything based on that in a paid plugin (and don't deliver the source with it on purchase as GPL requires you to)

simple schooner
#

why is this red, am I doing it wrong

kind hatch
#

Reload your Pom

flint coyote
#

did you press the maven reload button on the top right?

simple schooner
#

i'm afraid to reload my pom because it's red

buoyant viper
#

reload is... exactly what can fix it

flint coyote
#

it won't jump at you and murder you, don't worry

simple schooner
#

okay

abstract sorrel
#

?nms

abstract sorrel
#

When i build my nms project the files produce look like this etc: (artifact id)-(version)... how could i replace the artifact id with the name of the plugin, basically make it capitalised

timid bridge
#

Anyone know of a plugin that gives the shine enchantment effect on armor and items without any enchantment buffs? The enchantment shine is normally purpleish but is there also a plugin that can make it any colour?

simple schooner
abstract sorrel
young knoll
#

Why is that funny

reef whale
#

hey guys
i want to remove the items from a specific slot in a player's inventory

#

but i tried a few methods, they dont work

#

which method should i use?

#

i tried removeItem(int, itemstack) remove(itemstack) setitem(int, air)

#

and clear(int)

#

the removeItem method only remove a specific amout of items

#

but not the items from a slot

simple schooner
#

why dont you just set the item slot to air

reef whale
#

okay

quaint mantle
#

Hey Guys, Im working 1.20.1, I want to send ArmorStandPacket to Player, so I tried to get a worldLevel from "WorldServer"
Cause the armorstand's constructor needs it
Class I success to get WorldServer But fail to get worldLevel

        nmsPlayer = p.getClass().getMethod("getHandle").invoke(p);

            Class<?> test = ReflectionUtils.getClass("net.minecraft.world.level.World");
 
            Class<?> minecraftServerClass = ReflectionUtils.getClass("net.minecraft.server.MinecraftServer");

            Method getWorldMethod = minecraftServerClass.getDeclaredMethod("D");
            Class<?> minecraftServer = getWorldMethod.getDeclaringClass();

            Object serverLevelObject = minecraftServer.getMethod("C").invoke(minecraftServer);
            System.out.println(serverLevelObject);
            Object plrConnection = ReflectionUtils.getField(nmsPlayer.getClass(), "c").get(nmsPlayer);

I tried to invoke Method "C" from it but the error occurred;

Caused by: java.lang.IllegalArgumentException: object is not an instance of declaring class

Object serverLevelObject = minecraftServer.getMethod("C").invoke(minecraftServer);

and plus, I wonder how to send a packet to player from playerConnection

wet breach
rain pier
#

How do I do damage tilt on a player?

wet breach
#

Basically everyone would lose. Defendant loses but pays nothing because the correct damaged party isnt there but you can still get a declaritory judgement against you. The plaintiff loses but also pays nothing and gets the same thing except may owe legal fees to defendant.

rain pier
#

I can't find a solution

wet breach
#

And then because both parties had judgement the appropriate party could sue both and would most likely win

#

And this is why suits over OS licenses are not common lmao

wet breach
rain pier
wet breach
#

Think that is only client side.

#

Nothing in the api or in the server code that i know of to control tilt

quaint mantle
cursive kite
#

How can I protect players from using pistons to push blocks into others claims since BlockPistonExtendEvent doesn't use a player?

quaint mantle
#

Isn;'t it spawning a whole lot of armorstands client side?

echo basalt
#

Yeah that's not hard

quaint mantle
#

I dont really feel like making a system for thast rn

echo basalt
#

We can make an interface and use bukkit for now

#

until you feel like it

#

And make it versatile enough

long zodiac
#

How do I save a specific inventory? The command "/i" opens a player-specific inventory. I want that when they close it, the items are stored in a hashmap. But how do I determine which inventory is being closed? Currently, no matter which inventory they close, whether it's their default inventory, the "/i" inventory, or any other, the hashmap is always overwritten. However, only the "/i" inventory should be saved.

echo basalt
#
public interface Hologram {

  void setText(String text); // or component, who cares
  void moveTo(Location location);

  // Feel free to add addViewer, removeViewer, destroy methods
}
public interface BlockHologram extends Hologram {

  void setHead(ItemStack item);
  void setHeadRotation(EulerAngle angle);

}
#
public class BukkitBlockHologram implements BlockHologram {
  
  private final ArmorStand armorStand;

  ...
}
kind hatch
#

You can actually replace those armor stands with BlockDisplays if you use the latest version.

echo basalt
#

Yeah

#

Benefits of using an interface

quaint mantle
#

nvm!

echo basalt
#

oh god I found more kids trying to remake hypixel with 0 coding skills

#

funny how they have more contributors than stars

echo basalt
#

But generally the way it goes is that pistons from outside the claim can't interact with blocks inside

opaque scarab
#

I know how to get the inventory of a shulker box ItemStack, but how can I set the inventory?

echo basalt
#

Get the inventory and set its contents

opaque scarab
#

It’s as simple as shulkerBoxMeta.getInventory() = inventory2.0 ?

echo basalt
#

Inventory#getContents , Inventory#setContents

opaque scarab
#

…. How am I that stupid

#

It’s late here

#

Thanks

echo basalt
#

6am here

#

Just woke up

clear panther
#

░░░░░▐▀█▀▌░░░░▀█▄░░░
░░░░░▐█▄█▌░░░░░░▀█▄░░
░░░░░░▀▄▀░░░▄▄▄▄▄▀▀░░
░░░░▄▄▄██▀▀▀▀░░░░░░░
░░░█▀▄▄▄█░▀▀░░
░░░▌░▄▄▄▐▌▀▀▀░░ This is Bob
▄░▐░░░▄▄░█░▀▀ ░░ Copy And Paste Him
▀█▌░░░▄░▀█▀░▀ ░░ in Every server
░░░░░░░▄▄▐▌▄▄░░░ So He Can Take
░░░░░░░▀███▀█░▄░░ Over Discord
░░░░░░▐▌▀▄▀▄▀▐▄░░ (don't spam him)
░░░░░░▐▀░░░░░░▐▌░░
░░░░░░█░░░░░░░░█░░░░░░░
░░░░░░█░░░░░░░░█░░░░░░░
░░░░░░█░░░░░░░░█░░░░░░░
░░░░▄██▄░░░░░▄██▄░░░░░░

echo basalt
#

copypasta

sterile breach
#

Hi, to make 2 plugins communicate with each other (without using pluginsmessages):

Is it better to use a socket system or a redis channel?

hybrid turret
#

Does a playerlogger with playername & uuid even make sense? when someone changes their name, won't it create a new entry (with the name as key) and the same uuid as value?
is there a way, that if that happens, you automatically delete the already existing key?

kind hatch
#

It only makes sense if you are going to do something with the player names. Otherwise, UUIDs are all you need to take action.

hybrid turret
#

i mean you can't access the uuids using commands if you don't wanna type them out, right? lmao

#

like e.g. for a whitelist or sum

kind hatch
#

Right, but in that case, that would only affect online players. You'd be able to get their UUID based on their name.

hybrid turret
#

what

#

how can a player be online if he's not whitelisted?

kind hatch
#

Are you wanting OfflinePlayers?

hybrid turret
#

i mean just Player wouldn't make sense, right?
So OfflinePlayers is all you can do

kind hatch
#

Here's the thing. Since player names can change, you can only really work with what they are currently.
If you whitelist Player1 using /whitelist add Player1, their UUID will be saved to the whitelist.
If they change their name before they join, it won't matter since their UUID will be checked instead of their name.

#

Now, if Player1 changes their name before you add them to the whitelist, then you have a small inconvience on your hands.

hybrid turret
#

yyyes... but that isn't 100% my problem. I wanna get around that goofy depracated getOfflinePlayer(String)

kind hatch
#

That method is only deprecated because people weren't switching over to UUIDs.

#

In your case, you have a valid reason to use that method as is.

#

It's not going to get removed since there are still usecases for it.

hybrid turret
#

huh

kind hatch
#

Just throw a @SuppressWarnings() on it.

hybrid turret
#

can you do that for the whole project? lmao

#

for this one specific condition?

#

classes at max, iirc, right?

buoyant viper
#

u only need it where its used p sure

#

unless ur just using it that much

kind hatch
#

Don't think it can be set on a condition basis.
It would be class wide. Suppressing ALL warnings.

hybrid turret
#

yeah right. but for future purposes, it is annoying to have to add that everytime

#

i mean you CAN define a condition

kind hatch
#

You could make your own annotation. :kek:

hybrid turret
#
@Override
  @SuppressWarnings("ConstantConditions")
  public void onEnable() {
    // Load and create Plugin Configuration
    saveDefaultConfig();
    configFile = new File("plugins/ServerSystemByShioku", "config.yml");
    cfg = YamlConfiguration.loadConfiguration(configFile);

    LanguageUtils.initialize();
    ...
  }

Is the beginning of my onEnable

near mason
#

how to move block with piston push animation?

hybrid turret
#

i guess fine, i'll use suppresswarnings lol

hybrid turret
#

wait, can't an offlineplayer also be null?

#

like, by just... not existing? (also if it is null, does the player not exist at all, since it makes an api call?)

kind hatch
#

IIRC, the OfflinePlayer object itself will never be null, but the contents can be.
For instance, OfflinePlayer#getName() will return null if the player has never joined the server before.

buoyant viper
#

isnt getOfflinePlayer @NotNull

#

?jd-s

undone axleBOT
hybrid turret
#

oh-

buoyant viper
#

"To this method, all players will exist." peepoLove

hybrid turret
#

yay

kind hatch
#

I may be thinking of player skins.

hybrid turret
#

well okay, time to remove outdated if-statements

hybrid turret
hard light
#

do you need forge for skinrestorer to work? my skin wont change no matter what

hybrid turret
#

oooooh right skins for the /nick command. gotta try and understand that one as well...

kind hatch
hybrid turret
#

ohh really? damn

kind hatch
#

I think you have to mess with GameProfiles if you need that type of data.

hybrid turret
#

ic, cause minecraft can do that as well, no?

#

with /give

kind hatch
#

Yes, but they way /give does it is different than how spigot handles it.

hybrid turret
#

damn

kind hatch
#

Blocking web requests and all that.

hybrid turret
#

i keep forgetting spigot and minecraft are whole different things lmao

#

you can't somehow use the minecraft api as well, right?

kind hatch
#

You can, but I think GameProfiles are the recommended way to do that now.

hybrid turret
#

interesting

#

so GameProfiles would also be the way of getting any existing minecraft name + skin for let's say a /nick command?

hybrid turret
#

Also: Why does hidePlayer need the plugin nowadays (quite some time now actually, but it worked with only Player, why the plugin now as well?)

kind hatch
#

Better control. Several vanish plugins and admin plugins would hide players overriding each other causing issues between them. That change now allows for plugins to check if other plugins are changing player visibility and can adjust their checks based on the result.

opaque scarab
#

Is there a built in method to get all chunks a player has loaded; as in, loaded in their render distance?

wet breach
#

For the relevant information

#

Exception to this is offline networks in which case it will generate a uuid for the name given

hybrid turret
#

i see thanks

#

Wait, can't I just always use a HashSet instead of an ArrayList?

topaz panther
#

font exists?

#

Like Engravers Gothic

#

i can't copy and paste maybe theres a way?

hybrid turret
# near mason ????

Don‘t spam questions. I suggest waiting like a couple hours or asking another day because it seems like nobody currently online knows the solution.

Also: did you google already?

hybrid spoke
undone axleBOT
hybrid spoke
#

?jd-s

undone axleBOT
eternal oxide
topaz panther
#

@eternal oxide

hybrid spoke
eternal oxide
#

Not in the API not even in nms

topaz panther
#

is it possible to send a custom font(engravers gothic regular) into the minecraft chat?

#

i don't want to use resources pack ykyk

eternal oxide
#

To get teh block to move you have to send the correct packet, BUT the client also needs an actual piston to render the movement

eternal oxide
hybrid spoke
topaz panther
#

somone answer me pls

eternal oxide
#

Yes have the block move as if it were pushed by a piston, but no actual piston

near mason
hybrid spoke
near mason
eternal oxide
#

probably his best bet today

hybrid spoke
near mason
#

no

#

it but like with no pistons

eternal oxide
topaz panther
#

ill just go use unicode

near mason
#

do i use block displays and barriers ?

hybrid spoke
#

not sure for what you want to use barriers for, but blockdisplays most likely

near mason
#

for collisions

hybrid spoke
#

for that you just check the next block

#

and if its solid, it will collide

eternal oxide
#

or

#

um, depends how far you want the block to move

#

You could use a FallingBlock and physics

upper hazel
#

someone help why why does the custom structure always spawn only near the center even though i load 3000 coordinates

#

there is a place to spawn because there is air in the clouds, but it still says that the places are not suitable

vapid grove
#

?paste

undone axleBOT
vapid grove
eternal oxide
vapid grove
#

Tried debugging this, and researching it. No matter what I did it still keeps moving the particles.

#

I just want them in a straight line.

eternal oxide
#

operate on the chunk in the event

#

your GetHighestBlock si always looking around world 0,0

#

Chunk block coords for x/z are 0-15

smoky anchor
hybrid turret
#

Can you modify the default config on the fly using commands?

eternal oxide
#

commands?

#

what default config?

near mason
#

why does '==' doesnt work sometime?

quaint mantle
#

wdym ?

#

show warning

echo basalt
#

Has to do with java's memory model

onyx fjord
#

It always works

echo basalt
#

When you use == it compares 2 memory addresses

near mason
#

ohhh

echo basalt
#

When you use .equals it compares the internal values

#

So

near mason
#

ok ty

quaint mantle
echo basalt
#

Joe joe = new Joe("joe");
Joe joe2 = new Joe("joe");

joe == joe2 -> false
joe.equals(joe2) -> true

quaint mantle
#

can ido this ?

#

i mean check commandsender instanceof player with early return ?

echo basalt
#

You can

quaint mantle
#

i mean args 0 is

echo basalt
#

It's an array

quaint mantle
#

the command itself?

#

0 or 1 ?

echo basalt
#

0

#

Actually this one is shorter

quaint mantle
#

aight ty

#

i will check

#

😄

quaint mantle
#

i tested

#

works like this

eternal oxide
#

nope

quaint mantle
#

but

#

i did this 1m

eternal oxide
#

cmd, arg[0], arg[1]

quaint mantle
#

if i write only /arkadaş

#

my debug working

#

in console

eternal oxide
#

yeah thats not API

#

oh bungee

quaint mantle
#

ah

#

yest

#

maybe different in bungee ?

eternal oxide
#

yes

quaint mantle
#

aight

obsidian shore
echo basalt
#

Not a huge fan of it

#

I just have my own

#

But when I need to use one because sometimes teams like to stick to FOSS I just go with Cloud

obsidian shore
#

ah I had not heard of that one

buoyant viper
#

?jd

hybrid spoke
#

you have to overwrite the equals method

#

the default impl of equals is always ==

echo basalt
#

correct

timid hedge
#

Hey im trying to do so when you kill ap layer it sends a message and there is 7 reasons and if you click on them in the chat is should execute a command but insted it is sending this is my chat
https://prnt.sc/xOEeP5EeUMGh

TextComponent grund1 = new TextComponent("§aS");
        grund1.setClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/broadcast 1"));
        grund1.setHoverEvent(new HoverEvent(net.md_5.bungee.api.chat.HoverEvent.Action.SHOW_TEXT, (new ComponentBuilder("test1")).italic(true).create()));

        TextComponent grund2 = new TextComponent("§aSV");
        grund2.setClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/broadcast 2"));
        grund2.setHoverEvent(new HoverEvent(net.md_5.bungee.api.chat.HoverEvent.Action.SHOW_TEXT, (new ComponentBuilder("test2")).italic(true).create()));

attacker.sendMessage("you killed" + attacker + "§8[" + grund1 + "§7," + grund2 + "§7," + grund3 + "§7," + grund4 + "§7," + grund5 + "&7," + grund6 + "§7," + grund7 + "§8]");

smoky anchor
#

Don't combine components and legacy formatting
Make it all in components and send the component
Also, I would advise against using §, if you have to, use ChatColor but I think doing it all in components would make more sense

timid hedge
#

But how do i send 7 different components in one message without doing what im doing now?

eternal oxide
#

use the builder

smoky anchor
#

I am sure you can append components to other components
doing "text" + component + "text" calls .toString which is not what you want

eternal oxide
#

components have their own append methods

#

?jd

quaint mantle
#

i need send message in bungeecord

#

with two color

#

but TextComponent supports just 1 color

#

or wait

#

i found

#

nvm

obsidian shore
#
new ComponentBuilder("Hello ").color(ChatColor.RED).
 append("World").color(ChatColor.BLUE). append("!").bold(true).create();```
quaint mantle
#

is this works for bungeecord ?

#

ah yes

#

ty

quaint mantle
#
    public void execute(CommandSender commandSender, String[] args) {
        CommandHandler handler = new CommandHandler();
        if (!(commandSender instanceof ProxiedPlayer)) return;
        commandSender.sendMessage(handler.warningMessage("test"));
    }```
#

i got this error why ?

#

and if i do this works fine

#

or this

smoky anchor
#

commandSender.spigot().sendMessage(component)
I think

obsidian shore
#

What he said

hazy parrot
#

ComponentBuilder != component

quaint mantle
#

ah

quaint mantle
#

or what is baseComponent ?

#

what difference from TextComponent

eternal oxide
#

he's being pedantic about naming. Component is nms or Adventure. In our context we are refering to a Component as a BaseComponent as this is Bungee

upper hazel
#

there is a loop dungeon spawn code with a probability of 30% - the code is repeated every 10 seconds. Will the actual chance of a dungeon spawn increase if you set the loop to every 5 seconds instead of 10

obsidian shore
#

If the cycle is changed from every 10 seconds to every 5 seconds, the actual chance of a dungeon spawn will not increase. The probability of dungeon spawn remains at 30% regardless of the cycle duration.

The cycle duration only affects the frequency at which the dungeon spawn code is executed, not the probability itself.

echo basalt
#

Gpt

obsidian shore
#

yup lol

echo basalt
#

Chance is the same but runs more often

upper hazel
#

but the frequency of occurrence of the dungeon will increase, no?

echo basalt
#

Over the same amount of time, on average it's faster

eternal oxide
#

Chance to spawn still equals 30% but frequency doubles

upper hazel
#

but it means that the number of dungeons will be more in 5 seconds than in 10

echo basalt
#

No

eternal oxide
#

well yes

echo basalt
#

If you run the test for 5 minutes it's one thing

eternal oxide
#

^

echo basalt
#

If you run it 100 times it's another

orchid brook
#

Hi my item name is italic
how can i remove that

 this.setItem(49, ItemBuilder.from(Material.PAPER)
                .name(Component.text("CONFIRMER", NamedTextColor.GREEN))
                .model(10181)
                .pdc(pdc -> pdc.set(buttonKey, PersistentDataType.BYTE, (byte) 1))
                .asGuiItem(this::confirmAction)
        );
echo basalt
#

It's like saying "If I slap your head twice as fast, does it hurt more"

upper hazel
#

does this mean that there will be as many dungeons for 5 minutes of the loop with 5 seconds as for 5 minutes with 10 seconds?

timid hedge
eternal night
#

actively configure your component to not be itallic

#

Component.text("CONFIRMER", NamedTextColor.GREEN).decoration(TextDecoration.ITALIC, false);

#

the client attempts to display item display names and item lore in itallic

orchid brook
#

Oh okay i see, so i need to always remove the decoration on my text component so

eternal night
#

I'd suggest some fast utility method for this, you#ll be typing it rather often 😅

quaint mantle
#

when i append my component builder my last appends is not showing someone know this ?java public BaseComponent warningMessage(String message) { return new ComponentBuilder("test").append(" test254").append(" test5").getCurrentComponent(); }

#

i mean when i start this method

eternal oxide
#

.create()

quaint mantle
#

only work "test5

eternal oxide
#

not getCurrentComponent

quaint mantle
#

if i do this

#

i can't use in player.sendmessage

eternal night
#

you have to use player.spigot().sendMessage no ?

quaint mantle
#

or i can ?

eternal oxide
#

.create() returns a BaseCompunent[]

eternal night
#

which definitely takes a BaseComponent[]

quaint mantle
#

aight i will try

quaint mantle
eternal night
#

oh

hybrid turret
#

Hmmm I just got a lil confused.
Rn I have in my Main something along those lines:

public static File configFile;

public static YamlConfiguration cfg;

public void onEnable() {
  saveDefaultConfig();
  configFile = new File("plugins/myPlugin", "config.yml");
  cfg = YamlConfiguration.loadCpnfoguration(configFile);
}

NOW I want to finally impelent good code practice and make configFile and cfg private.

The problem is:
I‘m a bit confused on what would happen if I were to just write saveDefaultConfig(); and get the config in other classes using Main.getPlugin().getConfig()?
(getPlugin() just returns this in the Main class)

Would it create the config.yml in the Server root folder??

eternal oxide
#

don't

#

do not store in a variable

eternal oxide
#

use Plugin#getConfig()

timid hedge
#

How do i make a hover event on a ComponentBuilder?

hybrid turret
#

Okay. But how do I define the location for it then?

eternal oxide
#

you don;t define the location

#

plugin config.yml is always in the same place

hybrid turret
#

Then where is it created?

#

Yeah but ppl. An have multiple plugins and i‘d like to have it in a folder with the other files needed

eternal oxide
#

each plugin has it's own plugin folder

#

where its config.yml is put

hybrid turret
#

And that folder is defined how?

eternal oxide
#

you don;t define it, it uses the plugins name

hybrid turret
#

Ohhhh

#

So you do define it lmao

#

With the name in the plugin.yml

abstract spindle
#

Is there a way to set the Hardness of a Block with ProtocolLib?
I only found PacketType.Play.Client.BLOCK_DIG - But in there I do not find the hardness

vast ledge
#

Why would you set hardness via protocol

timid hedge
#

Why dosent HoverEvent work here: .append("§aP").event(new HoverEvent(HoverEvent.Action.SHOW_TEXT, (new ComponentBuilder("Tryk for at jail for Provo")
But it works here: .append("§aA").event(new HoverEvent(HoverEvent.Action.SHOW_TEXT, (new ComponentBuilder("Tryk for at jail for Armor")

buoyant viper
#

?notworking

undone axleBOT
#

"Does not working" is a useless statement. Please describe what exactly is not working, what you expect it to do, and what actually happens. If you get any console errors, also ?paste the entire stacktrace.

abstract spindle
timid hedge
#

?img

undone axleBOT
#

Can't send images? That's because you're not verified! Use !verify to complete verification.
Alternatively, you can upload screenshots to any image hosting site and share the link.

Here's some screenshot utilities that can use to upload images.
Lightshot: https://prnt.sc
Imgur: https://imgur.com/upload
Flameshot: https://flameshot.org

pseudo hazel
#

you need componentbuilder

buoyant viper
#

u need to call .create() at the end of it

tender shard
timid hedge
#

Do i need italic?

buoyant viper
#

what the fuck

#

that was so random

tender shard
#

yes

#

you also need code blocks

#

hello I'm the steam admin. we will ban your account if you don't tell me your steamguard code

timid hedge
#

This is the the full thing

        new ComponentBuilder("§aS").event(new HoverEvent(HoverEvent.Action.SHOW_TEXT, (new ComponentBuilder("Tryk her for at jail for Slag")
                .append("§7, ")
                .append("§aSV").event(new HoverEvent(HoverEvent.Action.SHOW_TEXT, (new ComponentBuilder("Tryk for at jail for Slag Vagt")
                        .append("§7,")
                        .append("§aVA").event(new HoverEvent(HoverEvent.Action.SHOW_TEXT, (new ComponentBuilder("Tryk for at jail for Våben + Armor")
                                .append("§7,")
                                .append("§aV").event(new HoverEvent(HoverEvent.Action.SHOW_TEXT, (new ComponentBuilder("Tryk for at jail for Våben")
                                        .append("§7,")
                                        .append("§aA").event(new HoverEvent(HoverEvent.Action.SHOW_TEXT, (new ComponentBuilder("Tryk for at jail for Armor")
                                                .append("§7,")
                                                .append("§aP").event(new HoverEvent(HoverEvent.Action.SHOW_TEXT, (new ComponentBuilder("Tryk for at jail for Provo")
                                                        .append("§7,")
                                                        .append("§aVV").event(new HoverEvent(HoverEvent.Action.SHOW_TEXT, (new ComponentBuilder("Tryk for at jail for VV")
                                                                .italic(true).create())))))))))))))))))))));

I dont know if there should be so many ")" at the crate but i am only getting an error at the lines with .appen("§aP") and .appen("§7, ") after the .appen("§aP") and at .appen("§aVV")

tender shard
#

no there shouldnt

timid hedge
#

It is just sending that is expected it that why i got so many

eternal night
#

Well you are creating new component builders

smoky anchor
#

(unless hardness is the explosion property)

timid hedge
tender shard
timid hedge
#

Yeah exacly

tender shard
#

well then just make your code a bit more tidy

#
    @Subcommand("testClickEvents")
    public static void testClickEvents(Player player) {
        ComponentBuilder builder = new ComponentBuilder();

        BaseComponent[] kick = new ComponentBuilder("Get kicked")
                .bold(true)
                .color(ChatColor.RED)
                .event(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/kick " + player.getName()))
                .event(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new ComponentBuilder("This is a hover text for the kill button").create()))
                .create();

        BaseComponent[] kill = new ComponentBuilder("Get killed")
                .bold(true)
                .color(ChatColor.YELLOW)
                .event(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/kill " + player.getName()))
                .create();

        BaseComponent[] version = new ComponentBuilder("Check Spigot Version")
                .bold(true)
                .color(ChatColor.GREEN)
                .event(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/version"))
                .create();

        builder
                .retain(ComponentBuilder.FormatRetention.NONE).append(kick)
                .append(" | ")
                .retain(ComponentBuilder.FormatRetention.NONE).append(kill)
                .append(" | ")
                .retain(ComponentBuilder.FormatRetention.NONE).append(version);

        player.spigot().sendMessage(builder.create());
    }
timid hedge
#

Okay i will try thanks

tender shard
#

I added the retain(...) parts to fix the formatting

#

now it looks correct and the hover event only applies to the Kick button

timid hedge
#

Is chatcolor.green lime green?

tender shard
#

look at my screenshot

#

look at my code

timid hedge
#

Oh sry thanks

tender shard
#

if you need any other color you can use hex colors

small iron
#

The thing I hate the most is running out of ideas🥲

obsidian shore
#

I'm looking over my plugin graveyard to see if there is anything I wanna revive

#

Most things I had written were for specific servers but, most of them are all down now as I've been away for 4 years

smoky anchor
flint coyote
#

Do what I do and have one idea that you are coding since 5 months and are only halfway done 🥲

obsidian shore
#

or start 30 projects and never finish them

flint coyote
#

Way to many hours in that to abort it

tender shard
obsidian shore
#

yeah, that was my go-to as well

tender shard
#

Advancement Speedrun, Display Editor, Hygiene plugin, ... that's only things I've started in the last 2 weeks and then didnt continue lol

smoky anchor
#

nooo, the display editor actually sounds useful

#

if that is what I think it is

obsidian shore
#

my plugin graveyard as I like to call it has around 200 plugins, some complete some not

#

all varying sizes

young knoll
#

Heh

obsidian shore
#

Oldest dates back to 2015

young knoll
#

Finishing things is hard

#

Especially since I have to make a plugin page once I finish something :/

flint coyote
young knoll
#

Mhm

quaint mantle
obsidian shore
#

I'm at work with nothing better to do haha sure

hybrid turret
#

Does it matter where I place the config.yml in the project? Or does Spigot handle that by itself once I add it to the artifacts and build?

quaint mantle
#

if u see

tender shard
#

it has to be in the root of the .jar file

hybrid turret
tender shard
#

if you're using maven or gradle it must be in src/main/resources

#

but if you use maven, ofc you must NOT use build artifacts

hybrid turret
#

uhmmmmmmmmmm lmao

tender shard
#

the config.yml has to be at the same place where the plugin.yml is

hybrid turret
#

i'm wondering... if i create further files with new File(), I don't need to create them in the project, do I?

tender shard
#

depends on what you're trying to do

hybrid turret
tender shard
#

no, that's wrong

#

src/main/java is for the code

hybrid turret
#

ohhhh

#

wait wtf

tender shard
#

src/main/resources is for normal files like config.yml plugin.yml etc

hybrid turret
#

where did my resources go then? lol

#

why did it not autocreate it? lmao

tender shard
#

did you manually convert a non-maven-project to a maven project?

#

I'd recommend to start from scratch with a new maven project, then you can just copy over your old classes

hybrid turret
#

uhm, maybe?lol

#

i did yeah

tender shard
#

show a screenshot of your whole file structure pls

#

it'S supposed to look like this

hybrid turret
#

i moved it now

tender shard
#

yeah that is correct

hybrid turret
#

and what about the building then?

tender shard
#

it's explained in the blog post above

hybrid turret
#

oh okay okay

tender shard
#

basically you use mvn package

hybrid turret
#

huh

tender shard
#

in the maven tab, double click package

#

your .jar then gets saved to <project>/target/PluginName-Version.jar

tender shard
hybrid turret
#

yeah

tender shard
#

Nice

hybrid turret
#

ij makes stuff really easy ig lmao

#

i can't test it yet tho bc i MIGHT be at work rn and i can't just install minecraft and a server lmao

#

but it didn't fail build

tender shard
#

Do you also wanna know how to make put the jar into the plugin folder directly?

#

If you’re using maven for your Spigot plugins (which you should do), it’s easy to make maven automatically save your plugin’s .jar in your plugins folder. There’s two ways of doing this: 1. The lazy way (not recommended) If you only work alone on one computer, you can just directly declare the output location in...

hybrid turret
#

also: what exactly is supposed to go into the groupId tag?

sage patio
#

is there any chance to miss 1 uuid? because each amount of uuid i put the result is -1