#help-development

1 messages · Page 354 of 1

terse ore
#

I dont see anything related

bold vessel
#

Its increase damage

terse ore
#

oh ty

bold vessel
#

np

buoyant viper
#

yeah the bukkit names for some stuff is.... not the greatest

bold vessel
#

Blvck tag me when its done i go with my gf for like 1h i comeback after ^^

dry yacht
# bold vessel Blvck tag me when its done i go with my gf for like 1h i comeback after ^^

https://github.com/BlvckBytes/PlayerBrewingListener

Here you go, I hope it all works out. This was quite the rabbit-hole, I had to experiment a lot to come up with this solution. If there are bugs or unexpected behavior, please let me know. Would love to improve on this first draft.

@quaint mantle was most definitely right when they said "not gonna be easy". I was like "pff, come on, LOL", but I most definitely didn't expect such a day-to-day task to be that involved.

GitHub

A small state tracker for brewing stand blocks to check which player initialized brewing for a certain slot - GitHub - BlvckBytes/PlayerBrewingListener: A small state tracker for brewing stand bloc...

#

That's why I strongly believe that we need to abstract these headaches away on a library level, instead of opening PRs all the time. If everybody contributes a properly tested and fully working lib, the world would be a better place, xD.

bold vessel
#

And thx bro

dry yacht
bold vessel
#

Can u put the plugin builded in the releases ?

dry yacht
bold vessel
#

where i drop the file in my server ?

dry yacht
#

Oh, I wasn't even aware of that, as I didn't work much with NBT. What exactly is the issue all about?

dry yacht
# bold vessel where i drop the file in my server ?

No, you don't load what I wrote anywhere. You download the zip, copy the three .java files into your project, register the listener as stated in the readme and listen for the new event, as also stated in the readme.

bold vessel
#

okkk

dry yacht
#

Exactly. Now, register the listener and add an event handler for my new event.

bold vessel
dry yacht
bold vessel
#

okk

#

i put it in my eventhandler

dry yacht
#

Btw, you can remove the package from right before the event name and just add an import. No idea why that happened.

dry yacht
dry yacht
#

What do you want to do with the strength? Just set 2 back to 1? If so, I could also show you a specific example of that.

bold vessel
#

I want to make impossible to make strenght 2

#

(splash and normal) and when som1 try to do it

#

send

#

'§f » §cErreur : Vous ne pouvez pas créer de potion de force 2."

dry yacht
#

Yeah, but as you found out you cannot cancel the event. So just setting it from 2 back to 1 and in effect undoing the upgrade would be okay, right? The player looses the one glowstone dust, but who cares, lol

worldly ingot
#

Don't think that's something that would get added because it's not something the server does. Players aren't at all associated with potion brewing. It's done autonomously by a tile entity

bold vessel
#

I dont want new player buy strenght 2 thinking its working but they cant use it

#

Or things like that

worldly ingot
#

When I wrote a quest system that required a quest for brewing potions, I just grabbed the player closest to the brewing stand

#

Or if applicable, one of the players with the brewing stand inventory open

bold vessel
dry yacht
dry yacht
bold vessel
#

Yeah it can work

dry yacht
bold vessel
bold vessel
# dry yacht Or maybe an awkward potion, don't know if that would stop it
package fr.worldorder.wobaguettes;

import fr.worldorder.wobaguettes.commands.BaguetteCommand;
import org.bukkit.Bukkit;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener;
import org.bukkit.event.inventory.BrewEvent;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.PotionMeta;
import org.bukkit.plugin.java.JavaPlugin;
import org.bukkit.potion.PotionData;
import org.bukkit.potion.PotionType;
import me.blvckbytes.playerbrewinglistener.PlayerBrewItemListener;
import me.blvckbytes.playerbrewinglistener.PlayerBrewEvent;


public class WOBaguettes extends JavaPlugin implements Listener {

    private Player player;
    @Override
    public void onEnable() {
        Bukkit.getConsoleSender().sendMessage(
                "§9" + getDescription().getName() + " enable!\n" +
                        "§9Version : " + getDescription().getVersion() + "\n" +
                        "§9WorldOrder"
        );
        getCommand("baguette").setExecutor(new BaguetteCommand(this));
        this.getServer().getPluginManager().registerEvents(this, this);
        getServer().getPluginManager().registerEvents(new PlayerBrewItemListener(), this);
    }
    @EventHandler(priority = EventPriority.HIGH)
    public void onPlayerBrew(PlayerBrewEvent e) {
        player = e.getPlayer();
    }
    public void onBrew(BrewEvent event) {
        for (ItemStack item : event.getResults()) {
            if (item != null && item.getItemMeta() instanceof PotionMeta) {
                PotionMeta meta = (PotionMeta) item.getItemMeta();
                PotionData data = meta.getBasePotionData();
                if (data.getType() == PotionType.STRENGTH && data.isUpgraded()) {
                    event.setCancelled(true);
                    player.sendMessage("§f\uE259 » §cErreur : Vous ne pouvez pas créer de potion de force 2.");
                }
            }
        }
    }
    @Override
    public void onDisable() {
    }
}```
#

Is this good ?

bold vessel
#

I replace my event handler by this ?

dry yacht
dry yacht
dry yacht
#

Right, tell me how it went, xD

bold vessel
#

working

dry yacht
#

Awesome! :)

#

Again, if you ever encounter any issues, let me know, I'd love to improve the lib

bold vessel
#

with splash too

dry yacht
#

Haha :D. I love solving problems, so no worries! :p

dry yacht
#

@glossy venture Lol, is that your YT account? I knew that I was familiar with the nickname at the moment I came across it, xDD.

tender shard
#

hi

#

why ping

river oracle
tender shard
#

hi

#

hello

#

wazzup

bold vessel
#

?paste

undone axleBOT
tender shard
#

it's been 40 minutes now

#

paste it, already

icy beacon
#
public double findStrengthEffectMultiplier(final Player player) {
    final PotionEffect effect = player.getPotionEffect(PotionEffectType.INCREASE_DAMAGE);
    if (effect == null) return 1D;
    return resources.getStrengthMultipliers().getOrDefault(effect.getAmplifier(), 1D);
  }

  public double findWeaknessEffectMultiplier(final Player player) {
    final PotionEffect effect = player.getPotionEffect(PotionEffectType.WEAKNESS);
    if (effect == null) return 1D;
    return resources.getWeaknessMultipliers().getOrDefault(effect.getAmplifier(), 1D);
  }

can this be simplified? i feel like i can make a general method like "findEffectMultiplier" but it'd be inconvenient to also pass a map every time

glossy venture
#

what vid is that

limber marten
#

and wdym pass a map?

icy beacon
#

resources.getStrengthMultipliers() & resources.getWeaknessMultipliers() are two different maps from where i fetch the effect multiplier

#

if i were to create a general method i'd need to pass that map as an argument

limber marten
#

yeah it's my bad, i didn't read the return statement before answering ^^'

icy beacon
#

😛

limber marten
#

Each PotionEffect has its own formula for multipliers. So I recommend you to still create a new method named findEffectMultiplier as I said earlier and make a switch statement for each effects you want to handle.

#

It's still better than just copy and paste methods that are basically the same

#

imo

icy beacon
#

oh, no, it's not like that, it's configured by the administrator

#

it's for my plugin PlungingAttack, where the damage has some multipliers (general, sharpness, weakness, strength, etc) that are all configured by users

#

it's not like it's hardcoded

#

but i guess a switch could work here

limber marten
#

I mean even if you made it, a switch statement still is better in my opinion

icy beacon
#

yep

#

ah it's not an enum

#

i'll have to do it by name

#

aw mann

#

or by key

limber marten
#

what is not an enum?

#

PotionEffectType?

icy beacon
#

potioneffecttype

limber marten
icy beacon
#

my life would be ten times easier if switch cases could take non-constant expressions

#
public double findEffectMultiplier(final Player player, final PotionEffectType type) {
    final PotionEffect effect = player.getPotionEffect(type);
    if (effect == null) return 1D;

    if (effect.getType() == PotionEffectType.WEAKNESS) return resources.getWeaknessMultipliers().getOrDefault(effect.getAmplifier(), 1D);
    else if (effect.getType() == PotionEffectType.INCREASE_DAMAGE) return resources.getStrengthMultipliers().getOrDefault(effect.getAmplifier(), 1D);
    
    return 1D;
  }
#

no switch unfortunately

tardy delta
#

Make your own language that is able to do so

icy beacon
#

that's a viable solution

#

though it'll be a pain to then make a spigot api wrapper for it

#

i'll pass

#

i mean i have a Constants classes with static final values and case still doesn't accept it 😭

tardy delta
#

Use a map with effect type as key

limber marten
#

make your own enum or use a map as FourteenBrush said

icy beacon
#

I could

terse ore
#

"OnHangingPlace.java uses or overrides a deprecated API."

#

is that listener deprecated?

chrome beacon
#

"That listener"

remote swallow
terse ore
#

OnHangingPlace

chrome beacon
#

uses or overrides a deprecated API

remote swallow
#

in the event

#

what listenerd do you specify

terse ore
#

mb

#

HangingPlaceEvent

remote swallow
#

doesnt look deprecated, you using ij?

chrome beacon
#

They're using something deprecated in that class

#

It doesn't have to be the event

remote swallow
#

yeah, intellij should show what

terse ore
#

Is it possible to use FileConfiguration class for another .yml file that isn0t config.yml?

remote swallow
#

yeah

#

check the class you want for words witha strikethrough

#

that will show you whats deprecated

pure stag
#

Does anyone know how you can add your data to the player's data that is stored in uuid.dat?

eternal oxide
#

?pdc

pure stag
#

Thank

#

Is there something for versions below 1.14?

pseudo hazel
#

probably some nbt stuff

pure stag
#

I didn't find anything like that, because the player's data is immediately entered into the variables

#

I am using version 1.7.10

eternal oxide
#

?1.8

undone axleBOT
dry yacht
glossy venture
#

oh yeah

bold crane
#

Can someone help me with a plugin, so when I right click a compass it will run a command for that person, do you know how the code will start?

vale ember
#

make a listener and listen to PlayerInteractEvent, check if the item is compass and run the command

bold crane
#

Still learning so sorry

vale ember
#
Bukkit.getServer().dispatchCommand(sender, "yourcommand");

Where sender is either Bukkit.getConsoleSender() if you want to execute as console or player if as the player.

bold crane
#

so if that item is in hand and pressed then it will int the command for the player who right clicked it

remote swallow
#

?interactevent

bold crane
#

okay thank you

undone axleBOT
#

The PlayerInteractEvent may be called once per hand. If you only want code to be executed once, you can check the result of https://hub.spigotmc.org/javadocs/spigot/org/bukkit/event/player/PlayerInteractEvent.html#getHand(), then decide functionality.

For example, only executing code if the main hand was used:

@EventHandler
public void onPlayerInteract(PlayerInteractEvent event) {
    if (event.getHand() != EquipmentSlot.HAND) { // * if the hand used is NOT the main hand:
        return; // do not progress past this point  |
    }
    // provide functionality
}
vale ember
#

make sure to use .equals instead of ==

#

or isSimilar

remote swallow
#

isSimilar for itemstacks

bold crane
#

okay thank you

remote swallow
bold crane
remote swallow
#

inventory interact event, check for hand and check if its not a compass

topaz cape
#

entity type

terse ore
#

How do I get a material's name?

#

material.getData().getName() -> Cannot get class of modern material

remote swallow
#

to string it

terse ore
#

thanks

#

How can I make so FileConfiguration generates the config file automatically?

#

I want to use a separated yml

#

saveDefaultConfig() would do the job but it doesn't

#

oh wait

terse ore
#

not config.yml

#

another yml

chrome beacon
undone axleBOT
ocean hollow
#

hi guys, how can I place flying sign with wall state?

#

like this

dry yacht
# topaz cape entity type

Well, I would most definitely not try to hide the player and track another entity to it server-side, as that seems immensely wasteful to me.

Since the player is also just an entity and the server already broadcasts move and look packets to all players, I'd personally try to intercept PacketPlayOutNamedEntitySpawn & PacketPlayOutEntityMetadata, drop them and replace them with the spawn packets for the entity you want to display, while keeping the entity id. While you're at it, also drop the PacketPlayOutPlayerInfo, as there's no need to perform tablist manipulation on such an entity.

By keeping the original entity-id, you're making use of all the movement packets the server already broadcasts. I'm pretty sure that this will work out, didn't give it a shot yet tho.

echo basalt
#

problem with that is metadata packets

#

you're gonna have to do a lot of manual conversion

#

I'd just make a client-sided entity and replace the entity id for movement packets

#

the client will still receive metadata packets for the player but it won't matter because the player isn't there

#

you can also just drop them to save on networking

dry yacht
#

So you'd create another clientside entity and patch the movement packets? What does that solve, you could also just drop the metadata packets for manipulated clients. But things like entity flags for on-fire, etc, will still work out anyways, so you'd just need a little logic to check what to let through.

echo basalt
#

that's easier than converting field indexes

dry yacht
#

You don't need to convert anything, just drop them, xD.

echo basalt
#

ehh

dry yacht
#

I just really think that it's best to not have to touch the immensely fast stream of move and look. If you keep the entity-id, you save yourself from a lot of patching.

echo basalt
#

maps have a rather fast lookup time

#

I'd rather do light conversion all the time than something a bit heavier once in a while

#

you run the risk of sending an itemstack when the client expects some floats

dull magnet
#

I want to display success only when a command is executed and an event occurs, and if the command is not executed, even if an event occurs, success does not appear.

#

I don't know what that means

crimson relic
#

do you know java?

dull magnet
#

What I want to ask is how do you detect that you have hit a command

#

Yes

#

ah! OK

#

thank you!

magic raptor
#

Hi guys, i need this dependency (not necessarily this specific version) for my plugin, it's available from bungee (i think, used in past)

    <dependency>
        <groupId>net.md-5</groupId>
        <artifactId>bungeecord-proxy</artifactId>
        <version>1.8-SNAPSHOT</version>
    </dependency>

not 1.8 obv

chrome beacon
#

What do you need it for?

magic raptor
#

messing around with things

#

i need for some reserch purposes also, it was really useful for me

chrome beacon
magic raptor
#

says can't find it in repo blabla

chrome beacon
#

It might not be published to the repo

#

Try installing it locally from github

magic raptor
magic raptor
chrome beacon
magic raptor
#

ah i see, should i compile it?

tender shard
#

you got the wrong artifact ID

#

isnt it just "bungeecord"?

chrome beacon
#

They specifically want that proxy module for some reason

chrome beacon
tender shard
#

"bungeecord-api" is the "normal" dependency

magic raptor
#

doing it, compiling

#

i need that proxy module

tender shard
#

what for?

magic raptor
#

found it, thanks @chrome beacon

#

i need to set gamemode from proxy, that's why i need it

#

but seems that setGamemode doesn't work

tender shard
#

bungee has no information about your gamemode

topaz cape
#

which i already achieved long ago

magic raptor
#

i did some tests, it can read it but not change it

topaz cape
#

i mean for the player himself (the changed one) is it possible for em?

tender shard
magic raptor
#

it's just for test, not real code obv

#

it's recognizing the gamemode but won't change it in game

remote swallow
#

latest on there is 1.19

dry yacht
severe oracle
#

Hi, does anyone by any chance know how can i get item NBT tags? version: spigot 1.19

remote swallow
#

/data get entity @s SelectedItem if you just need to look at it

severe oracle
#

thanks, but i want my spigot plugin to do it

lofty junco
#

Hey, im trying to change the block type after breaking it like this:

    public void onBlockBreak(BlockBreakEvent event) {
        event.getBlock().setType(Material.STONE);
    }```

but nothing is happening does anyone have an idea?
kind hatch
severe oracle
#

did you register events?

tawdry echo
#

register listener

lofty junco
lofty junco
quaint mantle
#

Hey Guys How can I detect 12.00 AM in a real time(every day) I just don't know is there only scheduler for check it?

hoary wing
#

is there a way to disable air resistance on projectiles?

quaint mantle
remote swallow
#

you ever seen those like long numbers

#

might look like 1675870811

quaint mantle
#

Yeah I've seen that long numbers

remote swallow
#

its that, just check every minute or so if its that time

#

if it is do stuff

tardy delta
#

LocalDateTime

quaint mantle
quaint mantle
quaint mantle
vital sandal
#

i have a class called Holder to put those stuffs

#

should i do it ?

tardy delta
#

No

quaint mantle
tardy delta
#

No

quaint mantle
#

k

vital sandal
#

so instead i create a class for each one and make it private and access with public Data get() ?

quaint mantle
#

sry im bad at eng

tardy delta
#

No

#

Look at the date time API, you need smth of that

quaint mantle
#

okkk

vital sandal
#

is it possible to change player location on PlayerQuitEvent

river oracle
#

Idk 🤷‍♂️ does it give you a player object

vital sandal
#

yeh

river oracle
#

Sure

vital sandal
#

any issue or improvement to this ?

remote swallow
#

store a uuid not a player

#

the player var would be invalid if they log out

vital sandal
#

attually it do

#

just tested it :d

#

i removed it on PlayerQuitEvent

river oracle
#

Storing player object is asking for memory leaks but you do you

wary harness
#

@vital sandal just don't store player objects

vital sandal
wary harness
#

In past I had problem after an hour or so if you did any changes on player object in map it would not take any effects on the player even if they didn't reloged at all

#

Store uuid as key always

vital sandal
#

also

#

can i make a EventListener that is only for a specific one ?

eternal oxide
#

yes

remote swallow
#

like any other listener?

#

SomethingEvent

hasty prawn
#

You can store player objects so long as you're handling it properly.

#

If you need the player object, which he clearly does, storing the UUID doesn't really make a ton of sense.

#

You're just forcing yourself to constantly call Bukkit.getPlayer()

vital sandal
#

this seem stupid idea :d

#

should i do that or just one Listener for every player ?

remote swallow
#

why would you do one for each player

vital sandal
#

i mean

#

that event is called whenever any one log out

#

which is not necessary

remote swallow
#

you if check it

#

just check if the location handler list contains the player

#

dont need to pass a player in

vital sandal
#

that class replace what i have done before

#

this is better

remote swallow
#

if (map.hasKey(event.getPlayer().getUniqueId()) do stuff

#

might be contains key

bright mica
#
        if (item != null && item.getType() ==Material.ELYTRA) {
            System.out.println("found ELYTRA");
            event.setCancelled(true);
            event.getWhoClicked().getInventory().removeItem(item);
        }

this code to block elytras works, but people can just bypass it by getting the elytra from the end city and shift click to equip it, i want to prevent that by deleting the elytra out of the inventory

remote swallow
#

item pickup event

#

inventory click event

bright mica
remote swallow
#

listen to item pickup event too

bright mica
#

ok thanks

tardy delta
vital sandal
#

u dont need them online to teleport

tardy delta
#

instead of

vital sandal
#

weap just in case the data passing steep is malfunction

vital sandal
tardy delta
#

that explanation doesnt make any sense

vital sandal
#

let talk about this instead

tardy delta
#

talk about what

vital sandal
#

is there any issue with it ?

remote swallow
#

yes

#

looking at that you register a new listener, use it once, unregister it

#

have a global listener and check if the list contains the player

vital sandal
#

if multiple player active it it will be multiple listener right ?

remote swallow
#

no

#

just check if the map contains the player

#

its not that hard

dry yacht
# echo basalt problem with that is metadata packets

Btw, I just gave this a shot out of curiosity. I am only substituting the named entity spawn for a entity spawn of the required type with the same entity-id and there are absolutely no issues whatsoever. The player has a tab-entry by not dropping those packets, which likely is desired. All metadata packets like on fire, invisible, etc work, and the client - of course - has no issues with packets that send unsupported behaviour for the disguised type, as it just doesn't apply them. Pickup animations work too, and everything else that's bound to entity IDs. It would have just been insanity to modify all of these packets, as there's no need to do so.

echo basalt
#

Now let the player equip armor

dry yacht
echo basalt
#

Crash

dry yacht
#

Uhm, it just does nothing, xD

#

Do you know a specific version the crash would happen on?

lethal knoll
#

In terms of performance, would it be (acceptable) to have a runnable run every tick?
int taskId = scheduler.scheduleSyncDelayedTask(plugin, timeChecker, 1L);

tall dragon
#

depends what tasks you perform inside the runnable

lethal knoll
#

The goal is to run a piece of code when a specific time is reached

tall dragon
#

ah

#

and you absolutely have to be accurate to 50ms?

lethal knoll
#

No not really. I could use between x and y

#

But if there is a cleaner solution, preferred

tall dragon
#

else i'd suggest just checking every second or so to see if the time has been reached.

lethal knoll
#

Yeah, if i go a step further even, if there would be an event to listen for changes between day and night time events, perfect

lyric geode
#

hi can someone help me how to do a custom message when server stops

#

i want to be like this

#

[Servername]
&a§l⚀§c§l⚁§b§l⚂§e§l⚃§5§l⚄§4§l⚅§3§l⚄§6§l⚃§2§l⚂§d§l⚁§9§l⚀§r
4♥§6Sorry about that!§4♥
§6Server Stopped
§6Contact with a ADMIN§r
§6or see Announcements§r
§9§l⚀§d§l⚁§2§l⚂§6§l⚃§3§l⚄§4§l⚅§5§l⚄§e§l⚃§b§l⚂§c§l⚁§a§l⚀§r

tall dragon
#

not sure bout that tho

lethal knoll
#

I believe the TimeSkipEvent is used when someone is sleeping, in my other plugin I already cancel it to avoid the server from changing the time 🙂

tall dragon
#

well then ur best option is to just check every X amount of time i think

#

prolly doesht have to be every tick though if i understand u correctly

tardy delta
lethal knoll
#

I see, well checking every x amount of time it is

#

Thank you

dry yacht
lethal knoll
#

Alright, thank you all for the advice!

dry yacht
#

If you want to you could tell us about what exactly you want to accomplish tho, as maybe somebody has a better idea. You're basically polling for something to occur, while interrupt style procedures are to be preferred.

wooden osprey
#

you can throw in a check to see for the cause of the disconnect

lyric geode
#

i am not usig this type of code

wooden osprey
#

what?

lyric geode
#

nothing

austere cove
#

I have a

Map<Class<?>, Collection<IScriptLoader<?>>> loaders

and I want to get the loaders for a specific type.
Right now I'm doing this with a jank double cast because without the object cast the IDE complains

(Collection<IScriptLoader<IGenerator>>) (Object) loaders.get(IGenerator.class)

is there anything I'm missing or is this a certified java moment

tardy flame
#

Looks like java generics being itself

clever inlet
#

d

#

how can i add models to vehicles minecraft plugin?

lean fossil
wooden osprey
#

how would I go about storing items for a block? (maybe in nbt, maybe as a file?)
I do need to store both the input items and the output items

kind hatch
#

You could use the pdc.

kind hatch
wooden osprey
#

compared to pdc

tardy delta
#

why would you write when its not needed

#

serializing item data to pdc goes more brr

lean fossil
tall dragon
#

huh, storing it in memory does not require writing / reading ?

remote swallow
#

that will not work

lean fossil
#

but it working

remote swallow
#

spigot never calls a constructor of a class

tall dragon
#

he prolly has another actual main class then xD

lean fossil
#

[19:03:20] [Server thread/INFO]: [Valentynek] Enabling Valentynek v1.0

wooden osprey
tall dragon
#

and calls it from there

kind hatch
tall dragon
wooden osprey
#

yeah i am going to only process it when the chunk is loaded

tall dragon
#

ok, then it should be fine.

tall dragon
lean fossil
#

??

tall dragon
#

all i'm saying is. the way you named ur classes is shite

lean fossil
#

and thats why it doesnt work?

tall dragon
#

no

#

firstly, sentValentineFile = new File("sentValentine.txt"); this is not going to make a file where u want it to probably

tawny star
#

i wanna make a level generation, what could i use to make the generation update in some time like a loop or player walk event, infinite loops very bad, i couldnt find player walk event

tall dragon
#

since ur not providing the path to ur plugin data folder before the file name

icy beacon
#

playermoveevent?

tardy delta
#

dont

icy beacon
#

infinite loops very bad
depends, but you can also use a scheduler repeated task with 1 tick delay

#

I don't know what you're trying to do, I just joined the convo

#

hope this could be any relevant

tawny star
remote swallow
#

?eventsapi

#

?events

tardy delta
#

what do you even mean with level generation?

tawny star
tardy delta
#

how do i force any jetbrains product to login with another gh account?

#

its defaulting to my primary gh acc

#

got it

rare flicker
#

I've been working on a common library to automate some parts of plugin dev. While most librairies are external plugins that they depend on, i'd like to simply include classes in the jar directly. How can i do that? simply selecting the library while exporting doesn't do it

tardy delta
#

shading it?

rare flicker
#

basically, but without maven or gradle, just raw java projects

tardy delta
#

cant help with that

rare flicker
#

fudge

kind hatch
#

You have to copy the files into the project then compile it at that point.

quiet ice
#

You can't shade with JDT - for IJ Artifacts idk

rare flicker
#

TwT

#

time to convert all my projects to maven ig

quiet ice
#

the only proper choice

rare flicker
#

i know nothing of maven. Is there an archetype for minecraft plugins? or do i just make a project without an archetype

quiet ice
#

Just don't bother with archetypes

haughty granite
#

I need to get the stats of the players (deaths, killed mobs...), I thought of making an api which sends the data on my site to record them in base at each connection of the player, but is there a better technique?

chrome mirage
#

help

#

me pls

#

in

quiet ice
#

Of course there are a few that swear by it, but it just isn't that useful beyond saving you a few minutes or so

quiet ice
quiet ice
quiet ice
#

I guess you could use a shared DB for that or make the website request data from the server on an as-needed basis

haughty granite
#

is it possible to request information from the site to the server?

quiet ice
#

Having the server contact the website when a change occurs could be considered unstable

haughty granite
quiet ice
haughty granite
#

yes with laravel, how to call a function of a plugin from the site?

quiet ice
#

Although you could also make the browser contact the server but that make open up large scale datamining

#

I'd not publicly expose API endpoints

haughty granite
#

player data are collected via getPlayer#getStatistic()

quiet ice
haughty granite
#

I have full knowledge of api endpoints in php but in java it's another story, I don't see how to do it

quiet ice
#

I haven't used the apache spark framework yet

#

If I had to I'd create a server through the takes library or similar

bold vessel
#

Hi, i have a question. If i put a customodeldata on a carrot on a stick. I want to create a craft with the custom carrot on a stick and disallow the normal carrot on a stick, is this possible with spigot ?

livid dove
#

Is there a way for holograms to show diff info for diff players? Never really worked with em

kind hatch
#

With placeholders yes. Or send unique hologram packets to each individual player.

bold vessel
#

Do you have a example pls ?

tawdry echo
#

get inventory then get matrix and check corectness

bold vessel
#

👍

dry yacht
wooden osprey
#
public static String serialize(Recipe object) {
        Bukkit.getLogger().info(object.getClass().getName());

        try {
            ByteArrayOutputStream io = new ByteArrayOutputStream();
            BukkitObjectOutputStream bos = new BukkitObjectOutputStream(io);
            bos.writeObject(object);
            bos.flush();

            byte[] serializedObject = io.toByteArray();

            return Base64.getEncoder().encodeToString(serializedObject);
        } catch (IOException e) {
            Bukkit.getLogger().info(" > Failed to serialize Recipe.");
        }
        return null;
    }

could someone explain to me the potential causes for null returns here? (Recipe is a class I made)

abstract bloom
#

how to create own command in the server ?

vale ember
#

np

abstract bloom
#

How to make a mattress like Creative?

river oracle
#

Mattress ???

abstract bloom
#

I don't understand you

river oracle
#

There are no mattresses in minecraft

abstract bloom
#

Do not get me wrong

#

I mean arranged like Creative

river oracle
#

Make what arranged like creative

abstract bloom
#

y

river oracle
#

What is ur native language

#

Google translate sucks

abstract bloom
#

Arabic

river oracle
#

Sorry I can not help you

abstract bloom
#

تمام

#

تمام = ok

#

@river oracle

#

pronounced tmam

broken vortex
#

Is EntityDeathEvent supposed to fire when you /kill entities?

opal juniper
#

i imagine

broken vortex
#

same

#

it doesnt seem to fire

rough drift
#

Using protocollib I am trying to empty a player's inventory

var container = new PacketContainer(PacketType.Play.Server.WINDOW_ITEMS);
container.getBytes().write(0, (byte) 0); // Window ID
container.getIntegers().write(0, 999); // State ID
var count = player.getInventory().getSize();
var emptyStack = new ItemStack(Material.AIR);
var stacks = new ItemStack[count];
for (int i = 0; i < count; i++) {
    stacks[i] = emptyStack;
}

container.getIntegers().write(1, count); // Count
container.getItemArrayModifier().write(0, stacks); // Stacks
container.getItemModifier().write(0, emptyStack); // Cursor

Now there are two issues I see: I don't know how to get the State ID, and the getIntegers seem to be of length two, and there doesn't seem to be any byte slots in getBytes

tardy delta
#

why is java using var and not let

#

disgusting

rough drift
#

lol

#

Anyways, got any ideas why? I am out of em lol

wind blaze
#

are there any shortcuts to get total player kills? or do i have to save it myself and run it over config

rough drift
#

player stats iirc

hazy parrot
wind blaze
#

true.. thanks!

hazy parrot
#

Or is there any particular reason for using protocollib

rough drift
#

It's safer than storing the player's inventory, I just need to edit what's shown, don't care about what's actually in

#

(For context, my original solution used the Spigot API and it didn't work like I needed it to, so now I am using protocollib)

tardy delta
#

only time i used protocollib was when i was doing a codedred tutorial on yt

rough drift
#

lol

hoary wing
#

my projectiles slow down after a while, is there air resistance or something? and if so how do you disable it

halcyon dome
#

make plugin with multiversions ?

dry yacht
hoary wing
#

so no setting i can disable, ok, guess ill do that while spawning my particle trails then

remote swallow
mint barn
#

Hello, I would like to learn how to use nms. Having the basics in java I would like to be able to move forward. Do you know how I can learn while using the nms of the latest version of the game?

halcyon dome
remote swallow
#

oh for nms you will need to depend on each version that changes nms

#

easiest way to do that is multi module

halcyon dome
#

ok thx alot

mortal hare
#

have anyone used gradle shadow plugin before

#

im trying to decouple my project into commons and bukkit subprojects

remote swallow
#

a gradle user

#

thats surprisng

mortal hare
#

whats so special about it

remote swallow
#

no one here uses it

eternal night
#

I mean, the shadow plugin is rather straight forward

#

what is your exact question

#

yeet it into your plugins block

mortal hare
#

i did

eternal night
#

and it will shade whatever you define as implementation

mortal hare
#

and i did defined it as impl

#

it just doesnt resolve the path

remote swallow
#

?paste build.gradle

undone axleBOT
eternal night
#

are you running the correct task

#

resolve the path ? think

mortal hare
eternal night
#

groovy dogekek

remote swallow
#

groovy is great

mortal hare
#

im using paperweight, but this shouldnt be a cause

#

its great

eternal night
#

what is the exact issue ?

mortal hare
#

i prefer groovy than kotlin

eternal night
#

paperweight does touch shadow a bit

mortal hare
#

it just doesnt resolve

eternal night
#

ehm

remote swallow
#

multi module?

mortal hare
#

the package

#

yes

eternal night
#

yea gradle does not support nested shit

mortal hare
#

it works with paperweight tho

#

i can define paperweight in to multiple modules

remote swallow
#

implementation (":something") instead

mortal hare
#

and its fine

#

although i had some issues before

#

but i fixed it

eternal night
#

nested != multiple

remote swallow
eternal night
#

you are trying to have a module inside another module

remote swallow
#

its probably easier to do that

eternal night
#

your commons inside core

mortal hare
eternal night
#

which makes no sense tbh

mortal hare
#

idk they're next to each other

#

rpjobs-core is just a folder

#

gradle doesnt like nesting true

eternal night
#

tho it looks like it should work out RonHuh

mortal hare
#

exactly

remote swallow
#

you dont need to specify the top folder

eternal night
#

I mean where do you call that from

#

I presume it is a module on the same level as core

broken vortex
remote swallow
#

if that build.gradle is in the same location of those 2 folders it would be just :rpjobs-stuff

mortal hare
#

i call the shadowjar from rpjobs-bukkit

eternal night
#

then it would just be :rpjobs-commons yea

mortal hare
#

🙃

#

such a simple functionality yet so difficult to setup lol

remote swallow
#

im pretty sure your build.gradle should be in the rpjobs-core for doing that if you need to acces other stuff otherwise you need to do parent(":rpjobs-commons") i think it is

mortal hare
#

let me try to remove rpjobs-commons

#

and put it inside the rpjobs-core

#

it strange that intellij detects rpjobs-core as a module

#

although only nested ones are modules

#

maybe that's the case

#

somehow

remote swallow
#

if thats a subfolder thats why

mortal hare
#

wtf does that mean

#

soz, only a week into gradle for me

tardy delta
#

gradle 💀

mortal hare
#

i've done mostly cpp for a year

#

maybe both modules should have plugin inside their build.gradle?

#

no way

#

that worked lol

grave belfry
#

in this snippet how do I make it show "power:" instead of "v:"?

#

I'm using intellij

echo basalt
#

you kinda can't

#

unless you're using some special fork or something

grave belfry
#

?

echo basalt
#

that hint is made by the variable name itself

grave belfry
#

I have it on my other computer

echo basalt
#

different spigot import or something

grave belfry
#

hm

#

weird

#

don't think I did anything different

#

well thanks anyway

mortal hare
#

it could be that you're using different versions of the spigot api

trail lintel
#

Hey guys, I am trying to set up an autocompleter for my plugin. I think I figured most of it out, but I'm not sure how to have the next portion of the auto complete know to list players like many plugins do. Is this something I have to hardcode? Here is what I have so far.

if(args.length == 0) {
  return Arrays.asList("give");
} else if(args.length == 1) {
  if(args[1] == "give") {
    // need to make this show a player list
  }
}
tardy delta
#

check StringUtil from spigot package

mortal hare
#

i didnt knew this existed

#

thanks i guess

terse ore
#

Hey

#

How can I make a player head with skullowner set?

frail gale
#

he will help you

#

he knows some Spigot

frank kettle
#

SkullMeta will have a function to set the owner of the head

#

Just make sure you set the ItemStack as a player head material.

frank kettle
#

💀

copper scaffold
# terse ore How can I make a player head with skullowner set?

You can use this for example


        boolean isNewVersion = Arrays.stream(Material.values())
                .map(Material::name).collect(Collectors.toList()).contains("PLAYER_HEAD");

        Material type = Material.matchMaterial(isNewVersion ? "PLAYER_HEAD" : "SKULL_ITEM");
        ItemStack item = new ItemStack(type, 1);

        if(!isNewVersion)
            item.setDurability((short) 3);

        SkullMeta meta = (SkullMeta) item.getItemMeta();
        meta.setOwner(p);

        item.setItemMeta(meta);
        return item;
    }
frank kettle
#

🗿ah yes, the typical spoon feed

mortal hare
copper scaffold
mortal hare
#

that way you wouldnt need to calculate the same check all over again

mortal hare
#

because you're calling the same funcs every time player's skull is retrieved

#

its just optimization technique its not necessary

copper scaffold
#

oh okay i understand

#

I have one question how do i can make a invsee command that also shows the armor and offhand? bcs i don't get it how to do that

mortal hare
#

there's no "one-liner" way of doing that, you would need to open separate inventory and play with events, to sync player's container with your new inventory

#

or use some NMS wizardry to fool server, that its placing items inside player's inventory

#

but it involves knowledge of nms and some smelly hacking of classes

#

to do it cross compatible without NMS, you would need to open up new chest inventory

#

scan player's inventory and add them to the new container

#

when player removed or adds items

#

remove the items from there too

frank kettle
#

Why not create a custom inventory that shows that and update it every 5-10 ticks?

mortal hare
#

if you pickup that item from new container, you need to remove item from player's inventory

dry yacht
mortal hare
frank kettle
#

By pickup u mean taking items away from player?

mortal hare
#

yes

frank kettle
#

Well, that depends on what he needs by invsee

#

You could just create a inventoryclickevent of that custom inventory and get the slot u click and take that item away, and then map the slots for the armor and offhand

mortal hare
#

yea, thats what i already provided above 😄

frank kettle
#

Or I guess when u update that inventory also update the players inventory with what is in it.

frank kettle
dry yacht
mortal hare
#

by mismatching inventory views

frank kettle
mortal hare
#

i already tried it

#

and it worked

#

but involves reflections

#

to open up some private fields

dry yacht
# frank kettle More cases?

Item pickup, armor equip, switch item to offhand, programmatic adding of items, tool break, interacting, etc

frank kettle
#

Well, when I meant by inventoryclick was the person using the invsee to interact with it.

#

I guess u would need to create a list of players with their inventory being seen and on every inventory changing events go through another list that contains the watchers and update their custom inventory.

dry yacht
#

It's actually a really hard problem to solve, as inventories sadly don't seem to be observable. You can't even detect all updates through events, as there are so many possibilities and also programmatic ways to update it. I wonder what the most elegant solution would look like...

frank kettle
#

What about updating it on a loop every tick?

#

🤔

bold vessel
#

Som1 know how i can make this work with all leaves (and not only one type of leaves)

dry yacht
# frank kettle What about updating it on a loop every tick?

I personally just really dislike the idea of polling constantly. I'd rather like to be notified when the inventory changes. Maybe I could intercept the packet stream of players and check for inventory updates aimed at the own inventory, this way the two would - by definition - always be synchronized.

bold vessel
dry yacht
#

if (Tag.LEAVES.isTagged(event.getBlock().getType()))

bold vessel
#

Okkk

fervent robin
#

Is it possible to detect a players fabric mod list in 1.19?

atomic swift
#

can i check if an Entity came from a spawner

tender shard
#

relatable

tender shard
#

afterwards? I dont think so

atomic swift
#

ive seen stuff about CreatureSpawner

tender shard
#

if the entity was already spawned, I dont think you can check the spawn reason anymore

atomic swift
#

SpawnerSpawnEvent

#

what about entity data

tender shard
#

yeah well ofc you could just add some data to the entity while it is spawned

#

e.g. setMetadata or however it's called

#

or the PDC

#

yowza

atomic swift
#

it appends to a value

tender shard
#

whatver += 20 is the same as whatever = whatver +20

atomic swift
#

so this would return Hello World!

String yep = "Hello";
yep+=" World!";

System.out.println(yep);
tender shard
#

because + will not change that variable at all

atomic swift
#

you would use ++ to increase once

tender shard
#
int a = 20;
a + 30; // a is still 20
a += 30; // now a is 50
atomic swift
#

also you can do ++ before or after but it affects the code as before sets it before passing the value in and after passes after running

tender shard
#

no

tender shard
#

a + 30 means "add 30 to a" but it doesnt update the original value

#

yes

#

and that's the difference

atomic swift
#

but that doesnt compile

tender shard
#

probably not

#

but you get the idea

atomic swift
#

so in that you wouldnt get anything

tender shard
#

IJ's new UI is so bad, wtf

atomic swift
#

well ima go create an IString and a StringImpl

tender shard
#

nobody ever needs that, if it even exists

atomic swift
#

tf i dont know any of those

tender shard
#

same

#

I do java for 20 years now and I never saw any of those operators, if they exist in the first place

atomic swift
#

all u need is = == && || ->

#

and some more

tender shard
#

& means "and"

atomic swift
#

im assuming it adds them liek x + 3

#

so like the + 3

#

the3

#

idk

tender shard
#

x = x & r only works on booleans

#

& simply means "and"

#

&& is lazy and

atomic swift
#

dont forget about condition ? true : false

tender shard
#

how is that called again

#

i always forget the name

atomic swift
#

ternary operators

tender shard
#

I just always call it "question mark operator" lol

#

ah yes

#

thx

atomic swift
#

they are nice to use

#

and very clean

tender shard
#

yeah but the name is annoying to remember lol

atomic swift
#

now we dont talk about #stream()

tender shard
#

if you need it, sure

proper notch
#

Yes. Modulus is useful

tender shard
atomic swift
#

some dumb elementary kid

tender shard
#

e.g. to turn "8.27 hours" into "8 hours and 16 minutes"

atomic swift
#

well thats where Duration comes in

tender shard
#

erm sure, one sec

atomic swift
tender shard
atomic swift
#

Duration#toMinutesPart()

atomic swift
#

Duration does it for you

proper notch
#

Yh for playtime I just guarantee a max of 3 units up to a year. So you can get 1y, 2mo, 5d for instance. I just use duration and toXPart for that.

tender shard
proper notch
#

Might be a better way but that was just logical in the moment

atomic swift
#

epik

proper notch
#

Yh, talking about formatting it into 3 units :)

atomic swift
proper notch
#

When if there's an hour in there, it won't display seconds. So on and so on

#

duration is hot

atomic swift
#

yes

#

i use it too

tender shard
atomic swift
#

you dont need Math

proper notch
#

at least it's not Go's math package

tender shard
#

I currently read a python book and it's a huge joke

atomic swift
#

honestly all u need is classes statements and some other suff

#

then StackOverflow is your friend

#

noooooo py too easy

#

java is soooo much different

proper notch
#

Go is nice to learn coming from java

#

Or at least, I've really enjoyed it coming from java

atomic swift
#

Py is a scripting lang whereas java is Object oriented

#

lol

#

py u need only 2 min

#

its that easy

#

rip

#

py is good for idk

#

well js is more web stuff

#

no and yes

#

not advanced math

#

unless your building a lib

#

but u need it for loops and stuff

#

where the i++ comes in

#

prob not

#

unless u see some purpose to it

#

plus if u evere need it it will always be there

#

lmao

#

you might need Math#Random();

#

you most likely wont need java as much bc u will mostly be using libs ( unless ur building some bomb)

#

why not

#

math and Booleans are ez tho

hazy parrot
atomic swift
#

imagine js user comes to java: if (Object == undefined)

atomic swift
hazy parrot
#

Never heard of elixir and go, but I know they are migrating some of critical endpoints to rust

atomic swift
#

never have used any of those besides py

#

i have dabbled in Cpp

#

imagine spigot in Rust

hazy parrot
#

Rust is becoming "hey I'm using arch" meme

tender shard
#

as a pilot, I can confirm that this is realistic

proper notch
#

Go is really nice

tender shard
#

nasi goreng

proper notch
#

Discord had a blog a long time ago discussing some issues they had as a result of GCs with it and they migrated the service to Rust as a result

hazy parrot
#

Like weird in comparison to other languages

tender shard
#

i dont like go, because I dont know it

hazy parrot
tender shard
#

yeah

#

I admit that

atomic swift
#

skull issue

tender shard
#

my skull is healthy

atomic swift
#

those are fun

#

i wouldnt go that far into arrays as i would replace those with lists

proper notch
#

I like Go's error handling

tender shard
atomic swift
#

List<T>

tender shard
atomic swift
#

or ArrayList<T>

#

and u def want to learn HashMap<T,Y>()

hazy parrot
#

Yes

crimson relic
#

yes

atomic swift
#

yes

#

oracle's is like ~$200

hazy parrot
#

Noone

crimson relic
#

if you wanna get laughed at then you can get a w3 schools cert

atomic swift
#

all u need it some skill with programming to get a job

tender shard
#

what the heck is a java certificate o0

atomic swift
#

to show u know java

hazy parrot
#

Certificate that you finished java course

tender shard
#

huh

#

never heard of that

atomic swift
#

its ||gay||

tender shard
#

you are gay

hazy parrot
#

It's not even degree, not official

atomic swift
#

rip

#

oracle's is official

crimson relic
#

it means nothing other than "i paid this company money"

hazy parrot
#

Just smth you can show like, hey look, I finished this course

atomic swift
#

ill just forge 1

tender shard
#

okay guys, I also offer java certificates. just send 100$ to paypal.me/mfnalex and you'll get one

#

it uses comic sans

atomic swift
#

alright i passed the exam

tender shard
#

here betta, you got a cert for free

glad prawn
#

🗿

atomic swift
tender shard
atomic swift
#

ikr

tender shard
#

it looks like something tRump would have tried

crimson relic
#

omw to get some certificates

tender shard
#

"tRump java academy"

atomic swift
#

omw to the midjourny server

tender shard
#

proxmox' firewall is so weird

crimson relic
#

in what way

hazy parrot
#

It's probably better to just do some project instead of just learning function names and what they do

tender shard
#

it cannot do any actual useful things, e.g. for MASQUERADE you still need to use iptables manually

crimson relic
#

thats not weird

#

it doesnt need masquerade

tender shard
#

then how would you port forward?

atomic swift
tender shard
#

another funny thing: proxmox always quires you to create a bridge on your own

#

somehow they think that everyone got a whole /29 subnet

atomic swift
#

lol

tender shard
#

while in reality, nobody does

atomic swift
#

imagine failing the java cert exam with a 0% and not getting a refund

tender shard
#

pls nobody DM me - I am exactly at 200 DMs now

atomic swift
#

lol

#

im @ 769

tender shard
#

where did you get the nazi font from?

atomic swift
#

?

tender shard
#

in your bio

atomic swift
#

ok

#

oh lol

tender shard
atomic swift
tender shard
#

ah thx

atomic swift
#

its the 1st 1

tender shard
#

thanks

atomic swift
#

2nd

tender shard
#

I don't know what I need it for, but I'll bookmark it lol

atomic swift
#

𝖄𝖊𝖘

#

lol

#

ƎԀON

tender shard
#

𝕴𝖒𝖆𝖏𝖎𝖓 𝖘𝖚𝖈𝖐𝖘 𝖆𝖘𝖘, 𝖆𝖓𝖉 𝖓𝖔𝖙 𝖎𝖓 𝖙𝖍𝖊 𝖌𝖔𝖔𝖉 𝖜𝖆𝖞
@quaint mantle

atomic swift
#

N̴̆̾O̵̎̈́P̸̽͝E̶̾̇ ⓃⓄⓅⒺ N҉O҉P҉E҉ [̲̅N][̲̅O][̲̅P][̲̅E]

tender shard
#

𝖕𝖚𝖇𝖑𝖎𝖈 𝖘𝖙𝖆𝖙𝖎𝖈 𝖛𝖔𝖎𝖉 𝖒𝖆𝖎𝖓(𝕾𝖙𝖗𝖎𝖓𝖌... 𝖆𝖗𝖌𝖘) {
𝕾𝖞𝖘𝖙𝖊𝖒.𝖔𝖚𝖙.𝖕𝖗𝖎𝖓𝖙𝖑𝖓("𝖑𝖔𝖑𝖟");
}

atomic swift
#

me: gonna get rate limited

tender shard
#

I will never send normal code again

hazy parrot
#

no ‫ pe

atomic swift
#
𝖕𝖚𝖇𝖑𝖎𝖈 𝖘𝖙𝖆𝖙𝖎𝖈 𝕾𝖙𝖗𝖎𝖓𝖌 𝖙𝖔𝕽𝖊𝖆𝖉𝖆𝖇𝖑𝖊𝕾𝖙𝖗𝖎𝖓𝖌(𝕰𝖓𝖚𝖒<?> 𝖊) {
        𝖈𝖍𝖆𝖗[] 𝖈𝖍𝖆𝖗𝖘 = 𝖊.𝖓𝖆𝖒𝖊().𝖙𝖔𝕷𝖔𝖜𝖊𝖗𝕮𝖆𝖘𝖊().𝖗𝖊𝖕𝖑𝖆𝖈𝖊("_", " ").𝖙𝖔𝕮𝖍𝖆𝖗𝕬𝖗𝖗𝖆𝖞();
        𝖇𝖔𝖔𝖑𝖊𝖆𝖓 𝖋𝖔𝖚𝖓𝖉 = 𝖋𝖆𝖑𝖘𝖊;
        𝖋𝖔𝖗 (𝖎𝖓𝖙 𝖎 = 0; 𝖎 < 𝖈𝖍𝖆𝖗𝖘.𝖑𝖊𝖓𝖌𝖙𝖍; 𝖎++) {
            𝖎𝖋 (!𝖋𝖔𝖚𝖓𝖉 && 𝕮𝖍𝖆𝖗𝖆𝖈𝖙𝖊𝖗.𝖎𝖘𝕷𝖊𝖙𝖙𝖊𝖗(𝖈𝖍𝖆𝖗𝖘[𝖎])) {
                𝖈𝖍𝖆𝖗𝖘[𝖎] = 𝕮𝖍𝖆𝖗𝖆𝖈𝖙𝖊𝖗.𝖙𝖔𝖀𝖕𝖕𝖊𝖗𝕮𝖆𝖘𝖊(𝖈𝖍𝖆𝖗𝖘[𝖎]);
                𝖋𝖔𝖚𝖓𝖉 = 𝖙𝖗𝖚𝖊;
            } 𝖊𝖑𝖘𝖊 𝖎𝖋 (𝕮𝖍𝖆𝖗𝖆𝖈𝖙𝖊𝖗.𝖎𝖘𝖂𝖍𝖎𝖙𝖊𝖘𝖕𝖆𝖈𝖊(𝖈𝖍𝖆𝖗𝖘[𝖎])) {
                𝖋𝖔𝖚𝖓𝖉 = 𝖋𝖆𝖑𝖘𝖊;
            }
        }

        𝖗𝖊𝖙𝖚𝖗𝖓 𝕾𝖙𝖗𝖎𝖓𝖌.𝖛𝖆𝖑𝖚𝖊𝕺𝖋(𝖈𝖍𝖆𝖗𝖘);
    }
tender shard
#

@𝕹𝕸𝕾("1.16.2")
𝖕𝖚𝖇𝖑𝖎𝖈 𝕹𝖆𝖒𝖊𝖘𝖕𝖆𝖈𝖊𝖉𝕶𝖊𝖞 𝖌𝖊𝖙𝕭𝖎𝖔𝖒𝖊𝕹𝖆𝖒𝖊𝖘𝖕𝖆𝖈𝖊𝖉𝕶𝖊𝖞(@𝕹𝖔𝖓𝖓𝖚𝖑𝖑 𝖋𝖎𝖓𝖆𝖑 𝕷𝖔𝖈𝖆𝖙𝖎𝖔𝖓 𝖑𝖔𝖈𝖆𝖙𝖎𝖔𝖓) {
𝖋𝖎𝖓𝖆𝖑 𝕻𝖆𝖎𝖗<𝕾𝖙𝖗𝖎𝖓𝖌, 𝕾𝖙𝖗𝖎𝖓𝖌> 𝖐𝖊𝖞𝕻𝖆𝖎𝖗 = 𝕵𝖊𝖋𝖋𝕷𝖎𝖇.𝖌𝖊𝖙𝕹𝕸𝕾𝕳𝖆𝖓𝖉𝖑𝖊𝖗().𝖌𝖊𝖙𝕭𝖎𝖔𝖒𝖊𝕹𝖆𝖒𝖊(𝖑𝖔𝖈𝖆𝖙𝖎𝖔𝖓);
𝖗𝖊𝖙𝖚𝖗𝖓 𝕹𝖆𝖒𝖊𝖘𝖕𝖆𝖈𝖊𝖉𝕶𝖊𝖞.𝖋𝖗𝖔𝖒𝕾𝖙𝖗𝖎𝖓𝖌(𝖐𝖊𝖞𝕻𝖆𝖎𝖗.𝖌𝖊𝖙𝕱𝖎𝖗𝖘𝖙() + ":" + 𝖐𝖊𝖞𝕻𝖆𝖎𝖗.𝖌𝖊𝖙𝕾𝖊𝖈𝖔𝖓𝖉());
}

atomic swift
tender shard
#
@𝕹𝕸𝕾("1.16.2")
    𝖕𝖚𝖇𝖑𝖎𝖈 𝕹𝖆𝖒𝖊𝖘𝖕𝖆𝖈𝖊𝖉𝕶𝖊𝖞 𝖌𝖊𝖙𝕭𝖎𝖔𝖒𝖊𝕹𝖆𝖒𝖊𝖘𝖕𝖆𝖈𝖊𝖉𝕶𝖊𝖞(@𝕹𝖔𝖓𝖓𝖚𝖑𝖑 𝖋𝖎𝖓𝖆𝖑 𝕷𝖔𝖈𝖆𝖙𝖎𝖔𝖓 𝖑𝖔𝖈𝖆𝖙𝖎𝖔𝖓) {
        𝖋𝖎𝖓𝖆𝖑 𝕻𝖆𝖎𝖗<𝕾𝖙𝖗𝖎𝖓𝖌, 𝕾𝖙𝖗𝖎𝖓𝖌> 𝖐𝖊𝖞𝕻𝖆𝖎𝖗 = 𝕵𝖊𝖋𝖋𝕷𝖎𝖇.𝖌𝖊𝖙𝕹𝕸𝕾𝕳𝖆𝖓𝖉𝖑𝖊𝖗().𝖌𝖊𝖙𝕭𝖎𝖔𝖒𝖊𝕹𝖆𝖒𝖊(𝖑𝖔𝖈𝖆𝖙𝖎𝖔𝖓);
        𝖗𝖊𝖙𝖚𝖗𝖓 𝕹𝖆𝖒𝖊𝖘𝖕𝖆𝖈𝖊𝖉𝕶𝖊𝖞.𝖋𝖗𝖔𝖒𝕾𝖙𝖗𝖎𝖓𝖌(𝖐𝖊𝖞𝕻𝖆𝖎𝖗.𝖌𝖊𝖙𝕱𝖎𝖗𝖘𝖙() + ":" + 𝖐𝖊𝖞𝕻𝖆𝖎𝖗.𝖌𝖊𝖙𝕾𝖊𝖈𝖔𝖓𝖉());
    }
atomic swift
#

NOOOOOOOO

tender shard
#

i love it

atomic swift
tender shard
atomic swift
#

idk at this point

#
🅿🆄🅱🅻🅸🅲 🆂🆃🅰🆃🅸🅲 🆂🆃🆁🅸🅽🅶 🆃🅾🆁🅴🅰🅳🅰🅱🅻🅴🆂🆃🆁🅸🅽🅶(🅴🅽🆄🅼<?> 🅴) {
        🅲🅷🅰🆁[] 🅲🅷🅰🆁🆂 = 🅴.🅽🅰🅼🅴().🆃🅾🅻🅾🆆🅴🆁🅲🅰🆂🅴().🆁🅴🅿🅻🅰🅲🅴("_", " ").🆃🅾🅲🅷🅰🆁🅰🆁🆁🅰🆈();
        🅱🅾🅾🅻🅴🅰🅽 🅵🅾🆄🅽🅳 = 🅵🅰🅻🆂🅴;
        🅵🅾🆁 (🅸🅽🆃 🅸 = 0; 🅸 < 🅲🅷🅰🆁🆂.🅻🅴🅽🅶🆃🅷; 🅸++) {
            🅸🅵 (!🅵🅾🆄🅽🅳 && 🅲🅷🅰🆁🅰🅲🆃🅴🆁.🅸🆂🅻🅴🆃🆃🅴🆁(🅲🅷🅰🆁🆂[🅸])) {
                🅲🅷🅰🆁🆂[🅸] = 🅲🅷🅰🆁🅰🅲🆃🅴🆁.🆃🅾🆄🅿🅿🅴🆁🅲🅰🆂🅴(🅲🅷🅰🆁🆂[🅸]);
                🅵🅾🆄🅽🅳 = 🆃🆁🆄🅴;
            } 🅴🅻🆂🅴 🅸🅵 (🅲🅷🅰🆁🅰🅲🆃🅴🆁.🅸🆂🆆🅷🅸🆃🅴🆂🅿🅰🅲🅴(🅲🅷🅰🆁🆂[🅸])) {
                🅵🅾🆄🅽🅳 = 🅵🅰🅻🆂🅴;
            }
        }

        🆁🅴🆃🆄🆁🅽 🆂🆃🆁🅸🅽🅶.🆅🅰🅻🆄🅴🅾🅵(🅲🅷🅰🆁🆂);
    }

tender shard
#

but I can use funny symbols without any website, äfter äll I äm Germän

atomic swift
#

im american

#

hamburbur

tender shard
#

chicken wing

atomic swift
#

W♂▬▐☻♀

tender shard
#

cock

#

whut

atomic swift
#

~~```java
p♥u♥b♥l♥i♥c♥ ♥s♥t♥a♥t♥i♥c♥ ♥S♥t♥r♥i♥n♥g♥ ♥t♥o♥R♥e♥a♥d♥a♥b♥l♥e♥S♥t♥r♥i♥n♥g♥(♥E♥n♥u♥m♥<♥?♥>♥ ♥e♥)♥ ♥{♥
♥ ♥ ♥ ♥ ♥ ♥ ♥ ♥ ♥c♥h♥a♥r♥[♥]♥ ♥c♥h♥a♥r♥s♥ ♥=♥ ♥e♥.♥n♥a♥m♥e♥(♥)♥.♥t♥o♥L♥o♥w♥e♥r♥C♥a♥s♥e♥(♥)♥.♥r♥e♥p♥l♥a♥c♥e♥(♥"♥_♥"♥,♥ ♥"♥ ♥"♥)♥.♥t♥o♥C♥h♥a♥r♥A♥r♥r♥a♥y♥(♥)♥;♥
♥ ♥ ♥ ♥ ♥ ♥ ♥ ♥ ♥b♥o♥o♥l♥e♥a♥n♥ ♥f♥o♥u♥n♥d♥ ♥=♥ ♥f♥a♥l♥s♥e♥;♥
♥ ♥ ♥ ♥ ♥ ♥ ♥ ♥ ♥f♥o♥r♥ ♥(♥i♥n♥t♥ ♥i♥ ♥=♥ ♥0♥;♥ ♥i♥ ♥<♥ ♥c♥h♥a♥r♥s♥.♥l♥e♥n♥g♥t♥h♥;♥ ♥i♥+♥+♥)♥ ♥{♥
♥ ♥ ♥ ♥ ♥ ♥ ♥ ♥ ♥ ♥ ♥ ♥ ♥i♥f♥ ♥(♥!♥f♥o♥u♥n♥d♥ ♥&♥&♥ ♥C♥h♥a♥r♥a♥c♥t♥e♥r♥.♥i♥s♥L♥e♥t♥t♥e♥r♥(♥c♥h♥a♥r♥s♥[♥i♥]♥)♥)♥ ♥{♥
♥ ♥ ♥ ♥ ♥ ♥ ♥ ♥ ♥ ♥ ♥ ♥ ♥ ♥ ♥ ♥ ♥c♥h♥a♥r♥s♥[♥i♥]♥ ♥=♥ ♥C♥h♥a♥r♥a♥c♥t♥e♥r♥.♥t♥o♥U♥p♥p♥e♥r♥C♥a♥s♥e♥(♥c♥h♥a♥r♥s♥[♥i♥]♥)♥;♥
♥ ♥ ♥ ♥ ♥ ♥ ♥ ♥ ♥ ♥ ♥ ♥ ♥ ♥ ♥ ♥ ♥f♥o♥u♥n♥d♥ ♥=♥ ♥t♥r♥u♥e♥;♥
♥ ♥ ♥ ♥ ♥ ♥ ♥ ♥ ♥ ♥ ♥ ♥ ♥}♥ ♥e♥l♥s♥e♥ ♥i♥f♥ ♥(♥C♥h♥a♥r♥a♥c♥t♥e♥r♥.♥i♥s♥W♥h♥i♥t♥e♥s♥p♥a♥c♥e♥(♥c♥h♥a♥r♥s♥[♥i♥]♥)♥)♥ ♥{♥
♥ ♥ ♥ ♥ ♥ ♥ ♥ ♥ ♥ ♥ ♥ ♥ ♥ ♥ ♥ ♥ ♥f♥o♥u♥n♥d♥ ♥=♥ ♥f♥a♥l♥s♥e♥;♥
♥ ♥ ♥ ♥ ♥ ♥ ♥ ♥ ♥ ♥ ♥ ♥ ♥}♥
♥ ♥ ♥ ♥ ♥ ♥ ♥ ♥ ♥}♥

♥ ♥ ♥ ♥ ♥ ♥ ♥ ♥ ♥r♥e♥t♥u♥r♥n♥ ♥S♥t♥r♥i♥n♥g♥.♥v♥a♥l♥u♥e♥O♥f♥(♥c♥h♥a♥r♥s♥)♥;♥
♥ ♥ ♥ ♥ ♥}

#

#

why not when you stop for the night start a mini project with what you learned

hazy parrot
#

That is good, for me personally it's always easier to just learn trough projects

#

Not really, most things I do are open source

tender shard
#

kinda

#

but it's not very much

#

maybe 100e per day

#

#

depends, my normal job pays better

#

in newer java versions, yes

#

in older versions, no

hazy parrot
#

You can in older too

#

Just c style syntax

tender shard
#

well, not really

#
switch("My String") {
  case "My String":
  case "Another String":
    // These are two separate cases
hazy parrot
#
switch(c) {
  case 'A':
  case 'B':
        sout("A or B");
        break;
  case 'C':
        sout("C");
        break;
}
tender shard
#

yeah that's two separate cases that just happen to run the same code

hazy parrot
#

but end-result is same, isn't it ?

tender shard
#

yeah that is true

hazy parrot
#

anyway, it looks much better in newer versions

#

not really, i think that wont even compile

#
switch (material) {
  case anvil, cauldron -> {
    //some code, newer versions
  }
}
tender shard
hazy parrot
#

yeah because its day 4, if it was day 3, it will be wrong

#

it would print both its day three and its day four

#

if using standard : syntax, you need to have break after every case

#

but if using enchanted switches in newer versions, you dont need break

tender shard
#

enchanted lmao

#

it's called "enhanced" 😛

hazy parrot
#

smh i always trough its enchanted

#

like better

#

😄

tender shard
#

the anvil does the same thing as cauldron

#

because there's no "break"

#

oh

#

I should have added a break after the first sout

#

yeah

#

wtf

#

I lost my old macbook

#

where the fuck is it

#

it used to be on the couch yesterday but now it's gone lol

#

Why the heck does my mac wanna boot to windows lol

worldly ingot
# tender shard

Just as a side note, I seriously advise against Material switches

#

You're going to add ~100kb of code to each file that uses it

rotund tartan
#

how do I hide the color code symbols from the text?

#

it just shows the Item as &2itemname

wet breach
#

Need to use translateAlternateColorCodes("&", string here);. To automatically convert to a color code

rotund tartan
#

ohhh

#

ty

delicate obsidian
#

how do I set custom name of a nms entity?

tender shard
#

wdym

#

I mean, yeah, switches over material should be avoided because it'll "soon" not be an enum anymore anyway. but wdym with it adding 100kb of code?

worldly ingot
#

Compile that snippet you sent and look at the size of the .class file

dry yacht
tender shard
#

will do, 1 sec pls

worldly ingot
#

Switches work by generating an array at compile time populated with all the constants ordered by their ordinal. The bytecode generated for the getter is horrendously large and effectively generates a block of code for each possible entry

#

This commit alone shaved off 2MB from the final Spigot jar

tender shard
#

I think you must be confusing sth

worldly ingot
#

This is the bytecode generated in CraftMetaLeatherArmor

tender shard
#

but how does that relate to plugins that merely compile against spigot?

worldly ingot
#

because all that was generated just by using a switch statement over Material

#

It may just be the Eclipse compiler that Bukkit/CraftBukkit uses, but still worth avoiding switches over large enums

#

(notice in that screenshot I'm at line like 9000 and the scrollbar still isn't even half way down lol)

#

See the size of a good chunk of those files. They're all because of a switch statement

tender shard
#

hm weird. If I compile using maven, the .jar is only 4kb

#

check it out

worldly ingot
dry yacht
#

That has to be a compiler-bug, it's just stupid to call ordinal at runtime, as it's a compile time known constant which cannot be changed at runtime.

tender shard
worldly ingot
#

That has to be a compiler-bug
Again, could be an Eclipse compiler-specific thing done for performance reasons

tender shard
#

maybe, idk. I use the default maven-compiler plugin, not the eclipse one

#

anyway, I'll throw myself into the bath tub now lol

dry yacht
#

For performance reasons? Isn't the highest performance you'll ever get accomplished by inlining the constant ordinal values into the lookupswitch? This looks like a serious bug to me.

#

I totally get why you say what you said and I am happy that you brought this topic up, but I don't think it's good to discourage people from using switches on big enumerations, only because that one compiler messed up.

worldly ingot
#

Realistically you should avoid switches unless you're explicitly making use of fall-through statements anyways

#

Otherwise you'll get some nicer-looking/more compact code using either a Map or if/else if

tender shard
#

Switches are usually extremely fast, otherwise allatori etc wouldnt use them

worldly ingot
trail lintel
#

What is the recommended way to handle "per player config"? Should I embed an H2 instance? Does the spigot API provide something to achieve this? Thanks in advance guys, you all have been super helpful.

tender shard
trail lintel
#

No need for offline data, lemme check out pdc =]

tender shard
#

?pdc

river oracle
#

Fucker beat me too it

tender shard
#

I am awesome

river oracle
#

Only awesome when u have your jäger

tender shard
#

I am mcdonalds fries

#

You are burger king fries

river oracle
#

Nah mf I am Culver's fries

#

Only Midwestern individuals understand

tender shard
#

I dont know that