#help-development

1 messages · Page 1819 of 1

quaint mantle
#

i dont feel like learning java is learning maven...

noble lantern
#

3+ years in and still cant write a mavenfile from scratch

smoky oak
#

same

grim ice
#

maybe

noble lantern
#

i can do the repo and dependencies section

#

and the plugin

quaint mantle
#

welp im that type of people who need a template to work on

noble lantern
#

but this shit on the top

quaint mantle
#

even with a single line i still need a template bro

noble lantern
#

ill never remember how to do that from scratch

quaint mantle
#

i hate to write all of the template for me to make changes later

grim ice
#

on the very top

smoky oak
noble lantern
#

mwahaha

smoky oak
#

so apparantly thats a thing now lol

viral temple
noble lantern
viral temple
#

???

smoky oak
#

ctrl alt s

#

its in there

noble lantern
#

file -> settings

#

and then go to appearence

quaint mantle
#

i wonder if i port everything from spigot to mojang mappings, how long would it take?

deft loom
#

Is there any way to convert v3 uuid to v4 in PHP?

noble lantern
#

on a i7

quaint mantle
#

like port every methods + fields, etc, from spigot mappings to mojang mappings then make spigot there

noble lantern
#

exactly

#

4 hours

#

on an i7 9700K

#

(im just messing with you)

quaint mantle
#

😬

noble lantern
#

prolly would take like 10-20 mins ide imagine if your pcs fast

#

or it could take 4 hours, never know

noble lantern
quaint mantle
#

wait how to port it then?

smoky oak
#

I'd need 4 hours

deft loom
viral temple
eternal oxide
quaint mantle
#

ayy 🧢

#

🧢

noble lantern
# deft loom nope

Are you 100% that UUID you have doesnt need to be used through LiteBans API...

#

i seriously have a feeling LiteBans has an API your able to look at and see how they use that UUID to a Player object

deft loom
#

Can't i just make litebans work with nicknames?

quaint mantle
#

i dont think so

noble lantern
#

Youd need to edit source code

#

and it would break once someone changes names

noble lantern
quaint mantle
#

Oh yes, executing commands and doing fucking raw sql queries api

deft loom
#

I didn't find anything about uuids there

viral temple
#

Total duration 36m 18s

#

😦

vale ember
#

does ItemStack's equals test if PDCs are equal?

quaint mantle
#

yeah

orchid cove
#

Hi

#

How to make mutiversion plugin?

eternal oxide
#

modules

vale ember
#

what's the chance that two random uuids is equal?

quaint mantle
#

Minor

vale ember
#

is it safe if i use random uuid's to identify buttons for event handlers?

eternal oxide
#

almost zero, but its possible

quaint mantle
#

hmm how to fix decompile issue, for example this?
private static final Comparator<Entry<String, FilledProfileResults.CounterCollector>> COUNTER_ENTRY_COMPARATOR = Entry.comparingByValue(Comparator.comparingLong((debug0) -> debug0.totalValue)).reversed();

#

10 633 823 966 279 326 983 230 456 482 242 756 608 different uuids can exist

#

the (debug0) in intellij marked it as an object

vale ember
#

so it's safe if i use uuids to check whether clicked item is correct button?

quaint mantle
#

so how to fix debug0 then

quaint mantle
#

Yeah absolutely

eternal oxide
#

using random really depends on what will happen in your code if a collision does occur

#

I'd recommend creating a factory and store any generated UUIDs in a List as a WeakReference<UUID>

#

when you ask for a UUID, you generate one, see if its in your list, if not add it and return it

quaint mantle
#

Thats, like, pointless

eternal oxide
#

not pointless

#

If a collision in your code could cause a data corruption

ivory sleet
#

Thing is, WeakReference is like coupled to the instance you pass

eternal oxide
#

Don't ignore a possible game breaking action because its unlikely

noble lantern
#

Is there a way to force items to smelt in a furnace (those are sticks)

noble lantern
#

In console especially there bug where people get switched with other mods due to clashing UUIDs

eternal oxide
ivory sleet
#

Yes but how does that help his case?

eternal oxide
#

as I said, you create a factory you request UUIDs from

ivory sleet
#

any uuid factory method has no guarantee of generating the same uuid instance, it’s basically a value based class

eternal oxide
#

That factory generates a UUID, checks its not being used, then adds/returns it

dusty totem
#

Hey, my server works on Linux in the background, as a deamon service,
my question is what signal I should send to the spigot server to have the same behavior as executing the stop command on the console?

ivory sleet
#

Yeah, although when Minecraft loads in necessary items, it may end up using a different uuid instance with the same content

eternal oxide
#

he's applying these UUIDs to buttons, so it would not be affected by MC in anyway

#

He's asking if hsi buttons could end up with collisions in their UUIDs

#

I'd guess adding to the PDC

ivory sleet
#

Yuh, it’s still a really vague implementation imho, seeing it as there might be a recreation of a uuid at any given implementation of the api, thus breaking the factory’s cache

eternal oxide
#

The factory is generating, checking and regenerating upon a collision

eternal oxide
#

Its similar to how Mojang would be generating their account UUIDS

ivory sleet
#

Yes but it’d lose the uuid instance if all hard references are lost making it enqueueable for gc as you said yourself.

eternal oxide
ivory sleet
#

Yes, but as he said, he’s using pdc

quaint mantle
#

Stop being paranoic, the factory is just overenginnering. How WeakRefference would help? Since he uses pdc, he probably wouldnt use the same uuid reference all the time,but convert it to the byte array and store/retrieve from container

eternal oxide
#

On a button, probably in a GUI

smoky oak
#

How high is the chance that a player has an already in use UUID?

quaint mantle
#

like not even 1%?

#

idk

eternal oxide
#

zero if online

#

Player UUIDs are account based and assigned by Mojang

smoky oak
#

no i mean if i use UUID as identificators for somethign lets say for some HashMap

eternal oxide
#

zero collisions

ivory sleet
#

Pdc requires a type aware token to store and load entries of given types. The implementation does not guarantee the stored instance to be the same when querying, which makes this implementation vague. Not saying it necessarily breaks directly but its definitely not reliable.

quaint mantle
eternal oxide
quaint mantle
#

oh that

eternal oxide
#

I'd not thought about the transitive nature of PDC

ivory sleet
#

Yuh, tho from what I’ve heard it’s basically a glorified LinkedHashMap or smtng

#

So should probably be fine shrug

eternal oxide
#

should

smoky oak
#

wait how quickly do PDC decay? I'm using them for data storage

eternal oxide
#

depends on what, and decay?

smoky oak
#

like if i go from 1.17 to 1.18 do they still contain their data?

eternal oxide
#

yes

ivory sleet
#

Yeah

smoky oak
#

storing some plugin variables in player PDC

#

seemed like the best solution

eternal oxide
#

thats fine

smoky oak
#

k

noble lantern
#

especially for certain item flags you want to deny/allow

smoky oak
#

oh lol

#

if anyone ever looks into player data generated by my plubin they'll want to gourge their eyes out

#

because i store oveer 700 variables like that

noble lantern
#

You should look at mmoitems items with /data commands

#

or Customitems

smoky oak
#

fair enough i guess

noble lantern
smoky oak
#

cant you set custom recepies somehow?

#

apparantly you can

#

its a one liner

#

getServer().addRecipe(new FurnaceRecipe(ItemStack, Material);

peak gulch
#
public static Map<UUID, UUID> member_sprawdzany = new HashMap<UUID, UUID>();```` How to get the first UUID using second UUID ??
smoky oak
#

grab 2nd uuid then iterate over the map

ivory sleet
#

Value by key?

smoky oak
#

once its equal print out

ivory sleet
#

You could use a BiMap

noble lantern
viral temple
peak gulch
ivory sleet
#

BiMap<UUID,UUID> map = HashBiMap.create();
map.inverse().get(…);

smoky oak
#

oh thats interesting

noble lantern
#

LIED TO!!!

#

jk xD

#

ew that formatting

smoky oak
#

the thing i wrote was one line

#

so were both wrong

noble lantern
#

nice works ty

maiden briar
#

Has anyone seen this before? reference to method is ambiguous

noble lantern
#

Are you editing a List or Map of some sorts?

maiden briar
#

System.out.println(reflectedObject.<Class<?>, Integer, Object[]>invokeMethod(String.class, 0, "aTest3"));

#
invokeMethod(Class<?> returnType, int index, Object... parameters)
invokeMethod(String name, Object... parameters)

These are the methods

smoky oak
#

its because u use an object

#

invokeMethod is overloaded I recon

#

cast it

maiden briar
#

How to fix that then?

#

Cast the last one to Object[]

smoky oak
#

probably. It's just a guess

noble lantern
#

I would assume its because you have Integer as an argument

#

Your cant use a java keyword as a argument without a value iirc unless your comparing types

maiden briar
#

System.out.println(reflectedObject.invokeMethod(String.class, 0, new Object[] {"aTest3"})); This works

#

But without the new Object[] {} doesn't

#

And the other 2 variations still work

ivory sleet
#

Object… vararg is shitty sometimes

#

Like since its an array interpretation the argument Object[] could be an array or just an element of the array

maiden briar
#

If I change it to Object[] parameter it works fine instead of Object...

ivory sleet
#

Thus the ambiguity

maiden briar
#

Ohh

drowsy sapphire
#

can i send an error log in here?

noble lantern
#

yes

drowsy sapphire
noble lantern
#

just make sure you send code too

drowsy sapphire
#

that's the error log

#

here is the mob kill code

noble lantern
#

The player your getting is null

drowsy sapphire
#

how

noble lantern
#

show the code ill tell you how

undone axleBOT
drowsy sapphire
#
@EventHandler
    public void onMobKill(EntityDeathEvent event) {
        if(event.getEntity() instanceof Monster) {
            Player plr = event.getEntity().getKiller();
        }

    }
noble lantern
#

error + code pls

drowsy sapphire
#

isnt that correct?

noble lantern
noble lantern
#

get me that method

drowsy sapphire
#

oh true

#

ye wait

#
public void awardOrbs(Player p, Integer amount) {
        int currentamount = PlayerConfig.get().getInt("data."+p.getUniqueId().toString());
        PlayerConfig.get().set("data." + p.getUniqueId().toString(), currentamount + amount);
        PlayerConfig.save();
        int newamount = PlayerConfig.get().getInt("data."+p.getUniqueId().toString());
        for(String msg : getConfig().getStringList("messages.orb-receive")) {
            msg = msg.replaceAll("%prefix%", getConfig().getString("messages.prefix"));
            msg = msg.replaceAll("%amount%", amount.toString());
            msg = msg.replaceAll("%balance%", Integer.toString(newamount));
            p.sendMessage(ChatColor.translateAlternateColorCodes('&', msg));
        }
    }
noble lantern
#

Size for custom inventory must be a multiple of 9 between 9 and 54 slots (got 26)

#

27 not 26

#

the sized for inventories start at 1

#

not 0

#

unless your getting an item from that ivnentory, then it starts at 0

noble lantern
#

the method is fine

#

its the p thats null

#

so where its getting used your passing a null player

drowsy sapphire
#

yeah, its in SpookyOrbs

#

its getting used in the entity death

#

i just forgot to add the whole c ode

#

wait a sec

noble lantern
#

kk

drowsy sapphire
#
@EventHandler
    public void onMobKill(EntityDeathEvent event) {

        if(event.getEntity() instanceof Monster) {
            Player plr = event.getEntity().getKiller();
            Random rand = new Random();
            double chance = rand.nextDouble();
            if(chance <= SpookyOrbs.spooky.getConfig().getDouble("drops.mobs.mob-percent")) {
                int base = SpookyOrbs.spooky.getConfig().getInt("drops.mobs.mob-amount");
                double newval = base * SpookyOrbs.spooky.getConfig().getDouble("extra.multiplier");
                int win = (int) Math.round(newval);
                SpookyOrbs.spooky.awardOrbs(plr, win);
            }
        }

    }
noble lantern
#

ah ik whats happening

#

so

drowsy sapphire
#

do i have to cast player or smth

noble lantern
#

You need to null check killer because not all the time the entity gets killed by a player

#

If they die to sunlight etc

drowsy sapphire
#

OOOOH

noble lantern
#

Killer will be null

drowsy sapphire
#

so then

noble lantern
#

idk why it took my till now to realize that xD

quaint mantle
#

Yes I agree

drowsy sapphire
#

if(event.getEntity().getKiller() instanceof Player)

#

?

noble lantern
#

if plr null return

drowsy sapphire
#

oh

#

if(plr == null) return;

#

alr

#

ty

noble lantern
#

did you not read my message

noble lantern
#

i didnt reply to you

#

thats my fault

#

3 * 9 is 27

#

3 rows of 9 item slots

#

its 26 if your accessing it from an array yes

#

But the actual size starts at one

#

eg inv.getItem(27) will get IndexOutOfBoundException

but inv.getItem(26) is fine

inv.getItem(inv.getSize() - 1) returns same as the 26

#

sec

#

MoneyHash.java:178

#

show me that method thats near that line/class

#

The args your passing is empty

#

How are you sending your command in game?

#

and is args just from the onCommand method?

#

if args.length == 0

#

just remember its same thing as the inventory

#

if length is one, access it at 0

#

Should be fairly simple if your using flat file make a file for each players data

noble lantern
#

If you do Yaml

ivory sleet
noble lantern
#

Look into extending YamlConfiguration

peak gulch
noble lantern
#

make sworking with yaml a little easier if you dont like referanceing the YamlObject

ivory sleet
noble lantern
#

pretty sure that maps empty

peak gulch
# ivory sleet well send more code than that
    public static Map<UUID, Boolean> lista = new HashMap<UUID, Boolean>();
    public static BiMap<UUID,UUID> member_sprawdzany = HashBiMap.create();
    public static Player member;

    @Override
    public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
        Player p = (Player) sender;
        member = Bukkit.getPlayer(args[0]);
        if(member != null){
            if(lista.get(member.getUniqueId())) {
                if(member_sprawdzany.inverse().get(member.getUniqueId())) {

                }
            }```
noble lantern
#

Why a HashMap of UUID, UUID tho?

ivory sleet
#

and what does the error say livelove?

noble lantern
#

was asking livelore :p

#

Never seen someone do a HashMap of the 2 same objects before

peak gulch
ivory sleet
#

oh right

peak gulch
#

uhhh i know

#

sory lol

ivory sleet
#

yeah

#

make it a boolean expression

#

:p

peak gulch
#

thx for help

noble lantern
#

oh shoot i forgot HumanEntity has getName on it

#

ty!

#

ngl didnt know you can comment on code like that

(Pls dont look through the rest, i have a big refactoring day tmrw LMAO theres alot of rather questionable things once you get to the crafting section)

ivory sleet
#

yuh

#

ConfigurationSection::getKeys yields a Set<String> and invoking Set::forEach on it takes a Consumer<? super String> (not UUID) so you'd have to parse the string and convert it to a UUID

#

probably an obsolete tutorial

#
ConfigurationSection section = ...;
section.getKeys(false).forEach(key -> {
  UUID uuid;
  try {
    uuid = UUID.fromString(key);
  } catch (IllegalArgumentException e) {
    //handle if key is not a valid uuid
  }

  //TODO
});
#

well you cant just copy paste

verbal heron
#

does hasKey in 1.18 nms not work anymore?

young knoll
#

It’s probably obfuscated now

#

If you aren’t using remapped

verbal heron
#

What can i do

#

tag.getCompound("FireworksItem").hasKey("tag"), the hasKey does not work

quaint mantle
#

how to spawn a snowman without a pumpkin?

verbal heron
#

meh ill use protocollib

quaint mantle
#

me?

young knoll
#

What is your map

#

Also why do you have section = ...

stone sinew
quaint mantle
stone sinew
#

What version are you using?

quaint mantle
young knoll
#

So you copied it without understanding

#

Also key is a string, not a uuid

#

You already have a uuid

stone sinew
young knoll
#

...

#

UUID uuid

quaint mantle
young knoll
#

Have you tried it?

#

That’s because you only assign it on one path

quaint mantle
stone sinew
quaint mantle
#

entity.setInvulnerable(true);

quaint mantle
#

oh

#

sorry

young knoll
#

Make sure you declare the type as snowman

#

Or cast it

ancient plank
#

Silly goose

young knoll
#

🦆

#

Pretend it’s a goose

topaz raven
#

anyone know any efficient ways to check if a Location is inside an entity's hitbox?

stone sinew
undone axleBOT
glossy venture
#

what?

#

what do you need help with

#

what do you mean

#

at runtime or is it giving you a compiler error?

#

you mean a ClassCastException?

#

im askign him

#

to see what error its giving

#

how did you even think of writing that

#

^ this code

#

oh

#

i recommend making a helper method

#

if you are planning to add more

vale ember
#

help plz, HOW IS THAT POSSIBLE that hashmap holds EQUAL keys with different values

#

?

glossy scroll
#

Its not possible

vale ember
#

i know

#

but it somehow do

glossy scroll
#

Nope

vale ember
#

i have hasmap where itemstack is keys

glossy scroll
#

You could use guava’s multimap

vale ember
#

if i call a.equals(b) it yields true

#

but they still exist

glossy scroll
#

Stores a collection for each key

vale ember
#

together

#

if i iterate through keys and call equals it yields true

#

HOW

glossy scroll
#

?paste show me

undone axleBOT
vale ember
#

it's like 600 lines

#

you sure?

#

the "handlers" hashmap somehow stores multiple EQUAl itemstacks

#

as keys

glossy scroll
#

It definitely doesnt

#

How are you checking for that

#

?paste

undone axleBOT
glossy scroll
#

I dont want your entire class

#

The error tells yoy whats wrong

vale ember
#
  1. If i create two identical DeltaStack instances with identical handlers in join event listener, every time i rejoin, the hashmap hold duplicate
  2. Here the output of "handlers.keySet().toString()" yields two identical itemstacks
glossy scroll
#

Im not going to explain it to you

pliant tundra
#

im making a spigot plugin in kotlin
when i run my dev server, it does not load the plugin
not sure if this is causing the issue but does my pom.xml look correct?
pom: https://pastebin.com/3VmSvzqu

quaint mantle
#

any startup errors

ivory sleet
#

kotlin and maven :I

vale ember
#

help

glossy scroll
vale ember
#

[ItemStack{DIAMOND_SWORD x 1, UNSPECIFIC_META:{meta-type=UNSPECIFIC, display-name=Ruby %REDA%, lore=[Hello, World], enchants={DURABILITY=1}, ItemFlags=[HIDE_ENCHANTS], PublicBukkitValues={customstevechaos:item_id=ITEM_ID}}}, ItemStack{DIAMOND_SWORD x 1, UNSPECIFIC_META:{meta-type=UNSPECIFIC, display-name=Ruby %REDA%, lore=[Hello, World], enchants={DURABILITY=1}, ItemFlags=[HIDE_ENCHANTS], PublicBukkitValues={customstevechaos:item_id=ITEM_ID}}}]

glossy scroll
#

There’s absolutely no way a hashmap stores two identical stacks

vale ember
#

i know

#

but IT DOES

glossy scroll
#

Hashmap checks for that based on its hash

vale ember
#

they're identical

glossy scroll
#

Have you compared their hash values?

vale ember
#

but STILL they store

eternal oxide
#

values can be anything, key is ALWAYS unique

quaint mantle
#

i believe hashCode is broken on itemstacks

glossy venture
drowsy sapphire
glossy scroll
#

girl it literally tells you

vale ember
quaint mantle
#

you don't

glossy venture
#

learn how to read exception messages

vale ember
#

i need to use itemstacks as keys

quaint mantle
#

better store some key in item's pdc and use it in map

glossy venture
glossy scroll
#

It tells you

#

Whats null

#

Specifically the variable

glossy venture
#

just do a foreach and do

System.out.println(key.hashCode());
#

it might be some hash value

vale ember
#

1 second

glossy scroll
quaint mantle
#

why do you need item stacks as keys

glossy scroll
#

The error says its null

glossy venture
glossy scroll
#

Hashmap only compares hashcodes

glossy venture
#

yeah i know

glossy scroll
#

Thats how it works

glossy venture
#

so they NEED to have different hash codes

glossy scroll
#

Correct

#

There is absolutely no way the hashcodes would be equal

pallid forge
#

I have a bit of an issue. 2 different plugins are trying to set resource packs for the player. One overriding the other. Am trying modify their source code but i cant find a potential solution to it

glossy venture
vale ember
#

THEYRE IDENTICAL

#

FUCK

#

HASH CODES ARE IDENTICAL

glossy venture
#

it says that if they are not equal and do have the same hashcode 2 of them get stored

vale ember
#

[1095888003, 1095888003]

#

THEY IDENTICAL AND STILL HOLD DIFFERENT VALUES

#

WTF

glossy venture
#

and equals(...) returns true?

vale ember
#

YES

glossy venture
#

what

glossy scroll
vale ember
#

Bukkit.getConsoleSender().sendMessage(DeltaStack.handlers.keySet().stream().map(Object::hashCode).collect(Collectors.toList()).toString());

#

isn't it rigjt?

glossy scroll
#

You can just print the hashmap

#

I would do that

vale ember
#

u mean hashmap.toString()?

glossy scroll
#

yea sure

vale ember
#

{ItemStack{DIAMOND_SWORD x 1, UNSPECIFIC_META:{meta-type=UNSPECIFIC, display-name=Ruby %REDA%, lore=[Hello, World], enchants={DURABILITY=1}, ItemFlags=[HIDE_ENCHANTS], PublicBukkitValues={customstevechaos:item_id=ITEM_ID}}}=com.aregcraft.customstevechaos.util.DeltaStack$InteractionHandler@166aafa6, ItemStack{DIAMOND_SWORD x 1, UNSPECIFIC_META:{meta-type=UNSPECIFIC, display-name=Ruby %REDA%, lore=[Hello, World], enchants={DURABILITY=1}, ItemFlags=[HIDE_ENCHANTS], PublicBukkitValues={customstevechaos:item_id=ITEM_ID}}}=com.aregcraft.customstevechaos.util.DeltaStack$InteractionHandler@3a60360d}

glossy venture
#

please highlight the identical ones

glossy scroll
#

They already have different interaction handlers

#

Theyre different

vale ember
#

interaction handlers are VALUES

#

of keys

glossy scroll
#

My bad

vale ember
#

interaction handler is custom class

quaint mantle
#

bro! just use pdc

glossy venture
#

the first one doesnt have lore

vale ember
#

it have

glossy scroll
#

Hashmap uses .equals right

glossy venture
#

oh yeah

#

this formatting is weird

glossy scroll
#

Are they .equals

vale ember
#

idk?

#

yes

eternal oxide
#

Thats impossible. if hash and equals are the same

glossy scroll
#

Idk something has to be different

glossy venture
#
{

ItemStack{DIAMOND_SWORD x 1, UNSPECIFIC_META:{meta-type=UNSPECIFIC, display-name=Ruby %REDA%, lore=[Hello, World], enchants={DURABILITY=1}, ItemFlags=[HIDE_ENCHANTS], PublicBukkitValues={customstevechaos:item_id=ITEM_ID}}}=com.aregcraft.customstevechaos.util.DeltaStack$InteractionHandler@166aafa6, 

ItemStack{DIAMOND_SWORD x 1, UNSPECIFIC_META:{meta-type=UNSPECIFIC, display-name=Ruby %REDA%, lore=[Hello, World], enchants={DURABILITY=1}, ItemFlags=[HIDE_ENCHANTS], PublicBukkitValues={customstevechaos:item_id=ITEM_ID}}}=com.aregcraft.customstevechaos.util.DeltaStack$InteractionHandler@3a60360d

}
vale ember
#

its impossible but IT HAPPENS

#

im absolutely confused

#

why

glossy venture
#

there is something

#

that doesnt hash right

eternal oxide
#

Your testing is flawed if your results say you have identical keys

glossy venture
#

maybe some custom class

glossy scroll
vale ember
#

i mean i just posted how i checked it

#

what's wrong with it

#
Bukkit.getConsoleSender().sendMessage(DeltaStack.handlers.keySet().stream().map(Object::hashCode).collect(Collectors.toList()).toString());
eternal oxide
#

I'm not in teh mood or inclined to go over it. I'm just telling you its physically impossible to happen as you are claiming

vale ember
#

THEN HOW IT IS HAPPENING?

eternal oxide
#

I'm cooking dinner so too busy

#

its not happening

peak granite
#

how can i check if variable "test" if it gets divided by 5 it's divisible i'm making a killstreak broadcast so if it's the killstreak is an interval of 5 it gets broadcasted, like 5 / 5 outputs a whole number, but 5/6 doesn't

eternal oxide
#

test more

glossy scroll
tawdry scroll
#

How can i power a non redstone block like dirt AnaloguePowerable seems to work only for redstone type blocks

glossy venture
#

weird hashmap

lucid bane
#

hi.
i have to call PlayerItemHeldEvent by force, but following code didn't work,

Player p = (Player) sdr;
PlayerItemHeldEvent e = new PlayerItemHeldEvent(p, 1, 5);
        
                
Bukkit.getPluginManager().callEvent(e);

can i fix this code work?

glossy scroll
#

?xy

undone axleBOT
glossy scroll
#

How are you testing it to be called

#

?

vale ember
#

WAIT

glossy scroll
#

How are you TESTING when its called

vale ember
#

if i remove PDC from items it works well

#

WTF IS WRONG WITH PDC?

#

two identical items with identical pdc are not identical?

glossy scroll
#

@peak granite modulo

vale ember
#

what?

crimson terrace
glossy scroll
#

10 % 5 = 0

#

10 % 6 = 1

vale ember
#

i just removed the part where i assign pdc to items

#

and now it works

glossy scroll
#

10 % 7 = 2

#

Wait im sory

crimson terrace
#

3

glossy scroll
#

@peak granite I completely messed up haha

peak granite
#

forgot about modular division lol

#

barely use it

glossy scroll
#

use 5 %

crimson terrace
#

XD

glossy scroll
#

Wait

#

No

#

Frick

#

% 5

#

6 % 5 = 1

glossy scroll
#

Caused multiple items jn the hashmap

vale ember
glossy scroll
#

No they werent

#

This is basic to understand

#

?xy

undone axleBOT
vale ember
#

if they are created by same code

#

how they can be not equal

glossy scroll
#

If they are created differently

#

Tehy will not return .equals

vale ember
#

they are created with same method

glossy scroll
#

new ClassA() ≠ new ClassA()

vale ember
#

but new ClassA().equals(new ClassA())

glossy scroll
#

You cant just create a variable and expect it to be the same based on its contents

glossy scroll
#

If PDC didn’t specify a .equals

#

Then it would be false

vale ember
glossy scroll
#

Right so does that tell you?

crimson terrace
glossy scroll
#

Yea thats also true

golden turret
#

?paste

undone axleBOT
glossy scroll
#

This is not hard to understand

#

The items are not equal

glossy venture
glossy scroll
#

It’s impossible for hashmaps to store equal objects with equal hashcodes

#

And for some reason this person beleieves otherwise

golden turret
#

this sql command works fine in sqlite but dont work in mysql

CREATE TABLE IF NOT EXISTS statistic (
  id CHAR(36) PRIMARY KEY NOT NULL, 
  player CHAR(36) NOT NULL, 
  type VARCHAR(32) NOT NULL, 
  xp DOUBLE NOT NULL, 
  FOREIGN KEY (player) REFERENCES player_level(id)
);

mysql error: https://paste.md-5.net/abavumeqoc.md

vale ember
#

and what's the solution

#

if i want to use PDC

crimson terrace
#

checking for a key only you would assign has worked for me so far

#

and then check if the PDC has that key

glossy scroll
vale ember
#

public void update(@NonNull Consumer<ItemMeta> metaConsumer) {
ItemMeta meta = stack.getItemMeta();

    metaConsumer.accept(meta);

    stack.setItemMeta(meta);
}
glossy scroll
#

what is the value youre setting to the pdc?

vale ember
#

"item_id", PersistentDataType.STRING, "ITEM_ID"

glossy scroll
#

So im a little skeptical if the item meta is the same

#

It probably isnt

vale ember
#

theey are created with same method

crimson terrace
vale ember
#

not variable

crimson terrace
#

oh ok

quaint mantle
#

not sure though as i mostly use sqlite

glossy scroll
#

Have you checked the source of itemstack, itemmeta, and namespacedkey?

#

They might tell you about their behavior

golden turret
#

bruuh

#

im working with a wrong table 🤡

quaint mantle
#

oh lmao

golden turret
#

ty for making me realise

peak granite
#

if i have a yml value list like this:
Test:
Example: 1
Example2: 2

how can i set both example1 and example2 to 0 (using a loop on the test variable)

#

(i don't wanna write a line to set each Test.Value to 0, i wanna loop it bc i have more values)

drowsy sapphire
#
Caused by: java.lang.ClassCastException: class org.bukkit.craftbukkit.v1_8_R3.command.ColouredConsoleSender cannot be cast to class org.bukkit.entity.Player (org.bukkit.craftbukkit.v1_8_R3.command.ColouredConsoleSender and org.bukkit.entity.Player are in unnamed module of loader 'app')

Does this error just mean that I can't add color to a msg sent to console?

mystic sky
#

kekw

quaint mantle
#

getConfigurationSection(“test”).getKeys(false);

peak granite
#

?

quaint mantle
#

Im tired of repeating that twice today so you can search my chat history about getKeys to know what it is

peak granite
#

i already have a map

#

that's not what i was asking

quaint mantle
#

What do you mean really i think i gave you the correct answer?

pliant tundra
#

im using kotlin to make a plugin and my main class is located at
src/main/kotlin/somewhere/something/Main.kt
when the server loads my plugin it gives an error saying that the class was not found
what should i use as my main class in plugin.yml

proud basin
#

I seem to get no main manifest whenever I try to run my project without an ide

vale ember
#

what's the difference between getSlot() and getRawSlot() in inventoryclickevent?

ivory sleet
#

getSlot is local to the ClickedInventory, getRawSlot is local to the inventoryview as a whole

#

(iirc)

vale ember
#

k

plush crescent
#

What is the method to get the player's satiety level?

ivory sleet
#

?jd-s

undone axleBOT
ivory sleet
#

pretty sure you could find the method there

plush crescent
#

Thanks, I'll take a look.

Edit: I was able to find it. Thank you!

hoary pawn
#

is there anyway to add npcs without nms?

vale ember
#

afaik no

#

or you can use APIs

hoary pawn
#

well fuck

#

i could

#

good idea

#

thanks

vale ember
#

either NPC specialized or nms wrapper

hoary pawn
#

do you know a good one?

#

ahh

vale ember
#

not really

hoary pawn
#

but how can plugins do something with npcs then when it requires nms, doesnt the require a new server jar?

ivory sleet
#

wat

vale ember
#

wdym

ivory sleet
#

I mean, I know a lot of plugins which just hook into Citizens API

hoary pawn
#

doesnt it require a modifed server jar to edit nms

vale ember
#

you don't edit nms

ivory sleet
#

depends on wym with modify

vale ember
#

you just use it

visual tide
#

but why would you need to edit it

hoary pawn
#

i think i need to read a little up on nms lol

ivory sleet
#

but in principle not splyfof

#

there is intrumentation and some other stuff

#

which allows you to change classes at runtime

#

altho you need to declare an agent in that case

#

however you can still modify trivial things in nms like field values of instances

#

(which is basically reflection or unsafe)

hoary pawn
#

so if i wanted to add npcs i could do that with some stuff in a normal plugin

ivory sleet
#

basically yes

vale ember
#

yes

hoary pawn
#

ahh that is nice

vale ember
#

either with reflection or abstraction

hoary pawn
#

then its just impossible not totally impossible

ivory sleet
#

with that being said, I do suggest using citizens api to circumvent the need of direct nms

hoary pawn
#

that would be too easy

vale ember
ivory sleet
#

Hmm if its for learning purposes then Ig

ivory sleet
#

so no external dependencies with other words, though Idk if this is actually the case

hoary pawn
vale ember
#

is it meaningful to support versions below 1.14.4?

ivory sleet
#

depends

hoary pawn
#

probably depends on what its for

vale ember
#

i want to create minigame

#

brand new

ivory sleet
#

personally I just support latest, or occasionally 1.8.8 if the customer is one of those

vale ember
#

also, wtf is wrong with PDC?
if i have two identical itemstacks and they are equal
for some reason if i add same PDC to each of them
they will not be equal

ivory sleet
#

you said you didnt want to use citizens?

vale ember
#

the problem is in hashmaps, if i use two identical itemstacks as keys, they override each other, which is normal behaviour, bet when i add SAME PDC to each of them, they suddenly duplicate in hashmap

hoary pawn
vale ember
#

the code is: https://paste.md-5.net/ugajunewuf.cpp,
but the problematic part is "handlers" hashmap and methods at below which add/remove handlers, on every player join, i create new DeltaStack with identical paramteres, but on rejoin, the handler is called twice, and in hashmap, they are duplicated

#

but if i don't use pdc it works well

dry forum
#

whats the best way to "host" a website off the mc server so for example a player types /website and it sends them a link to a website with a button and when you press that button it broadcasts "test" in the chat? i havent found any tutorials for how to do something like this

vale ember
hoary pawn
vale ember
#

Then search for util classes providing npc or do it yourself

#

It's not that hard

dry forum
#

that has nothing to do with websites.. ?

quaint mantle
#

ah

#

run a website with a backend. When button is pressed, you send a request to your minecraft server

dry forum
#

yeah i know but how

peak granite
#

can a yml value be an item

ivory sleet
#

you can have a yaml node representing it

peak granite
#

scalar?

ivory sleet
#

yuh

peak granite
#

what's that

ivory sleet
#

Or well

#

basically

quaint mantle
#

you mean itemstack

ivory sleet
#

you can represent an item by mapping out all of its data

#

because the item object only lives in the jvm instance

peak granite
#

yeah itemstack

quaint mantle
#

i mean, sorry to interrupt conclure explanation but
config.set
and config.getItemStack

peak granite
#

oh, so u can do that

ivory sleet
#

yeah what manyas saying is probably what you want to do here

thorny python
#

in 1.17 or 1.18

ivory sleet
#

Probably

#

Though you need to declare the use of an agent

thorny python
#

xd

#

I am actually find difficulty in understanding this concept

#

transform & byte code manipulate

ivory sleet
#

Yeah that’s one of the more advanced topics in Java

thorny python
#

;_;

#

and many resources are outdated

#

some tricks only work in java8 age

lilac valve
#

anyone know what the version tag is supposed to be for 1.18.1 in maven for the dependency?

#

<version>1.18.1-R0.1-SNAPSHOT</version> isn't working for me when I try to build my project :/

vale ember
#

<dependency>
<groupId>org.spigotmc</groupId>
<artifactId>spigot-api</artifactId>
<version>1.18-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>

#

the official guide says

#

it shud be latest i think

lilac valve
#

right but that is 1.18, is it no different for 1.18.1?

thorny python
#

maybe you didnt add repo

vale ember
#

the NMS versions are same

lilac valve
#

ok

vale ember
#

but bukkit versions are different

lilac valve
thorny python
#

uh

vale ember
#

i don't think plugins on 1.18 won't work on 1.18.1

thorny python
#

what's the error then

lilac valve
vale ember
#

it says that both are 1_18_R1

thorny python
#

btw I am looking for someone who have knowledge about transform & byte code manipulate (modify CraftBukkit/nms class in runtime), I have been stuck in the issue for 3 days already ;_;

vale ember
#

wtf r u trying to do?

peak granite
#

how do i get slot X of player's inventory

thorny python
#

as I say, modify CraftBukkit/nms class in runtime

vale ember
#

why

thorny python
#

well, change some internal code for certain features, and reflection dont work to replace existing method

vale ember
#

is that even possible?

#

reflection is basically the way of changing classes at runtime

thorny python
#

as far as I know, is was possible in java8

peak granite
vale ember
#

in java 17, you can't modify private fields AFAIK

#

for security purposes

thorny python
#

reflection can change field value but cannot change method body

ivory sleet
#

and you can actually through reflection set a private field

thorny python
#

xd

ivory sleet
#

given that the field must not be inlined

vale ember
#

even in java 17

#

?

ivory sleet
#

yup

#

at least instance fields

thorny python
#

I managed to add new enum by reflection in java 8

ivory sleet
#

ofc ::setAccessible should be invoked first

thorny python
#

but no longer available in java 9 ;_;

quaint mantle
thorny python
#

ya that's real, I just discovered that yesterday

lavish hemlock
#

I thought reflection checked for that kind of thing

#

yeah but that's not reflection

#

that's classloading

thorny python
#

I dont have enough skill rip

lavish hemlock
#

you just need a basic understanding of ASM and JVM bytecode

#

I've only been programming for 2-3 years but I figured it out pretty quickly :p

thorny python
#

well

quaint mantle
#

bytebuddy 🙂

thorny python
#

I dont have good direction rn

#

thing always hard in start

lavish hemlock
lavish hemlock
#

It's not finished yet tho.

quaint mantle
#

in modding, yes

vale ember
#

wait wait wait wait wait Is it even possible to change method body at runtime????????????????????????????/

thorny python
#

that's cool

quaint mantle
#

in mods we have mixins though

thorny python
#

I am also do Forge & Fabric

#

so learning opengl also kill me

#

xd

lavish hemlock
#

oh yeah I have yet to learn anything in regards to OpenGL

thorny python
#

lol game of life

#

classic example in programming class :3

lavish hemlock
thorny python
#

ya true, i dont sure how to use it in plugin yet but I see the potential xd

#

sure :3

#

what's it actually

#

oh xd

#

cool

#

btw is there any way to use fabric/sponge mixin magic in spigot?

#

probably no but ya

#

just asking if there are any similar framework

grim ice
#

bro

#

thats fucking weird

quaint mantle
#

thats fucking incredible

#

do you have a second to praise the lord

grim ice
#

yall read the bible in minecraft

thorny python
#

lol

quaint mantle
grim ice
#

i never (cuz im not even Christian)

hard path
#

Just in case I'm missing something. I have a server set to hard. But after each restart it is back in easy. On spigot, maybe a day out of date. Has this bug been addressed yet?

thorny python
#

spread religion time

hard path
#

O I interrupted something lmao

lavish hemlock
quaint mantle
thorny python
quaint mantle
#

we thank the mechanics of entropy for bringing us this wonderful universe

lavish hemlock
#

"wonderful"

grim ice
#

we praise allah :D

lavish hemlock
#

funny word

hard path
#

I mean the config is set to hard. Imma double check rn. But I set it to hard before the server launched. And I keep turning it back to hard in game.

stone sinew
#

You don't have to be a specific religion to read a book. lol

grim ice
#

you do

quaint mantle
stone sinew
grim ice
#

if u read the bible as a muslim or smth that's kinda weird lmfao

lavish hemlock
vale ember
thorny python
#

create a plugin for the purpose of setting server difficulty to hard when enable then :3

lavish hemlock
#

it's mainly so you can apply complex transformers from other sources

quaint mantle
#

aha

stone sinew
grim ice
#

in fact it is

#

in islam, bible is fake

stone sinew
#

Its still a book you can read lol

grim ice
#

you can read it but not believe in it

stone sinew
grim ice
#

if you're a muslim at least

thorny python
lavish hemlock
#

yeah

#

soon™️

#

when I continue working on it eventually

thorny python
#

soon™️

grim ice
#

@lavish hemlock is there a way to run code

#

ingame

#

like

thorny python
#

possible*

lavish hemlock
#

I don't know what you mean

grim ice
#

like

lavish hemlock
#

like

quaint mantle
#

mixin support wen?

thorny python
#

I guess he want allow parsing String into code and run it in runtime

grim ice
#

/run getPlayer("2Hex").sendMessage("hi");

lavish hemlock
#

I mean, probably not with Java

#

but with JS, yeah

livid tundra
#

how do I get the bossbars that are displaying for a player?

grim ice
#

it should be possible

lavish hemlock
#

since Java has a built-in JS scripting engine

golden turret
grim ice
#

it just asks u the list of imports there are that looks relevant

lavish hemlock
#

although that is an incredibly unsafe concept

grim ice
#

like intellij does

thorny python
#

it is fairly easy actually if just parsing string to some simple code

grim ice
#

no one cares about safety

lavish hemlock
#

it's literally an RCE

thorny python
#

parsing string to tokens, map to executor to run it

grim ice
lavish hemlock
#

anyway there is actually a way to do it though

grim ice
#

like intellij does

#

I WANNA DO IT SO BAD

quaint mantle
#
# calculator in python, all of my users will be able to use it
math = input('enter math: ')
print(eval(math))
grim ice
#

but it prob isnt on my level

quaint mantle
#

totally secure

thorny python
#

just need to enum every possible code

#

:3

#

token*

lavish hemlock
#

you could wrap the code within a method + class and send it to the compiler API, dynamically load that compiled class, and execute the method

#

so yeah it's quite complicated

#

but that's the cleanest way I can think of

grim ice
#

yeah i definitely cant do that

quaint mantle
#

Maow can

grim ice
#

HMM

#

m a o w

lavish hemlock
#

name resolution would be pretty difficult though

grim ice
#

d o i t

#

it's gonna be crazy if someone did it

thorny python
#

and then let every programmer write code in minecraft

livid tundra
#

how do I get the bossbars that are displaying for a player?

grim ice
#

crazier if i learn how to do it myself

lavish hemlock
thorny python
#

: )

grim ice
#

or u can use book and quills in minecraft

#

to write code

lavish hemlock
#

also you kinda are limited by the chat size

#

oh true

#

anyway Maow will make java-eval at a later point

grim ice
#

it would be so amazing

#

ayooo

#

pog

lavish hemlock
#

he is working on sardines, compile-time serializer/deserializer generation

thorny python
#

it dont need actually to be java code

grim ice
#

do u think it's worth to try and learn how to do it

lavish hemlock
grim ice
#

i prob suck too much to be able to do it

#

but ig i can try

thorny python
#

it is doable to implement a simple script language

lavish hemlock
#

sure but

#

then it can't access the classpath

#

and then it's also just Skript

thorny python
#

made a new language then :v

lavish hemlock
#

I made a lang once

thorny python
#

create interpreter from ground

#

wtf

grim ice
#

wtf

lavish hemlock
#

:)

thorny python
#

stop been furry

lavish hemlock
#

no

thorny python
#

;_;

lavish hemlock
#

this is also just genuinely a bad language though

#

I don't even remember what this does

grim ice
#

thats cool tho

lavish hemlock
#

btw the "end program" opcode is yif, you're not welcome

grim ice
#

i prob can never learn how to do this lmao

thorny python
#

the only thing I made which close to a language probably just an arithmetical parser & calculator

livid tundra
#

how to find the bossbars that are displaying on a players screen

peak gulch
#

how to teleport the member to chosen x ,y,z

grim ice
#

player.teleport(x,y,z);

gaunt hatch
#

Has anyone got openjdk17 to install in a docker container image ?

I have tried to grab it using

RUN apt-get install -y openjdk-17-jre
RUN apt-get install -y openjdk-17-jre-headless

and both come back
E: Unable to locate package ...

grim ice
#

ngl i wanna make a plugin called 'Order Me', it be like this:
if u say **give me diamond sword ** then it gives u a diamond sword

tardy delta
#

listen for chat event

#

check the message

grim ice
#

or if u say damage me for 1 heart

#

it will damage u

tardy delta
#

scary

grim ice
#

but how am i supposed to make this efficient

quaint mantle
#

dont do it

grim ice
#

ill have to listen for every possible sentence

vale ember
#

that's fairly complex if you want to do multiple actions

grim ice
#

i will do it

#

even if i have to write tens of thousands of lines

thorny python
#

._.

grim ice
#

i have a lot of time to waste

ancient plank
thorny python
#

sound like a good opportunity to play around design pattern

vale ember
#
  • you need to consider the fact that player can say:
    "give me a diamond sword"
    "give me the diamond sword"
    "give me diamond sword"
    "give diamond sword to me"
    "give a diamond sword to me"
    "give the diamond sword to me"
grim ice
#

ill make it ignore stuff like

#

the and a

ancient plank
#

use regex maybe

grim ice
#

and replace me with the sender

thorny python
#

it is a topic about nature language parsing then

grim ice
#

it's gonna be a PAIN to do, but oh well

#

it's easy but it will take a long time

thorny python
#

:v

grim ice
#

it will simply not work

thorny python
#

bruh

ancient plank
#

thee individual over there cometh forth and speaketh thy fears

grim ice
#

lol

#

ill do 5hours everyday

#

of adding new sentences

#

after a few months maybe ill be done

vale ember
#

you probably need some sort of natural language processing tools if you want your plugin be flexiable

grim ice
#

yeah

#

i thought about this

lusty cipher
#

Well apparently Spigot servers on 1.18 also report as CraftBukkit............. shit

ancient plank
#

go the extra mile and train an AI

grim ice
#

how

peak gulch
grim ice
#

thats hard tho

#

i get 80 in math

vale ember
#

you can use Apache's OpenNLP

grim ice
#

so i guess not

#

i need to make the plugin understand

#

what the player said

ancient plank
#

welcome to making something complex

#

you actually gotta research and learn

vale ember
grim ice
#

this is gonna be pain

#

but ill prob learn a shit ton from this

peak gulch
grim ice
vale ember
peak gulch
#

method org.bukkit.entity.Entity.teleport(org.bukkit.entity.Entity,org.bukkit.event.player.PlayerTeleportEvent.TeleportCause) is not applicable (actual and formal argument lists differ in length)

grim ice
#

player.teleport(new Location(1,1,1));

peak gulch
#

thxx

grim ice
#

the hardest thing is

#

how to transfer the text into

quaint mantle
#

unit tests

grim ice
#

code

#

ill have to listen for every possible thing

#

u can do

quaint mantle
#

But damn you Just do a scripting language with very ugly syntax

grim ice
#

its not ugly

#

its the most understandable

#

literally

#

u cant get any better than pure english

#

u can make stt and get a google assistant in minecraft

quaint mantle
#

honestly even asm would be easier to work with

grim ice
#

hey minecraft give me 64 chicken

quaint mantle
#

ah

grim ice
#

lol

peak gulch
grim ice
quaint mantle
#

i see

peak gulch
#

java: no suitable constructor found for Location(int,int,int)
constructor org.bukkit.Location.Location(org.bukkit.World,double,double,double) is not applicable
(actual and formal argument lists differ in length)
constructor org.bukkit.Location.Location(org.bukkit.World,double,double,double,float,float) is not applicable
(actual and formal argument lists differ in length)

grim ice
#

oh right

thorny python
#

I dont find asm is easy for me yet xd

vale ember
#

ASM vs BrainFuck?

#

whats easier?

fervent rampart
#

Hey, is there someone who can help me with some database communication inside of a spigot coded plugin. A little struggle with a HirakiCP.
Was never here so wanted to ask how to ask questions xd

grim ice
#

player.teleport(new Location(player.getWorld(), 1, 1, 1));

quaint mantle
#

Hello how would i go about making a map expand over multiple item frames?

gaunt hatch
# unreal quartz apt update?

I have that before any install in the image but still cant find it, its very werid. Never seen it not find it before.

thorny python
#

well

grim ice
#

ngl

#

an easier thing is just

lusty cipher
#

is there any way to rollback an update on Spigot?

thorny python
#

it would be far better for me just have a much easier library ;_;

grim ice
#

checking the first words

#

and then doing the action

#

it will be very ugly

quaint mantle
#

Hello I'm trying to add/remove permissions on join, but my code isn't working. Someone know what is wrong ?

    @EventHandler
    public void onJoin(PlayerJoinEvent event) {

        // Some setup
        HashMap<UUID, PermissionAttachment> permshash = new HashMap<UUID, PermissionAttachment>();
        PermissionAttachment attachment = event.getPlayer().addAttachment(Aeris.get);
        permshash.put(event.getPlayer().getUniqueId(), attachment);
        PermissionAttachment perms = permshash.get(event.getPlayer().getUniqueId());

        disableAll(event.getPlayer());

        perms.setPermission("verus.alerts", true);
        permshash.get(event.getPlayer().getUniqueId()).unsetPermission("verus.bypass");
    }```
grim ice
#

and big

#

since ill have to check for every famous synonym

#

of the word

thorny python
#

just like mixin in fabric & sponge

#

so no touching bytecodes

gaunt hatch
peak gulch
#
location:
  x: 0
  y: 0
  z: 0``` how to do this in file using addDefault
fervent rampart
#

Problems on Database-Communication (HirakiCP)

ripe sun
#

who knows Geyser went into the hub opened the menu clicked on the server the command was executed and I was not touched

thorny python
quaint mantle
chrome beacon
ripe sun
thorny python
modern sluice
#

@severe mason

ripe sun
#

да

gaunt hatch
#

@unreal quartz I think i got it, had to update my Ubuntu version from 20.04 to 22.04 in the image. Seems it will not find it in 20.04. Safer anyway on 22.04 cause its there LTS so that should be future proof for a bit.

ripe sun
#

плагин Geyser нажимаю на npc открывается меню я выбрал в меню сервер команда выполнилась в консоли и меня не куда не тепнуло

#

если что это мобильная версия

#

подержка

desert loom
ripe sun
#

да