#help-development

1 messages · Page 137 of 1

icy beacon
#

wow lol

#

very primitive

lost matrix
#

Yes you can do a simple mapping from ConfigurationSerializable to byte[] over String

nimble hill
#

So there has got to be a better way to check if a player has permissions to build in an area instead of spamming events. Like, This is a Ability plugin, and i CAN do those spammed Block Events, i just dont know if there is like an isClaimed method or something similar that i should be using instead. Because this seems like not a good way to deal with this

#

I can either check on Every event (which does not seem like a good idea as im creating thousands of events potentially) or i can check a flag. But i dont think there is an alternative

#

Like i COULD set the nesting loop so deep that the last thing it checks is the Build Perms, but again, Seems kinda Problematic

lost matrix
nimble hill
#

But that seems like a poor implementation

lost matrix
#

Yes firing a BlockBreakEvent is the only reliable way.

nimble hill
#

Shit, i was affraid you'd say that

#

Hmm

lost matrix
#

Should not be an issue

nimble hill
#

Damn, Alright well Thanks for your input. Ill let you know if i end up doing anything else

jolly gust
#

How do I get this data from another class?
ItemStack i1 = new ItemStack(Material.DIAMOND);
i1.setAmount(16);

lost matrix
#

?learnjava

undone axleBOT
icy beacon
#

i am a bit confused on how to get all runes, surely there's no method to get all player's pdc entries?

    public List<Rune> getRunes() {
        return List.of(); // TODO Implement
    }

    public void addRune(final Rune rune) {
        safePlayer().getPersistentDataContainer().set(getRuneKey(rune), Data.runeType, rune);
    }

    public void removeRune(final Rune rune) {
        safePlayer().getPersistentDataContainer().remove(getRuneKey(rune));
    }

    public Rune getRune(final long id) {
        return getRunes().stream().filter(rune -> rune.getId() == id).findFirst().orElse(null);
    }
jolly gust
#

public ItemStack i1() {
ItemStack i1 = new ItemStack(Material.DIAMOND);
return i1;
}

I have the code above and I use it in two different classes, but I need this item to have a count of 16 in one of them and 1 in the other. How do I do this?

icy beacon
#

ItemStack has a constructor, which takes amount.

echo basalt
#

ehh debatable, you can do some things

icy beacon
#
public ItemStack getItem(int amount) { // taking amount as an argument
        ItemStack i1 = new ItemStack(Material.DIAMOND, amount); // passing it into the constructor
        return i1;
}
jolly gust
#

thx

icy beacon
#

take a look at the documentation once every while

#

better yet, every time you struggle

lost matrix
echo basalt
#

Not necessarily

#

You can, for example:

  • Create itemstacks async, and set them into inventories (opening the inventory still needs to be done in sync)
  • Do anything where the implementation is purely packet-based (send message, sendBlockDamage, sendSignData, sendBlockChange)
icy beacon
lost matrix
#

The only think you can safely do async is sending messages

echo basalt
#

There are also weird thread-safe workarounds, like ChunkSnapshots

icy beacon
#

maybe you can do all that, but if the documentation says you shouldn't, then reconsider

lost matrix
echo basalt
#

Setting items async is useful for stuff like heads, that might take some time to load

#

Specially when fetching profiles from mojang's api

lost matrix
#

Async yes. But not from a different thread.

#

Technically you can do everything async in spigot. But using a different thread is another story.

#

But even sending messages or BlockData from a different thread makes very little sense.

echo basalt
#

it's useful when you're already working on a concurrent environment

jolly gust
echo basalt
#

For example, providing the outcome of an async operation

icy beacon
echo basalt
#

sure it's highly stupid to create a new thread just to send a message, but what if you're already doing heavy multithreading? Then it's just icing on the cake

boreal seal
#

if i make armorstand invisable

#

the hitbox begin removed automatically?

swift dew
#

java: error: release version 5 not supported
wtf

#

what is that "release version"

boreal seal
#

... Vexor the stacktrace tells you the problem

#

literally the problem

#

go to help-server.

swift dew
#

its for a plugin

#

not server

#

and i dont have anything being "5"

drowsy helm
#

You sure it’s not release 50?

swift dew
#

yes

drowsy helm
#

What version are you compiling it with

echo basalt
#

mf plugin compiled in java 1 💀

swift dew
#

i cant even send images

swift dew
drowsy helm
#

You’re not verified

swift dew
#

oh

#

wait

#

btw ignore my name...

echo basalt
#

probably your build.gradle

#

or pom.xml

swift dew
#

wait

echo basalt
#

is a lil messed up

drowsy helm
#

Use a paste

#

?paste

undone axleBOT
swift dew
#

ok wait

echo basalt
#

either should solve for you

swift dew
#

ye that was it tysm

boreal seal
#

hm guys

#

setinvisable(true) < removes hitbox completly?

#

like it seems like no hitbox at all

swift dew
#

i think its just for the client

#

like it shows it like that

#

if its a zombie or sth and not marker armor stand

boreal seal
#

no no i keep marker

#

i need marker to be same size

#

hm not sure

echo basalt
#

marker has no hitbox

#

regular armorstand does

boreal seal
#

i dont use market

#

nvm wierd location of hitbox as well

#

my check didnt work

#

ill find out why tho

echo basalt
#

setMarker is such a weird api concept because markers have a different entity type id in the registry

faint frost
#

how do i set no gravity using nms?

boreal seal
#

not sure

#

why it iddnt work

#

the self even doesnt trigger

#

ill find out why

echo basalt
boreal seal
#

maybe the EntityType is diff

#

so that armorstand is no longer ArmorStand?
afterwards i set it invisable?

faint frost
#

how to you have it not obfuscated?

echo basalt
#

mappings

faint frost
#

im trying to figure out how to do that, no beans yet

echo basalt
#

maven or gradle?

faint frost
#

maven

echo basalt
#

uhhhhhhhhhh

#

rip I usually use gradle

faint frost
#

fuuuuck

faint frost
#

im having to use the mapping website and do it from there

brittle loom
#

Hello, I'm trying to find a way to shoot an arrow from a block to a targets head, the problem is that the arrow doesn't always reach the target if he is too far. I need to find a way to increase the arrows angle it is being shot at depending on the players distance although I don't really know the math for this and I was wondering if someone could help me out. Here's the code I've written which works a little but isn't very accurate because it doesn't always hit the targets head : https://pastebin.com/SFChCC9Q

echo basalt
#

so you want homing arrows type deal

#

you can just re-angle the arrow every tick to counter gravity and all

brittle loom
#

I'm doing something like that in my code, but it isn't very accurate

quasi flint
brittle loom
#

That wouldn't look realistic though

quasi flint
#

Maybe this helps

boreal seal
#

anyone have any clue how i can detect if player Interact or get in touch in anyway with invisable armorstand, things i tried PlayerArmorStandManipulateEvent,PlayerInteractEvent,EntityDamageEntityEvent

#

but none of them actually even passed thru check

#

like there no entity

faint frost
quasi flint
#

The last time I did this with a weird packet trickery, but this shouldn't be needed here. Lemme think

faint frost
#

no beans

quasi flint
#

So there may not be a way for you to find out

boreal seal
#

like

#

HD did it

#

some ohw

#

using packets

#

and they catch that packet

#

that client actually send when he click it

#

i create as well an real entity

#

and set it invisable

#

but concept is ew ew

#

xd

quasi flint
#

Well what comes to mind is absolute brain-dead, but you could get when he hits air, raytrace and see if the entity is in the way

#

And no packets there hopefully

quasi flint
faint frost
#

i feel like i imported nms wrong and im just stuck with obfuscation

quasi flint
#

Gradle > maven

#

eclipse or intellij?

faint frost
#

intellij

quasi flint
#

Ok

#

I hate maven sooo, sadly can't help

icy beacon
boreal seal
#

thats such a headache for god sake

#

ill just set marker false

#

and summon an invsibe bat as hitbox

#

bruh

icy beacon
icy beacon
#

np, maybe someone else stumbles upon this

boreal seal
#

bruh

#

it will be x2 shit

#

like disabling the AI using nms is not big deal

mellow pebble
#

Umm can someone help me ? basically i did everything correctly i added config.yml in resources and i added getConfig().options().copyDefaults(true); to my onEnable method and basically my default config is not creating

faint frost
#

you need to create the yml first

mellow pebble
faint frost
#

well yeah but also create the folder in the method as well

mellow pebble
eternal oxide
faint frost
#

but thats not deleting it

eternal oxide
#

using saveDefaultConfig() creates the folder for you

#

it will not delete an already existing config

faint frost
#

exact

eternal oxide
#

then delete it

mellow pebble
eternal oxide
#

if you reset everything to default and want to overwrite teh file you have to call saveConfig()

peak wharf
#

Hi, i have a problem... When i make this, it's open a crafting table to the player ( good ) but i can't make any craft in

faint frost
eternal oxide
peak wharf
#

So I can’t craft with a portable craft table ( in my GUI ) ?

icy beacon
#

also nice ide theme

eternal oxide
#

not unless you manually handle the recipes I believe.

mellow pebble
#

how do i get index of object from set ?

peak wharf
#

in the p.openworkbench

eternal oxide
#

true if there is no Table at teh location

peak wharf
#

perfect its working 🙂

eternal oxide
peak wharf
#

thanks

mellow pebble
eternal oxide
#

Why do you want an index?

mellow pebble
#

because i have some player names set in set and i want to put each name of player on different item in gui and i want to make it so index in set is slot in gui

#

when i say gui i mean inventory yk

icy beacon
eternal oxide
#

you only need loop over the Set

peak wharf
mellow pebble
eternal oxide
#

You don;t need an index. its irrelevant.

#

the Set is a Collection of names. Their "index" shoudl have no relation to your GUI

mellow pebble
#

list.setItem()

#

is part where i want to put slot, itemstack

hazy parrot
#

why not just have some counter

mellow pebble
#

and i need to gather slot from index of set

#

it makes sense

mellow pebble
#

but then i would need to make one rewrite kind of

eternal oxide
#

Either use a counter or completely ignore teh index as you are simply adding them to an Inventory

mellow pebble
#

i would need to save set to variable for easier usge prob

mellow pebble
#

ksksks

eternal oxide
#

You don;t need an index at all

mellow pebble
eternal oxide
#

why? You are just pushing them all to the Inventory in no order

fluid river
#

woke up

#

where are noobs

eternal oxide
#

Index makes no difference

fluid river
#

show me

fluid river
mellow pebble
#

i used old int i method

#

ifykwm

icy beacon
fluid river
#

((

icy beacon
#

кстати найс пони

#

не говорил тебе еще

fluid river
#

она должна руками шевелить

#

но у меня нет нитро

#

😭

icy beacon
#

(

boreal seal
#

ve sho

#

ruski

icy beacon
#

correct

boreal seal
#

come general 1

icy beacon
#

why so

smoky oak
#

wasnt aware we had more than one channel with that name

icy beacon
boreal seal
#

👀

boreal seal
pulsar parcel
#

I have three teams redPlayers, greenPlayers and bluePlayers (bluePlayers are yellow, but I didn't change it) and I wont set colors and prefixes. I use this code

public void setOption() { redPlayers.setColor(ChatColor.RED); greenPlayers.setColor(ChatColor.GREEN); bluePlayers.setColor(ChatColor.YELLOW); redPlayers.setOption(Team.Option.COLLISION_RULE, Team.OptionStatus.NEVER); bluePlayers.setOption(Team.Option.COLLISION_RULE, Team.OptionStatus.NEVER); greenPlayers.setOption(Team.Option.COLLISION_RULE, Team.OptionStatus.NEVER); redPlayers.setPrefix(net.md_5.bungee.api.ChatColor.translateAlternateColorCodes('&', "&f[&c&lRED&r&f]")); greenPlayers.setPrefix(net.md_5.bungee.api.ChatColor.translateAlternateColorCodes('&', "&f[&a&lGREEN&r&f]")); bluePlayers.setPrefix(net.md_5.bungee.api.ChatColor.translateAlternateColorCodes('&', "&f[&e&lYELLOW&r&f]")); }
in my team class and then I am calling this method in Command.
but after this command nothing change. Can someone help me?

eternal oxide
#

What are you expecting to change?

pulsar parcel
#

colors of nicknames

eternal oxide
#

Have you set ALL players to the same Scoreboard? and Set the team for each player?

pulsar parcel
#

yes I am registering all teams to same scoreboard and I am testing colors on me, so I am only in team

eternal oxide
#

Where are you expecting these colors to change? They show in Tab

pulsar parcel
#

yes, I am expecting it in tab

eternal oxide
#

You will have to show some code as I know team colors work just fine

pulsar parcel
eternal oxide
#

um, why do you have 6 teams?

#

a Player can only be in ONE team at a time

pulsar parcel
#

I have teams for entities and for players

#

I need to have it separate

eternal oxide
#

line 52 you create a new scoreboard every time this method is called org.bukkit.scoreboard.Scoreboard b = m.getNewScoreboard();

pulsar parcel
#

yes, but this scoreboard work fine, this isn't scoreboard in which I register teams. I register teams in class scope

eternal oxide
#

You shoudl be using the one scoreboard not creating a new one every time

#

use board you created at class instancing

pulsar parcel
#

and will it update lines?

eternal oxide
#

everytime you call update you are creating a new scoreboard and setting the player to it

#

ALL players must be on the same scoreboard. You are just creating a new board every update

pulsar parcel
#

ok, I will try it, but Idk if I will need more help

onyx fjord
#

Can I somehow make XP orb take float?

eternal oxide
#

no

onyx fjord
#

bruh why is that

eternal oxide
#

because ALL exp is an integer

onyx fjord
#

player.getExp() returns float tho?

eternal oxide
#

thats a percentage. its not a value

onyx fjord
#

ah

eternal oxide
#

int getTotalExperience()

azure hawk
#

how can i show the player that elder guardian effect when you get nearby an ocen tempel

#

is there a way to force that

smoky oak
#

give em mining fatigue then remove it

azure hawk
#

that works?

smoky oak
#

probably

#

im unsure if theres a way to do it without the fatigue effect

azure hawk
#

so like that

smoky oak
#

keep in mind to remove, give, remove, and give back the effect with the duration it had before if they already have it

#

otherwise the animation wont shot

#

show

azure hawk
#

ok

#

but wont it already get cancelt after the duration runs out

smoky oak
#

well yes

azure hawk
#

ok duh

smoky oak
#

but the issue here is that if they have that effect already

#

you need to remove it to replay the animation

#

otherwise you just change the duration

azure hawk
#

yeah not that important

#

its just a small troll jumpscare plugin for my friend

onyx fjord
#

Can i somehow get orbs spawned in xp bottle event?

eternal oxide
#

No there are no orbs

onyx fjord
#

dang

boreal seal
#

and get entities nearby

#

in loop

onyx fjord
#

so exp bottle just spawns orb amount equal to the XP?

boreal seal
#

i mean task

#

not loop

eternal oxide
#

you can disable the effect in the event and you'll still get the exp

pulsar parcel
onyx fjord
eternal oxide
#

call setShowEffect(false) and you will see

onyx fjord
#

bruh its a shame we cant make individual ones unstackable

eternal oxide
#

You shoudl be able to

onyx fjord
#

like i get it that u can change it in spigot config

#

i dunno how to

#

posts on forum also didnt help

#

btw i tried making their meta unique

eternal oxide
#

I know you can prevent all orbs from merging

onyx fjord
#

well in server config

eternal oxide
#

yes

#

cancel it if its an exp orb

#

or cancel it if its an exp orb with your meta

pulsar parcel
#

how can I update scoreboard which is in class scope?

vivid skiff
#

How can i block a player from dropping a item from his tool bar but not by dropping from the open invetory?

tall dragon
#

use the drop event check if the player has an inventory open

eternal oxide
vivid skiff
eternal oxide
#

getOpenInventory()

#

!= null

onyx fjord
vivid skiff
eternal oxide
#

ah not != null, check if its teh correct view

vivid skiff
eternal oxide
#

sysout the getType to see what it shows

#

Player#getOpenInventory().getType()

vivid skiff
eternal oxide
#

?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.

eternal oxide
#

it can't "not work"

vivid skiff
# eternal oxide it can't "not work"

this is the code, probably i done it wrong

            if (player.getOpenInventory().getType() != InventoryType.PLAYER || (player.getOpenInventory().getType() != InventoryType.CREATIVE)) {
                if (player.getOpenInventory().getType() != null) {
                    event.setCancelled(true);
                    return;
                }

                event.setCancelled(true);

                if (!event.getItemDrop().getItemStack().getItemMeta().getDisplayName().contains("4")) {```
hybrid spoke
#

does anyone have a method to reflect a direction?
like pointing with a laserpointer into a mirror?

or the maths for it?

eternal oxide
tall dragon
#

just the other way

eternal oxide
#

add a sysout in teh drop event and see what type it is when dropping from an open inventory and when dropping with no inventory open

hybrid spoke
#

well i didnt thought of just changing the angle, will try lmao

tall dragon
#

like the purple angle will be the same

#

if that make sense

hybrid spoke
#

yes it does

#

i just basically have to get the opposite angle

tall dragon
#

yea

#

you need to calculate the incoming angle and flip it

hybrid spoke
#

thanks

#

didnt thought it be that easy

tall dragon
#

yea it is a rare occurrence isnt it haha

livid dove
#

So here is a PSA to all Devs who piss around with crop modifiers in your servers. Spiggot's been borked when it comes to positive modifiers for years (X axis, ignore it being cursed lol, is the growth modifier in the spiggot.yml, y axis is the growth chance for crops in game for f = 5).

And it seems this has been a problem for ... erm... a while haha https://www.reddit.com/r/admincraft/comments/1prpkc/crop_growth_modifier/

pulsar parcel
#

I am trying to refresh scoreboard, and I am using this updatePerLine()
public void updatePerLine(Player player, String line, int scoreSlot) { if (!Bukkit.getOnlinePlayers().contains(player) || (player.getScoreboard() == null)) { return; } for (String str : player.getScoreboard().getEntries()) { if (str.contains(line) || str.equals(line)) { player.getScoreboard().resetScores(str); } } org.bukkit.scoreboard.Scoreboard score = player.getScoreboard(); score.getObjective(DisplaySlot.SIDEBAR).getScore(line).setScore(scoreSlot); }

But it don!t update my scoreboard. Here is my class: https://pastebin.com/Y7asLvWv

livid dove
vivid skiff
#

?

tender shard
vivid skiff
# tender shard KillEvent line 21

    @EventHandler
    public void onKill(PlayerDeathEvent event) {

        Player killer = event.getEntity().getKiller();

        if (killer != null) {
            EconomyResponse eco = ChaosKitPvP.getEconomy().depositPlayer(killer, 300);
            if (eco.transactionSuccess()) {
                killer.sendMessage("§8» §aHai ricevuto 300$ per aver ucciso " + event.getEntity().getPlayer().getDisplayName());
                killer.sendTitle("§a§l+1 Kill", "§7Hai ucciso " + event.getEntity().getPlayer().getDisplayName());
                killer.playSound(killer.getLocation(), Sound.ORB_PICKUP, 1, 2);
                killer.addPotionEffect(new PotionEffect(PotionEffectType.REGENERATION, 5, 4));;
            } else {
                killer.sendMessage("§ala modanna toria è esplosa. MOTIVO %s!" + eco.errorMessage);
            }
        }
     }
}```
tender shard
#

and what is line 21?

vivid skiff
#

EconomyResponse eco = ChaosKitPvP.getEconomy().depositPlayer(killer, 300);

tender shard
#

getEconomy() probably returns null

vivid skiff
#

ok

tender shard
#

did you add Vault as depend: or softdepend: in plugin.yml?

vivid skiff
#

No i didn't

#

i added it now

tender shard
#

this MIGHT fix it, try it pls

#

if it doesnt, show your getEconomy() method

vivid skiff
#

No it didn' t work either

tender shard
#

then ?paste your getEconomy method pls

vivid skiff
#

?paste

undone axleBOT
icy beacon
#

hey alex, do you have suggestions on how to improve this? e.g. I want to use ItemStack#deserialize if possible, but not sure where to get the Map<String, Object>

  public static Rune deserialize(Map<String, Object> map) {
        Object objectifiedStatistics = map.get("statistics");
        if (!(objectifiedStatistics instanceof List<?> statisticsList)) return null;
        if (statisticsList.stream().anyMatch(o -> !(o instanceof RuneStatistic))) return null;

        List<RuneStatistic> statistics = (List<RuneStatistic>) statisticsList;

        // Deserialize itemstack
        Object objectifiedHeadItem = map.get("headItem");
        if (!(objectifiedHeadItem instanceof ItemStack headItem)) return null;

        return Rune.builder()
                .statistics(statistics)
                .runeTier((int) map.get("runeTier"))
                .headItem(headItem)
                .id((long) map.get("id"))
                .build();
    }
tender shard
#

just for fun, call "setupEconomy" right before you call getEconomy()

#

if it works now, we know what the issue is

#

stupid question, but do you even have any economy plugin installed?

icy beacon
#

the setupEconomy should fail if they don't

knotty escarp
#

anyone can help me with a custom gui background ?

tender shard
undone axleBOT
#

If you have a question, please just ask it. Don't look for staff or topic experts. Don't ask to ask or ask if people are awake or available. Just ask the question to the channel straight out, and wait patiently for a reply. Make sure you use the right channel regarding the topic of your question. Create a thread in case the channel is already in use!

tender shard
icy beacon
#

sneakily copied

knotty escarp
#

I want to make a custom gui background with eclipse and i dont know if it's possible ?

tender shard
#

you mean a background for inventories and stuff?

#

This requires a texture pack

icy beacon
#

elaborate on gui background?

icy beacon
#

btw alex,, is there anything else that could be improved in my deserialize method?

knotty escarp
tender shard
icy beacon
#

.headItem(headItem)

tender shard
tender shard
icy beacon
#

😛

tender shard
#

and? still doesn't work?

vivid skiff
#

Nope

vivid cave
#

Hello, so I have a bungee cord server, and I do not want to make proxy plugin. (for reasons that I'd like you to spare me from explaining)
Instead I rather prefer add a (spigot) plugin in every server of the network.
I implemented chat system through plugin messaging. it works very well, but i feel like this system could be abused. (e.g if a player's client receives the message and manages to modify it before the event pluginmessagereceivedevent triggers, etc) + it requires a player as sender (connection) and a player as receiver (connection)
Is there a way to use the bungee api somehow from the spigot plugins? (I found https://github.com/leonardosnt/BungeeChannelApi which seems good enough for what I want to do, but i guess it uses the same exploitable plugin messaging than what i'm already doing anyway ?)

tender shard
#

okay, then add debug messages to setupEconomy().

E.g. currently you do stuff like
if(rsp == null) {
return null;

In this case, make it print out "rsp is null" and stuff like that

#

so you know where exactly it fails

#

add a System.out.println before EVERY return statement

quaint mantle
#

Question how do i link servers like hypixel? Like add multiple servers sending info?

tender shard
#

Bungeecord / Waterfall

#

or, the new shit: Velocity

tender shard
azure hawk
#

ik learnjava but why is that null. i legit forgot how that works like tf

icy beacon
#
ConfigurationSection section = (ConfigurationSection) map.get("headItem");
        Map<String, Object> deserializable = asMap(section);
        ItemStack headItem = ItemStack.deserialize(deserializable);

is this good? yaml syntax:

runes:
  '1663497318719':
    # we are working here
    headItem:
      # itemstack shit
quaint mantle
icy beacon
tender shard
tender shard
quaint mantle
azure hawk
tender shard
icy beacon
tender shard
icy beacon
#

^

quaint mantle
#

Thank you!

tender shard
#

np

#

sorry for this answer but yeah, it's just not possible

#

hypixel made all their own plugins in mind with bungee support

prisma leaf
#

how to get the 1.8.8R3

icy beacon
#

buildtoosl

tender shard
#

you build it yourself using buildtools

#

?bt

undone axleBOT
quaint mantle
#

I kinda knew, that basically we need velocity and code all our plugins by ourself

icy beacon
#

my answers are getting sniped by alex xD

#

good job though

tender shard
icy beacon
#

but you were more accurate

tender shard
#

I just said the same thing lol

icy beacon
#

😛

quaint mantle
#

Question on a subject, we are removing all the plugins and we are making it custom, is it possible to take a data of a public plugin example an economy and introduce it into our own plugin. In order to remove the free plugin?

tender shard
#

@prisma leaf no friend requests pls, and no DMs pls

#

you can ask here

#

friend requests are only allowed from "friends", hence the name 😛

serene sigil
#

hi, i coded it so you cant pick up the dragon egg with your cursor, only with hotkeys, but if i hotkey the item in a chest or any container i can pick it up...

#

how do i fix that?

eternal oxide
tender shard
quaint mantle
vivid cave
# tender shard exploitable? How are plugin messages "exploitable"?

oh maybe i didn't understand how the system works then.
For me it was this, tell me if i'm wrong:
PluginA takes player1, as the sender.
PluginA sends a plugin-message from player1 on channel69.
player2 (from ServerB, PluginB) receives the message. At this point I suppose that if player2 had a client that modifies the message they receive/pretend they received a different message.
player2 informs PluginB that they received a message.
PluginB triggers the onPluginMessageReceived with the message that player2 gave.

tender shard
#

if you ask "is it okay to "steal" other plugin's code", then generally, yes, if it's only a tiny amount of lines

#

even if they prohibit it, it's totally legal if it's "nothing special"

icy beacon
eternal oxide
#

If its just data in SQL, then thats fine

quaint mantle
tender shard
quaint mantle
#

I want to create a custom made plugin and take their existing data and import it into my own plugin. So they wont lose their progress

#

If it makes sense

prisma leaf
#

But I only get version 1.8.8 normally @tender shard

vivid skiff
tender shard
serene sigil
#

ok

tender shard
tender shard
#

there is no 1.8.8R3

icy beacon
prisma leaf
icy beacon
#

????????

#

yeah no problem happy to help

tender shard
#

1.8 people ¯_(ツ)_/¯

icy beacon
#

literally me

#

xD

undone axleBOT
tender shard
#

I also gotta remind everyone of this! ^^^

eternal oxide
#

Or we can;t be bothered to answer 😉

icy beacon
#

yup

#

YUP

tender shard
serene sigil
#

@tender shard

tender shard
pulsar parcel
#

I am using this method to update lines in scoreboard and its updating, but its adding one line and its not deleting old one like on pictiure. Does anyone now why is this happend?

UpdatePerLine():
public void updatePerLine(Player player, String line, int scoreSlot) { if (!Bukkit.getOnlinePlayers().contains(player) || (player.getScoreboard() == null)) { return; } for (String str : player.getScoreboard().getEntries()) { if (str.contains(line) || str.equals(line)) { player.getScoreboard().resetScores(str); } } org.bukkit.scoreboard.Scoreboard score = player.getScoreboard(); score.getObjective(DisplaySlot.SIDEBAR).getScore(line).setScore(scoreSlot); }

tender shard
#

just get rid of that check

serene sigil
#

oh

#

🤦‍♂️

tender shard
#

😄

#

just remove the getType().equals(...) thing

#

btw you normally use == to compare enums anyway 🙂

#

.equals() on enums doesnt make any sense

#

but it also doesnt hurt

serene sigil
#

alr

serene sigil
tender shard
#

show your current code again pls

prisma leaf
#

the BuildTools bring with nothing only get the 1.8.8-R0.1

azure hawk
#

@tender shard du you know if you can force that elder guardian that pops up and jumpscares you everytime you come near an ocean tempel?

icy beacon
tender shard
azure hawk
#

ok

icy beacon
tender shard
prisma leaf
icy beacon
#

bro

#

it does not exist

#

listen again

#

it

#

is

tender shard
icy beacon
#

not

#

a

#

thing

azure hawk
#

i think you cant force that

#

ive looked it up

prisma leaf
azure hawk
tender shard
#

there is a bukkit version "1.8.8-R0.1-SNAPSHOT" and an NMS version "1_8_R3" and both are provided by doin g BuildTools.jar --rev 1.8.8

tender shard
icy beacon
azure hawk
serene sigil
azure hawk
#

is there any way to jumpscare a player then

icy beacon
azure hawk
#

i have this so far

azure hawk
tender shard
icy beacon
eternal oxide
#

Put a pumpkin on their head for a second and play a sound?

tender shard
icy beacon
#

^

tender shard
#

Totem animation ^

serene sigil
#

lol

icy beacon
tender shard
#

but this would play it for everyone

#

not just for that player

icy beacon
#

i actually never saw a totem animation from another player's view

azure hawk
#

well that scared me xd

hazy parrot
#

What is even totem animation

quaint mantle
#

Does anyone know any plugins, to disable fly when leaving the worldguard region?

hazy parrot
#

Wg can do that iirc?

#

Or wg region, not sure if its same thing

dire marsh
#

wow

#

ok mc wiki

quaint mantle
#

worldguard wont disable fly

dire marsh
icy beacon
#

?paste

undone axleBOT
quaint mantle
#

it wont allow you to do /fly

hazy parrot
#

Check region flags

quaint mantle
#

i need to find another plugin to do that

serene sigil
# tender shard yeah as said, this is not the problem. Please add debug statements after every i...

alright, i think ima go for a different approach.. so ive added this disable right/left click thing because if you would get a dragon egg in your inventory, you would gain +100 levels and if you would drop it, you would loose those 100 levels, but there was a bug where you would right click the egg when its in your inventory very fast and it would cause level duplication... so i need to fix that and found no good solution.

icy beacon
tender shard
tender shard
icy beacon
#

sure take your time

#

oh i know who you talking about lol

eternal oxide
serene sigil
#

?

eternal oxide
#

soryr wrong ping

serene sigil
#

lol

prisma leaf
#

hoe to get the NMS Version: 1_8_R3

eternal oxide
#

private static final String NMS_VERSION = Bukkit.getServer().getClass().getPackage().getName().substring(23);

tender shard
#

you run buildtools --rev 1.8.8

eternal oxide
#

unless he wants teh actual string ^

prisma leaf
#

yes BuildTools get only 1.8.8-R0.1

#

and not R3

serene sigil
#

also a quick side-question: how do check if a dropped item is a dragonegg?

shrewd sphinx
serene sigil
#

basically, i need to detect if there is a dragon eff item dropped in the world...

public void sus() {
        World world = null;
        for (Entity entity : world.getEntities()) {
            if (entity.getType() == EntityType.DROPPED_ITEM) {
                System.out.println("THERE IS AN ITEM OMG!!!!!!!!");
            }
        }
    }

#

idrk if i did it right tho

shrewd sphinx
#

org.bukkit.event.player.PlayerDropItemEvent

prisma leaf
serene sigil
#

-_-

#

how do i initialize the world tho?

#

i want all dimensions basically

#

kk

#

gets all worlds?

#

kk

eternal oxide
#

Pretty sure teh dragon egg is a block not an entity

noble forge
#

it is a tile entity

#

in other words basically both lmao

eternal oxide
#

ah ok

serene sigil
noble forge
#

it is an entity that behaves as a block

eternal night
shrewd sphinx
#

what

noble forge
#

same with the chest

icy beacon
noble forge
#

o you were referring to the dropped item

shrewd sphinx
#

do droppers behave as blocks?

serene sigil
#

it doesnt work tho since i compare world with entity....

eternal night
#

the dragon egg block also is not a tile entity/block entity

eternal oxide
serene sigil
#

and then

shrewd sphinx
#
public void getAllDroppedItemsOnGround(World wrld) {
        wrld.getEntities().stream().filter(entity -> entity instanceof Item).forEach(entity -> {
            Item item = (Item) entity;
            if (item.getItemStack().getType() == Material.DRAGON_EGG) {
                //do something
            }
        });
    }```
#

thats how i'd do it

serene sigil
#

i think ill go with this

#

this in enable?

icy beacon
# eternal oxide ^

Well, yeah, RuneStatistic exists in my cnofig, but how is that related? I am not trying to deserialize it or even use it

eternal oxide
#

?paste your config

undone axleBOT
serene sigil
#

would this work?

public class EggTrackerFunction {

    ItemStack egg = new ItemStack(Material.DRAGON_EGG);

    public Location playerHoldingEgg;
    public Location itemDropped;
    public Location itemStored;

    public void getAllDroppedItemsOnGround(World wrld) {
        wrld.getEntities().stream().filter(entity -> entity instanceof Item).forEach(entity -> {
            Item item = (Item) entity;
            if (item.getItemStack().getType() == Material.DRAGON_EGG) {
                System.out.println("YOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO AFTER 128912849819248 HOURS!!!!!!!");
            }
        });
    }
    @EventHandler
    public void ifplayerdroppssoapO_O(PlayerDropItemEvent event) {
        Bukkit.getWorlds().forEach(this::getAllDroppedItemsOnGround);
    }


}
undone axleBOT
serene sigil
eternal oxide
#

Why check every world and every item to see if its a dragon egg?

#

You are checking in teh drop item event, so why not just check that item?

serene sigil
#

there are just too many...

#

like playerdropevent, dispenserevent, etc

eternal oxide
#

What exactly are you trying to do with this dragon egg?

serene sigil
#

i wanted to make a dragon egg tracking device (compass) that points to the dragon egg even if its a block/item/player who has it

eternal oxide
#

oh my, that is going ot be hard

serene sigil
#

its kina hard but its a challenge i want to do lol

river oracle
#

Yea that is not easy

serene sigil
#

yep...

eternal oxide
#

it could be in a chest in a chunk thats not loaded

serene sigil
#

thats the reason i joined the spigot dc

eternal oxide
#

You are not going to be able to check every chest

river oracle
#

It'd be nearly impossible to keep tracking on it tbh in its current state as you don't know where it is

serene sigil
#

maybe save the loc of the chest when a player puts it in?

river oracle
eternal oxide
#

if you track it from its first creation it should be possible

#

but there are LOTS of things you will have to monitor

serene sigil
#

yes exactly

eternal oxide
#

Droppers, Hoppers, Players moving items, pistons

serene sigil
#

true

river oracle
serene sigil
#

i think ill need to work with events

eternal oxide
#

Searchign every world for items is not the way to go though

river oracle
#

Pff ofc bukkit is event based

serene sigil
eternal oxide
#

eg, Egg spawns, player breaks with a piston, picks it up, puts in chest. hopper pulls it from a chest into a dispenser, into another chest. you have to monitor all events

#

Player dies and another plugin like angelchest puts it in a chest.

#

trackign is going to be near impossible

serene sigil
kind hatch
#

You're kinda screwed at that point.

vivid skiff
#

How can i block a player from dropping items from his hotbar

#

?

kind hatch
river oracle
#

Check the slots

serene sigil
#

if he drops it from his hotbar

vivid skiff
serene sigil
#

THE DRAGON EGG TRACKER CHALLENGE

serene sigil
rose goblet
#

Could someone help me to get the 1.8.8 r03

tardy delta
#

isnt there a CompassMeta#setTarget(Location) or whatever?

#

@serene sigil

serene sigil
#

i think ye

tardy delta
#

ah Player#setCompassTarget ig

serene sigil
#

finally im verified

#

😛

#

i gtg for a bit

ember estuary
#

@quaint mantle Did this answer your question? Or did I understand it wrong?

tardy delta
#

:/

#

catch (Exception)

eternal oxide
#

You have been told a few times how to get 1.8.8 and what the R3 means

kindred valley
#

does evey minecraft item have ItemMeta?

tardy delta
#

not air and some other stuff

#

meh should optimize my parser, 2+((1+1)) parses 1+1 twice :/

icy beacon
ember estuary
#

ah i see, yea looks good

#

Does anyone know in what case PlayerMoveEvent#getTo() returns null?
cuz it's marked as @smoky tinsel

#

maybe when the player first joins?

icy beacon
#

well why would playermoveevent be called on join

#

teleport event - maybe

ember estuary
#

idk, was just a guess

#

isnt it called like every tick anyway

icy beacon
#

well it's checked every tick if you mean that

#

yead

#

yeah

ember estuary
#

and if not, every second?

icy beacon
#

why would it be called

ember estuary
#

if he isnt moving

icy beacon
#

if no movement is done

#

the event is called playermoveevent

#

not playertickeverysecondevent

ember estuary
#

to tell the server hes still there idk xD

icy beacon
#

uhm

ember estuary
#

okok

#

i thought it gets sent even if u dont move

#

ok i see

icy beacon
#

thats just a per tick runnable with extra steps then

#

if it's a playerMOVEevent, it's called when a player MOVES

#

including their camera

kindred valley
#

does reloading server decreases the performance and causes crashes do you think?

icy beacon
#

yes

eternal oxide
#

It also sends it for mouse movement

icy beacon
#

many plugins don't handle reloading and will break

eternal oxide
#

a picture

tardy delta
#

cant even see the whole method

#

thats all i see lol

#

where does R come from

undone axleBOT
eternal oxide
#

Its when he instantiates the class

#

yep

tardy delta
#

mye

#

that code looks better than my stuff lol and i thought you were a noob

ember estuary
#

I am making a minigame-server with bungeecord:
How is restarting the sub-servers on the end of the game and resetting their map usually handeled?

eternal oxide
#

or docker

ember estuary
#

so the game-server tells bungeecord when the game finished?

#

like how does it do that

#

idk how to implement it

tardy delta
#

gonna learn docker in school next week lol

ember estuary
#

u learn that in school? o.O
I learned it in university xD

tardy delta
#

college

ember estuary
#

Ok ty, i'll look into it

tardy delta
#

last day holiday today smh

charred blaze
#

How can I check if config contains key? In bungeecord.

ember estuary
#

So to restart the server, i gotta make a plugin for bungeecord which just does the map stuff and calls the bat file?

ember estuary
#

is that right? cuz ive seen that there's a plugin folder in my proxy folder

#

never made a bungeecord plugin before but would be good to know if thats the way

#

okok

#

so thats how people usually do it right? (if not using docker) :

#

send a message to bungeecord, which then calls a function in a bungeecord plugin, which you make yourself

#

which then resets the world and calls the sub servers bat file

boreal seal
#

NBTEditor import?

smoky anchor
#

Hello ppl.
Any way to change blocks piston move reaction?
Would be nice if it could be changed based on location.

boreal seal
#

nvm

boreal seal
#

change reaction?

#

u can cancel the event in general

fresh timber
#

How do I get the command the player used in a PlayerCommandSendEvent?

boreal seal
#

and cancel depending on biome and etc

boreal seal
#

what is that event

#

use AsyncChatEvent instead

#

and check if player used / before

fresh timber
#

hm ok

smoky anchor
eternal night
#

obsidian not being pushable is hardcoded into the server

echo basalt
#

you can probably do some fancy injection to get around that

eternal night
#
public static boolean isPushable(BlockState state, Level world, BlockPos pos, Direction direction, boolean canBreak, Direction pistonDir) {
    if (pos.getY() >= world.getMinBuildHeight() && pos.getY() <= world.getMaxBuildHeight() - 1 && world.getWorldBorder().isWithinBounds(pos)) {
        if (state.isAir()) {
            return true;
        } else if (!state.is(Blocks.OBSIDIAN) && !state.is(Blocks.CRYING_OBSIDIAN) && !state.is(Blocks.RESPAWN_ANCHOR) && !state.is(Blocks.REINFORCED_DEEPSLATE)) {
#

gonna be rough

echo basalt
#

just inject into all the code that calls it

smoky anchor
#

So I take it that there is no API way of changing the response.

echo basalt
#

what class is that at

eternal night
#

java/net/minecraft/world/level/block/piston/PistonBaseBlock.java

smoky anchor
eternal night
#

welcome to mojang code lol

#

they have a different system in place yea

echo basalt
#

okay... this won't be so hard

eternal night
#

but like

smoky anchor
#

But BlockBehaviour has getPistonPushReaction
Why not use that
wtf

eternal night
#

¯_(ツ)_/¯

echo basalt
#

Yeah this doesn't seem that hard

#

sure the registry is frozen but you can just unfreeze it with reflections, modify it and refreeze

#

maybe like 150 lines

smoky anchor
#

Oh yeah I do not want to do that.
I can but don't want to.
I'll just... not do this.

eternal night
#

how would unfreezing the registry help here

echo basalt
#

PistonStructureResolver also calls that canPush method but it is initialized on the PistonBaseBlock class exclusively so you can just make a wrapper and not worry much

echo basalt
eternal night
#

yea

echo basalt
#

So you make your custom class that extends PistonBaseBlock

eternal night
shrewd sphinx
echo basalt
#

override the methods to handle your changes

ember estuary
#

I want to run code in onEnable() that could take a while to run (copying a big map, to use as server map - effectively resetting the map)
Can players only join after this code finished / onEnable returned? Or do i have to somehow block player joining?

echo basalt
#

and then change the registry to use your custom piston object instead of the nms one

eternal night
#

Yeah this doesn't seem that hard

#

you have a wild scale of what is hard to implement lol

echo basalt
eternal night
#

seems rather doable

echo basalt
#

All the collision code was scattered around multiple classes and did fancy bitmasking

smoky anchor
echo basalt
#

I also had to inject into navigation so mobs couldn't track players through client-sided blocks

#

I think it was about 1.2k lines of nms in total

eternal night
#

sounds enjoyable tho like

#

I would still not call it "not too hard"

#

maybe you are just good 5Head

echo basalt
undone axleBOT
echo basalt
#

show us your worlf impl

eternal night
#

I mean yea your issue is just clazz.getDeclaredConstructor().newInstance(true);

echo basalt
#

oh yeah

#

you pass the params on the getDeclaredConstructor

#

so
class.getDeclaredConstructor(boolean.class).newInstance(true);

#

you can't really enforce parameter specifics for newInstance because you never know how many there are

#

your IDE could've warned you

steady rivet
#

I am trying to make it so that when you merge two of these crystals it deletes the original two and gives you a new one of the new merged value but when I delete them from the players inventory it places the cursor item back in the players inventory. I am not sure how to fix this. Any ideas?

Code:

@EventHandler
    public void InventoryClick(InventoryClickEvent e)
    {
        Player player = plugin.getServer().getPlayer(e.getWhoClicked().getUniqueId());
        if (player == null)
        {
            plugin.logger.Error("InventoryClick - Player is null!");
            return;
        }

        ItemStack heldItem = e.getCursor();
        ItemStack clickedItem = e.getCurrentItem();

        // Check if both Held Item & Clicked Item are both valid
        if (heldItem != null && clickedItem != null)
        {
            ItemMeta heldMeta = heldItem.getItemMeta();
            ItemMeta clickedMeta = clickedItem.getItemMeta();
            if (heldMeta != null && clickedMeta != null)
            {
                // Check if both are nether stars
                if (heldItem.getType().equals(Material.NETHER_STAR) && clickedItem.getType().equals(Material.NETHER_STAR))
                {
                    NamespacedKey rarityKey = new NamespacedKey(plugin, "Rarity");
                    PersistentDataContainer heldPDC = heldMeta.getPersistentDataContainer();
                    PersistentDataContainer clickedPDC = clickedMeta.getPersistentDataContainer();
                    // Check if both stars have the NBT Tag Rarity (the rarity NBT Tag is how we determine a nether star is an actual crystal)
                    if (heldPDC.has(rarityKey, PersistentDataType.STRING) && clickedPDC.has(rarityKey, PersistentDataType.STRING))
                    {
                        CrystalRarity heldRarity = CrystalRarity.valueOf(heldPDC.get(rarityKey, PersistentDataType.STRING));
                        CrystalRarity clickedRarity = CrystalRarity.valueOf(clickedPDC.get(rarityKey, PersistentDataType.STRING));
                        // Check to see if both crystals match rarities
                        if (heldRarity.equals(clickedRarity))
                        {
                            NamespacedKey chanceKey = new NamespacedKey(plugin, "Chance");
                            Integer heldChance = heldPDC.get(chanceKey, PersistentDataType.INTEGER);
                            Integer clickedChance = clickedPDC.get(chanceKey, PersistentDataType.INTEGER);
                            // Confirm both Crystals Chances aren't broken
                            if (heldChance != null && clickedChance != null)
                            {
                                plugin.enchantManager.MergeCrystalValues(player, heldRarity, heldChance, clickedChance);
                                //player.getInventory().remove(heldItem);
                                //player.getInventory().remove(clickedItem);
                                heldItem.setType(Material.AIR);
                                clickedItem.setType(Material.AIR);
                            }
                        }
                    }
                }
            }
        }
    }
steady rivet
weak bear
#

Hello I have a problem the event that I do with onJoin dont work

#
    public void onJoin(PlayerJoinEvent e){
        e.setJoinMessage("Test");
    }````
#

The event dont work

boreal seal
#

summon an entity as a passenger

#

of other entity

#

would require me to first summon the entity

#

and then set it as pessenger

weak bear
#

What did you mean with registered it?

boreal seal
#

and maybe try system.Println.out("joinevent")

#

to see if it even works

#

learn java first

#

please.

#

?1.8

undone axleBOT
knotty meteor
boreal seal
#

?java

tardy delta
boreal seal
#

im curious

knotty meteor
#

1.12.2 its a harry potter broom hahaha

boreal seal
#

to be sharper

#

in some cases

knotty meteor
#

but still soms issues with turning

boreal seal
#

or force it turn slow.

knotty meteor
#

Aah thanks i will try that

boreal seal
#

less player control

#

player should be able to control it but not fully

#

like it will rotate slowly

weak bear
tardy delta
#

onEnable

boreal seal
#

Specter

#

?services

undone axleBOT
weak bear
#

Ok thx

iron glade
steady rivet
#

lmfao

smoky oak
#

theres this thing called methods

tardy delta
#

early returns lol

boreal seal
#

C# syntax is very simillar to java

#

so ;l

hushed spindle
#

i believe i have found a spigot bug if anyone can confirm, this does not occur on forks of spigot such as purpur or paper
Inventory#ContainsAtLeast() does not work seemingly at all for items with specific metas

with the following test code

boolean has = inventory.containsAtLeast(i, i.getAmount());
if (!has){
    for (ItemStack item : inventory.getContents()){
        if (Utils.isItemEmptyOrNull(item)) continue;
        if (i.getType() != item.getType()) continue;
        if (!Utils.getItemName(item).equals(Utils.getItemName(i))) continue;
        System.out.println("ingredient \n" + i + "\ninventory item:\n" + item);
    }
}

so containsAtLeast returns false even though the required item and the item in the inventory are exactly the same

https://paste.md-5.net/yojovunana.bash

#

i also dont think this occurs on older versions of spigot, this issue wasn't there in 1.18

tardy delta
#

why dont check for material instead?

#

inv api kinda sucks but ye

hushed spindle
#

because these item metas need to match

#

checking on material alone will return true even if the item isn't the same as the one required

tardy delta
#

check ItemStack#isSimilar then ig

boreal seal
#

i want to summon an entity that will have pessenger

#

i can summon them both together

#

or its not really possible

#

i should summon and set it to pessenger afterwards

hushed spindle
#

summon two entities and set one of them as the vehicle for the other

hushed spindle
#

or is there something about this method im missing

tardy delta
#

its not supposed to check for meta ig

hushed spindle
#

it definitely should

#

again this works fine on paper and purpur

floral drum
#

hiii fourteen ❤️

hushed spindle
#

and probably on older versions though i havent double checked this

tardy delta
#

hello

hushed spindle
#

i also forgot to mention that Inventory#removeItem() similarly doesn't work

eternal oxide
#

?stash

undone axleBOT
shrewd sphinx
#

bro why does currentTimeMillis return date correctly but not the time 😢

dull whale
#

I want to teleport player to where they'd if they entered a nether portal at their location

#

how?

dull whale
# vast raven wdym

I want to simulate player entering portal without there being a portal

#

nether

ember estuary
#

I want to call my constructor like this:
new CountDown(10, () -> { ... }, () -> { ... }).start(); (first function has to return bool, second void. both take no arguments)

How can i do this? How can i make it take two anonymous functions of a specific return type?

ember estuary
#

ah that simple? nice

vast raven
vast raven
#

That updates maybe with a timerTask or just when a player calls some events

shrewd sphinx
#

@tender shard hey bigbrain man pls enlighten me on how you'd go around generating current date on YY:MM:DD HH:MM:SS

#

yes but like what would you go around using

#

calendar?

kind hatch
#

SimpleDateFormat?

vast raven
tender shard
#

and stop calling me "bigbrain man"

shrewd sphinx
#

ok smallbrain man it is then

vast raven
vast raven
tender shard
dusk flicker
#

t

tender shard
#

t

vast raven
#

t

kind hatch
#

t

jolly gust
#

t

dusk flicker
#

oh god what have I started

tardy delta
#

t

#

tf

icy beacon
#

t
there i am asking for help with serialization once again
am i doing it right? i cannot test it rn so just thought i'd give it for a look

  @NotNull
    @Override
    public Map<String, Object> serialize() {
        Map<String, Object> map = new HashMap<>();

        for (RuneStatistic statistic : statistics) {
            map.put("statistics." + statistic.getId(), statistic);
        }

        map.put("rune", "rune");
        map.put("runeTier", runeTier);
        map.put("headItem", headItem);
        map.put("id", id);

        return map;
    }

    public static Rune deserialize(Map<String, Object> map) {
        ConfigurationSection statisticsSection = (ConfigurationSection) map.get("statistics");
        List<RuneStatistic> statistics = new ArrayList<>();
        for (String key : statisticsSection.getKeys(false)) {
            statistics.add(RuneStatistic.deserialize(statisticsSection.getConfigurationSection(key).getValues(false)));
        }

        ConfigurationSection section = (ConfigurationSection) map.get("headItem");
        Map<String, Object> deserializable = asMap(section);
        ItemStack headItem = ItemStack.deserialize(deserializable);

        return Rune.builder()
                .statistics(statistics)
                .runeTier((int) map.get("runeTier"))
                .headItem(headItem)
                .id((long) map.get("id"))
                .build();
    }
shrewd sphinx
#

can you apply .sethoverevent to only a part of some text?

tardy delta
#

use componentbuilder

ashen quest
ember estuary
#

why the heck can void not be converted to Void, but int to Integer aint a problem?

upper vale
#

why would a function be void though

ember estuary
#

what do i do instead of Function<Void, Void>

#

cuz it doesnt return anything?

#

what else would it be if it doesnt return anything?

upper vale
#

you should use consumer

#

wait if they’re both void then wouldn’t it just be a runnable

ember estuary
#

ah so i can just use runnable?

#

and if it takes an input but returns void its consumer

#

and else its function?

#

three different classes for basically the same thing?

upper vale
#

well if you don’t need to supply an argument and it also returns nothing, it’s a runnable

#

If you’re supplying a value but no return, consumer

#

if you need to supply a value and also get return, function

ember estuary
#

i see

#

so three classes for the same thing, java being weird

upper vale
#

and if it’s only returning it’s a supplier

ember estuary
#

couldve just made Function<> usable for all three cases and boom, other two arent needed

#

i see

upper vale
#

Kekw

#

java moment

high pewter
#

How do yous set your IntelliJ IDEA run configuration for testing plugins? I was hoping I'd be able to use Maven properties like this so that the configuration would work for all my plugins without having to configure the filename/location but it doesn't seem to

ember estuary
#

four classes for the same thing

#

xD

#

damn xD

#

but good to know, thank you!

#

now i can implement it right :D

tiny root
#

Nicu!

#

Not sure if this is the correct place to ask but I have a bit of a weird request. I'm in need of a plugin or datapack that unpatches the baby piglin dupe from 1.16.1 for a 1.19.2 paper server. I'm honestly hoping to find someone who can do it for free since it's only for a temporary server with some friends from anarchy, but I know that paper can be a pain so it's up for discussion. Is there anyone here that can help me out?

vital sandal
high pewter
#

I can? And what would that something be?

tender shard
vital sandal
#

<configuration>
<createDependencyReducedPom>false</createDependencyReducedPom>
<outputFile>YourFolder/plugin.jar</outputFile>
</configuration>

high pewter
#

Oh, I didn't know that! Though, I feel like the pom should be effective for everyone that uses it, especially since I make all my plugins open-source, so having a hard-coded output location seems bad in that sense

tender shard
#

google "maven profiles"

high pewter
#

Like, I don't want to be including the path to my testing server in all commits I make to GitHub 😅

#

I'll have a look, thank you!

tender shard
#

np!

#

profiles are basically "additional configs" that only run when you do -p myProfile

vital sandal
echo basalt
vital sandal
#

i trusted it one and uploaded my file for back up

tender shard
#

yeah, if both are void, you use a Runnable. If only 1 thing is void, you use a Consumer

vital sandal
#

and it some how delete most of classes

echo basalt
#

it be like

tender shard
#

Runnable: No input, no output
Consumer: 1 input, no output
Function: 1... input, 1 output

echo basalt
#

(one, two, three) -> return four
translates to

public <Type of <four> (can be void)> doesntMatter(one, two, three) {
  ...
}
high pewter
#

There's also a Supplier for no input, 1 output

tender shard
#

sure

echo basalt
high pewter
#

There's a lot 😂

#

Then I think Guava has TriFunctions and TriConsumers

echo basalt
#

Predicate: 1 input, returns boolean
BiPredicate: 2 inputs, return boolean

#

And a few mor

high pewter
#

lmao

tender shard
#

yeah

tender shard
#

but why do you seralize the "rune" thing?

#

if you always set it to "rune", you might as well not save it

ember estuary
#
if (seconds > 2) player.sendMessage(ChatColor.GOLD + "Starting in " + startCountdown + " ...");
else if (seconds == 2) player.sendMessage(ChatColor.YELLOW + "Starting in " + startCountdown + " ...");
else if (seconds == 1) player.sendMessage(ChatColor.RED + "Starting in " + startCountdown + " ...");

is there a more compact way to do this?

besides

player.sendMessage((seconds > 2 ? ChatColor.GOLD : seconds == 2 ? ChatColor.YELLOW : ChatColor.RED) + "Starting in " + startCountdown + " ...");

cuz a triple ternary is kinda ugly and unreadable?

In JS one could just do it like

player.sendMessage([ChatColor.RED, ChatColor.YELLOW, ChatColor.GOLD][Math.min(seconds-1, 2)] + "Starting in " + startCountdown + " ...");
tender shard
#

I'd do it like this:

#
ChatColor color = ChatColor.GREEN;
if(secondsRemaining == 1) color = ChatColor.YELLOW;
// ...
player.sendMessage(color + "remaining text");
ember estuary
#

true, thats better

#

but not compact :( xD

dusk flicker
#

compact != better

tender shard
#

then create a new method called "getChatColor(int)" or sth like that

dusk flicker
#

often times its worse

ember estuary
#

true yea, could do that

#

alright

dusk flicker
#

I would rather have clean simple to understand anytime over something that you have to think about how it works. Especially in debugging

next stratus
#

Spigot truly can be the worse when it comes to loading stuff from configs can't it?

tender shard
#

not really, why?

echo basalt
#

navigablemap

tender shard
#

in fact spigot put a good amount of work in wrapping SnakeYaml into a fool proof system

next stratus
#

It's really struggling to load a map from the a config lol

tender shard
#

not really

#

ConfigurationSection is the "Map" wrapper for configs in spigot

vast raven
next stratus
#

I can't work out how to load the following data correctly 🥲

materials:
  STONE: 0.9
  COBBLESTONE: 0.1
tender shard
#

etc

next stratus
#

I can't do it that way though.