#help-development

1 messages Ā· Page 986 of 1

slender elbow
#

_ alone is also gonna be legal as unnamed variable identifier

#

there's a proposal somewhere

worldly ingot
#

Waiting for Java's introduction of it šŸ¤ž

tardy mist
#

But it isn't valid, it is ill-formed

worldly ingot
#

Oh wait it's in 22

#

lmao

tardy mist
#

Just compile it and see

slender elbow
#

the program very much compiles

young knoll
worldly ingot
#

You don't count >:(

young knoll
#

I can count to at least 7

remote swallow
#

Wait coll cant count?

winter cradle
#

$ is supported as an extension by all compilers

echo basalt
#

For something non-enterprise this is good

#

If you want to go crazy and overengineer I'd make an account provider thing

worldly ingot
#

The only reason your C++ snippet won't compile is because the lambda doesn't return a pointer, but stick a return 0 inside the {} and you're good

remote swallow
#

Fizzbuzz

tranquil glen
worldly ingot
#

Or use a different compiler that defaults to a return 0 and it'd probably be fine too

#

Threw it into an online compiler, works fine

#

So

#

ĀÆ_(惄)_/ĀÆ

echo basalt
worldly ingot
#

inb4 Janitor account

tranquil glen
#

lol

slender elbow
#

bro hasn't ever heard of lambdas and thinks I don't know basics

remote swallow
slender elbow
#

this is baffling

tranquil glen
#

yeah maybe an admin account too

echo basalt
#

What you can do instead is some kind of account registry, where you match characters / inputs to new accounts depending on the input

river oracle
young knoll
#

My brain is trying to comprehend what that code actually does

slender elbow
#

I just did and it does :)

worldly ingot
river oracle
tranquil glen
worldly ingot
#

COMPILE HARDER >:((((

river oracle
#

COMPILE HARDER IT WILL BREAK

tardy mist
remote swallow
#

Can i compile hou

#

You

slender elbow
#

lmao

remote swallow
#

I want my own choco

river oracle
young knoll
#

It’s an int named _ that’s assigned to be… something

river oracle
#

G++ is where its at

worldly ingot
#

Nats I showed you it compiled above D:

slender elbow
echo basalt
remote swallow
echo basalt
#

I assume you know the basics of what an interface is, given you have a User one

tranquil glen
#

ohhh okay i think i see what you're saying

echo basalt
#

What if you made an interface that's responsible for creating users

remote swallow
#

Sorry M++#++Ɨ#-++#

echo basalt
#

So the implementation for Student just creates a new student

#

Etc

river oracle
tranquil glen
#

actually i didnt use an interface šŸ˜…
but thanks for bringing that up cuz that would make a lot more sense

echo basalt
worldly ingot
#

Yeah I compiled it with gcc and you don't need the return statement :p I figured it was a compiler thing

tranquil glen
#

what i did was actually User is an object, and student/librarian extends it

echo basalt
#

It's still inheritance, works the same

#

Let's start with something basic

slender elbow
#

compiled with clang and it builds fine

worldly ingot
#

I was just using a shitty online compiler so it's probably using some off the shelf one

#

Or maybe an out of date compiler

echo basalt
#
public interface UserFactory {

  User createUser();

}
young knoll
#

What’s gcc stand for

worldly ingot
#

gcc just warns instead of errors out so it might fail if you were more strict on it, but even still, all you need is a return in there

young knoll
#

Garbage collector collector?

remote swallow
#

Google code compiler

worldly ingot
#

Sure

#

No, it's the GNU Compiler Collection :p

#

Good guess though

remote swallow
#

I was close

#

Totally

slender elbow
#
āžœ  ~ cat test.cc
int main() {
  typedef int $;
  $ _ = ~!+[]()->$*{}();
  return 0;
}
āžœ  ~ clang++ test.cc -o out.a
test.cc:3:21: warning: non-void lambda does not return a value [-Wreturn-type]
    3 |   $ _ = ~!+[]()->$*{}();
      |                     ^
1 warning generated.
āžœ  ~

šŸ’Ŗ

tardy mist
#

Thats why I love C++ ā™„ļø

slender elbow
#

go learn lambdas

worldly ingot
#

Warnings are for losers

#

We ignore warnings here šŸ˜Ž

slender elbow
#

suits me

echo basalt
#

throwback to when I got a forum warning from choco

#

loser

worldly ingot
#

Probably deserved it

tranquil glen
echo basalt
#

I said skript was for babies and I still stand by that opinion

remote swallow
worldly ingot
#

Now if you'll excuse me... I'm going to get a cotton candy blizzard PES3_IgnoreMusic

echo basalt
young knoll
#

Order me one too

echo basalt
#

Whose implementation returns an instance of that account

tardy mist
storm crystal
#

I dont really remember how the situation was with Java versions in spigot plugins, would JDK 21 suffice or should I downgrade to 17?

tardy mist
#

1 mistake in my lifeee

remote swallow
storm crystal
#

I barely remember some compatibility issues but its very vague

echo basalt
#

Java has this neat thing called lambdas, they're basically short interface implementations

young knoll
#

17 is all you need for the api

#

For NMS 1.20.6 you need 21

storm crystal
#

alright ill just use 21 then

echo basalt
#
public class StudentUserFactory implements UserFactory {

  @Override
  public User createUser() {
    return new Student();
  }
}

can also be represented as

() -> new Student()
or
Student::new

remote swallow
#

Im surprised that @eternal night music choice is actually good

eternal night
#

the fuck

echo basalt
#

So what if we made something like

Map<String, UserFactory> userFactories = Map.of(
  "S", Student::new,
  "L", Librarian::new,
  "A", Admin::new,
  "J", Janitor::new
);
...
eternal night
young knoll
#

Lynx supports removing craftbukkit relocation and using mojmap at runtime

#

#exposed

echo basalt
#

And that way we can grab the correct user factory based on the user's input and create the user without caring about implementation details

tranquil glen
#

But why use a userfactory instead of just creating a new "Librarian" or new "Student"

river oracle
#

šŸ’Ŗ

echo basalt
young knoll
#

Does MD support it

eternal night
echo basalt
#

The user factory does exactly that, creates a user every time you call the method

young knoll
#

Aka did Y2K just say MDs IQ is below room temperature

echo basalt
#

The implementation of UserFactory is what decides on what kind of user is created

tranquil glen
#

Could you help me see this implemented into the rest of the code?

#

If it isnt too much to ask

river oracle
echo basalt
#

Sure, let's create some kind of class responsible for creating users

#

Where we toss our map and all of that

tranquil glen
#

Okay, do you want to see my original user class?

echo basalt
#

No need

young knoll
#

Although tbf summer just ended in Australia so room temperature was probably pretty high

river oracle
#

lets post my spigot stats before I get banned like. Amount of fuck's said times warned by staff etc

young knoll
#

Well ā€œjust endedā€

echo basalt
#
public class UserManager {

  private final Map<String, UserFactory> factories = Map.of(
    "L", Librarian::new,
    "S", Student::new
  };

  @Nullable
  public User createUser(String input) {
    if(input == null || input.isEmpty()) {
      return null;
    }

    String start = input.substring(0, 1).toUpperCase(Locale.ROOT);
    UserFactory factory = this.factories.get(start);

    if(factory == null) { // Invalid input
      return null;
    }

    return factory.createUser();
  }
}
#

I'd recommend using some kind of user type enum or string instead of this but whatever

#

If you don't care about expandability or hooking in 3rd party users you can skip this and replace with an enum, something like

public enum UserType {

  LIBRARIAN("L", Librarian::new),
  STUDENT("S", Student::new),
  ;

  private final String label;
  private final UserFactory factory;

  UserType(String label, UserFactory factory) {
    this.label = label;
    this.factory = factory;
  }

  public User createUser() {
    return this.factory.createUser();
  }

  public static UserType getByLabel(String input) {
    // pretty much same as above
  }
}
#

With the top approach you just call userManager.createUser and if it's null the input is invalid

#

With the bottom approach you call UserType.getByLabel and if that's not null you then call createUser

#

Both are valid options, one is open and expandable and the other one is a bit tidier

tranquil glen
#

Which one would you consider more expandable?

#

They both seem kinda expandable

echo basalt
#

Top approach, but it needs more work

#

Bottom approach is expandable in the sense you can add more users

#

Top approach is expandable in the sense where you can have 3rd party programs add their user types by just registering a factory

#

You can't extend enums, but you can add to maps

tranquil glen
#

ohhh i see

#

enum is a bit more hardcoded

#

?

echo basalt
#

Yeah

tranquil glen
#

okay, i definitely have a lot of studying to do

young knoll
#

Well teeeeecnically

tranquil glen
#

it's still a bit confusing to me, but i'm starting to see the picture you're laying out

#

thank you!

river oracle
#

He's picking up what you're putting down

forest shuttle
#

Hi, anyone knows how can I fire a EntityChangeBlockEvent? I made a custom nms entity that can change/break blocks. Using block.setType(Material.AIR) works but doesn't call any event so plugins that log those types of event (like coreprotect) miss the interaction.
I saw the in the javadocs that it can be called like EntityChangeBlockEvent(Entity what, Block block,BlockData to) but I don't quite get how I could create a blockdata for a block when it is converting to AIR (being broken).

young knoll
#

Material.AIR#createBlockData

#

Or you do it with the previous block, don’t remember which it is

forest shuttle
#

Yeah it seems to be like that, but now:

#

block.setblockdata?

#

Sorry this may be obvious to you guys but it's my first time firing events...

young knoll
#

Just do whatever

#

You’ve already handled the event

blazing flare
#

How would you add food data to an item that isn't a food item?

young knoll
#

I don’t think said event has any mutable properties

#

There’s api for it now

#

ItemMeta has a get, set, and hasFood

blazing flare
#

Oh I see, getFood() will create a new CraftFoodComponent with empty FoodProperties if it doesn't exist. Was looking to create a FoodComponent and pass it into setFood lol

storm crystal
#

I dont know how much of an apropiate it is to ask for help here, but I have some big problems with my IDE on Linux

rough ibex
#

flatpak or snap

storm crystal
#

yay

rough ibex
#

and if you do restart it?

storm crystal
#

Tried restarting os, IDE, updating both

rough ibex
#

can IDEA make any new projects

#

ie. it can write in its own config

storm crystal
#

Yes

rough ibex
#

do these errors pop up elsewhere

storm crystal
#

Every few seconds

storm crystal
rough ibex
#

are there any plugin updates

eternal oxide
#

Has this IDE install ever worked?

heady iris
#

is it possible to bundle a datapack inside of a plugin?

worldly ingot
#

No. Would be neat, but no

heady iris
river oracle
#

data packs load before plugins

heady iris
river oracle
#

when it comes to the server plugins are pretty much the last thing to load up

young knoll
#

Yeah you have to deploy it and then either reload the datapacks, or for anything that can’t be reloaded you have to restart the server

heady iris
#

imma see if /datapack enable works

young knoll
#

Depends what is in it

#

Recipes, advancements, etc are āœ…

#

Biomes, structures, anything worldgen really are āŒ

heady iris
#

it runs the load function

#

and this particiular datapack doesnt do worldgen stuff

#

so it works :)

young knoll
#

At that point though there should be api for it

#

Well, I guess not for some stuff

river oracle
#

what stuff can datapacks do plugins can't

worldly ingot
#

Basically interacting with the registries

#

Registering custom biomes, for one

#

Plugins load way too late to be registering custom biomes

eternal oxide
#

do it in teh plugins onLoad method

young knoll
#

Still too late

#

Unless you unfreeze the registry

eternal oxide
#

true

young knoll
#

There’s very little you can’t do in a plugin with enough effort

heady iris
young knoll
#

Although java is working to change that :c

river oracle
young knoll
#

When you PR it

heady iris
#

even datapacks allow you to specify to load before/after each other

eternal oxide
#

It has stages, just not the ones you want

#

onLoad, onEnable, loadBefore and loadAfter

heady iris
#

yeah, im talking about loading before/after certain parts of the server load

worldly ingot
#

It would need to be loaded before the plugin's code loads

young knoll
#

Just load the plugins code earlier

#

Duh

plucky rock
#
    private static void createNine() {
        ItemStack Nine2 = new ItemStack(Material.STICK);
        ItemMeta meta = Nine2.getItemMeta();
        meta.setDisplayName("§5Nine");
        Nine2.setItemMeta(meta);

        List<String> Desc = new ArrayList<>();
        Desc.add("§7I got a new Stick");

        List<String> Abil = new ArrayList<>();
        Abil.add("§dSTICKS §5[§dRight Click§5]");
        Abil.add("  §7Get a Stick");

        ItemStack item;
        item = ItemMaker(Nine2, 10D, 0D, 315D, 1D, 0.1,EquipmentSlot.HAND, false, Desc, Abil);
        Nine = item;

        ShapedRecipe SR =new ShapedRecipe(NamespacedKey.minecraft("Nine"), item);
        SR.shape("SSS",
                 "SNS",
                 "SSS");
        SR.setIngredient('S',Material.STICK);
        SR.setIngredient('N',Material.NETHER_STAR);
        Bukkit.getServer().addRecipe(SR);


    }```
any1 know why the recipie doesn't work liek the item doesnt craft
fierce whale
#

Is there way to deep copy Map<String, Obejct>?

plucky rock
heady iris
lilac dagger
shadow night
#

Can't you do shit like new HashMap<>(oldMap)

lilac dagger
#

it's not a deep copy

#

it's a shallow copy

shadow night
#

Ah

#

Gimme a sec

lilac dagger
#

this one seems the best

#

just don't use the type token

shadow night
#

That's an interesting way to do that

lilac dagger
#

use instead of it originalMap.getClass();

#

yeah well gson actually makes a copy for all

shadow night
#

Wait, wtf is {}.getType()

lilac dagger
#

it's a fancy gson thing to infer the generic type of an object

shadow night
#

Ah okay

quaint mantle
#

any dev that wanna work voluntary please dm me

trim lake
#

Is they way to check when bee fill up beehive? I was looking for event or smtn and cannot find anything.

tardy delta
#

?services

undone axleBOT
valid burrow
trim lake
#

Its looks like when ever bee enter the hive with nectar it will change honey level so its solved, thanks. I basicly will change bees whole system. So I need only detect if bee add honey or not and I should be able to do that rn

inner mulch
#

And check the level

#

The Event has to have a block, right?

tardy delta
#

blockstate

trim lake
#

Yea, but seams like it will have already modified block

inner mulch
#

Just gethoneylevel- 1?

#

Bees can only add 1 to the level or am i wrong

trim lake
#

Ye, that will do probably. Or just check if entyti have nectar and if ye, do what I need to do. If nop it should not change the honey level. That would make sens, hopefully

tender shard
#

hi all

trim lake
#

I will figurate out now what I need thats oke. Thanks guys.

tender shard
#

anyone knows if 1.20.6 contains "obfuscation" changes compared to 1.20.5?

trim lake
#

Btw. what is best practice to set inventoryHolder when creating custom inventory? I guess null will be better?

tender shard
#

do NOT create custom inventory holders

#

so, use null

#

InventoryHolder interface is not meant to be implemented by plugins

trim lake
#

Im making it this way. Is that wrong<

public abstract class PluginMenu implements InventoryHolder {

    protected RealJobs plugin;
    protected Inventory inv;
    protected PlayerMenuUtility pMenuUtil;
    protected Player owner;

    protected ItemStack grayGlass;

    public PluginMenu(RealJobs plugin, Player player) {
        this.plugin = plugin;
        this.pMenuUtil = plugin.getPlayerMenuUtility(player);
        this.owner = pMenuUtil.getOwner();
        this.grayGlass = new ItemBuilder(plugin, Material.GRAY_STAINED_GLASS_PANE).name(" ").make();
        this.inv = Bukkit.createInventory(null, getRows()*9, TextUtils.format(getTitle()));
    }
    
    public abstract String getTitle();
    public abstract int getRows();
    public abstract void setMenuItems();

    public abstract void handleMenu(InventoryClickEvent event);
    
    public void open(Player player) {
        setMenuItems();
        player.openInventory(inv);
    }

    
    @Override
    public Inventory getInventory() {
        return inv;
    }
    
}
tender shard
#

if it works, it works ĀÆ_(惄)_/ĀÆ

trim lake
#

oh, I get it. there is probably still not better way then implements InventoryHolder anyway

trim lake
#

thanks guys

tender shard
#

in those case, you should just save your own created inventories inside a List / Map / whatever and check if it contains(...) the currently checked instance

#

if you wanna save additional details for each inv, you could e.g. just use a Map<Inventory,YourAdditionalInventoryDataClass>

trim lake
#

Yea, bcs Im basicly opening another inventory while chest is opened to change title of it. So I want to detect if it is rly chest or its custom inventory. I just added chceck when InventoryHolder is null not open that modified title inventory. There could be problem with some other plugins when I will just add that holder as custom inventory or smtn. But most of plugins will be custom anyway so will use null, so should be good

trim lake
#

or this looks like solution as well, lol:

    public static boolean isCustomInventory(Inventory inventory) {
        return inventory.getHolder() == null || !inventory.getHolder().getClass().getPackageName().startsWith("org.bukkit.");
    }
umbral berry
#

Hi, I am running under this exception when I try to install buildtools with version 1.8.8:
https://hastebin.skyra.pw/docarobeva.yaml

<3>WSL (9) ERROR: CreateProcessParseCommon:711: Failed to translate C:\Users\natha\dev\minecraft\BuildTools\Spigot
<3>WSL (9) ERROR: CreateProcessParseCommon:757: getpwuid(0) failed 2
copper coyote
#

Dk if this is the right place, but can anyone give me some resources or directions to learn anticheat development?

drowsy helm
remote swallow
#

Someone did a forum thread about this and iirc you are recreating the whole inventory twice here

stiff sonnet
#

does anyone know a good way to determine the closest world direction (as in east, ... - a vector would also suffice) the player is looking in?

valid burrow
#

thats just simple math isnt it?

#

just get the yaw

stiff sonnet
#

I don't wanna do the yaw comparison if statements four times

valid burrow
#

but that would probably be the most efficent way xd

stiff sonnet
#

something that might work is dividing the yaw by 90 and rounding taht down to get 0-3 for all four cardinal directions

valid burrow
#

sure u can do that too

#

but i feel like that would be way slower

#

i mean

#

it prolly doesnt matter cause both should be very fast

stiff sonnet
#

the alternative is

if (py >= 0 && py < 90 {
} else if (py >= 90 && < 180) {
...
#

ugly as hell

valid burrow
#

i dont think so

#

slap it in a util method and youre good to go

valid burrow
stiff sonnet
#

because I won't use this again

ruby sable
# stiff sonnet I don't wanna do the yaw comparison if statements four times

I see you doing a lot of really insignificant micro-optimisations, e.g. yesterday you were asking how to check a distance without doing square roots because square roots are "slow" (aka a few nanoseconds), it sounds as though you would get a lot more done by not thinking so much about tiny things like this.

#

if you wanna do it better for the hell of it sure no problem but just seems unecessary otherwise

stiff sonnet
#

read that shit it's ugly as hell

ruby sable
#

same idea, micro-optimisation or the fact that your if-else statements are 'ugly'

stiff sonnet
#

and 100 inefficient lines of code quickly add up

#

I already have a few slow spots

lilac dagger
#

You can't really rotate otherwise

#

If you want you can have an enum

#

And multiply using the enun

#

Have like EAST(1, -1

stiff sonnet
#

at this point it just seems unnecessary to add any complicated data type anywhere just for this one case

#

I'm just gonna leave it, knowing well that I will never touch that again

lilac dagger
#

And then x * direction. Get x

#

Vector has rotations

#

Rotate aroundy

dawn flower
#
[12:46:11 WARN]: Horse (vehicle of dsfdfs) moved too quickly! -60.44958636915428,0.5,-9.90624406607077
[12:46:11 WARN]: Horse (vehicle of dsfdfs) moved too quickly! -60.44958636915428,0.4231679985046384,-9.90624406607077```
can this bypassed when messing with ``Move Vehicle`` packet
dawn flower
#

basically faking a packet so it teleports the vehicle without yoinking the passengers

stiff sonnet
#

wait are you doing that clientside or something?

dawn flower
#

no

#

serverside

stiff sonnet
#

if you just send the client the packet without updating the position on the server that will happen

#

that's just how it works

dawn flower
#

dawg

#

it works if im close to the location

#

however if im too far it does that

stiff sonnet
#

because minecraft accounts for lag and stuff

dawn flower
#

that isnt minecraft's fault

#

that's from bukkit/spigot

#

the client handled it

#

((CraftPlayer)e.getPlayer()).getHandle().playerConnection.checkMovement = false; i found this

stiff sonnet
dawn flower
#

long story short i need nms

stiff sonnet
dawn flower
#

since i cant just disable it serverwide

#

unless i send like 4 move packets

#

this will greatly extend my limit without disabling it

inner mulch
#

is there any1 using redisson, that knows, why i cant set my RLiveObject inside of RLiveObject to null? The field doesnt set null :(

eternal oxide
dawn flower
#

it's like 10 according to my spigot.yml

eternal oxide
#

8 is the limit before it expects a teleport

dawn flower
#

im trying to split it into parts

eternal oxide
#

yep, extrapolate the movement

dawn flower
#

but i need to delay each packet, idk how much to delay it tho

eternal oxide
#

actually, what exactly are you doing? as it seems you may not even need a Bukkit Entity

dawn flower
#

block the entity from entering certain areas

#

and teleport the entity sometimes

#

lets fucking go

#

i did it but it aint no smooth

arctic monolith
#

Hi, is there a way to disable the red numbers in the scoreboard in 1.8?

arctic monolith
# dawn flower no

OK. and would it be possible to make an order that like openurl example /shop and that brings it back to my shop

warm mica
dawn flower
#

screw vehicles

trim lake
#

Why Im getting false? Block is BeeHive Im sure about that:

package me.marek2810.realjobs.events.listeners;

import org.bukkit.block.data.type.Beehive;
import org.bukkit.entity.Bee;
import org.bukkit.entity.Entity;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.entity.EntityEnterBlockEvent;

public class BeeHiveListener implements Listener {

    @EventHandler
    public void onBlockEnter(EntityEnterBlockEvent event) {
        Entity entity = event.getEntity();
        System.out.println(event.getBlock());
        if (!(entity instanceof Bee bee)) return;
        System.out.println("? " + (event.getBlock().getState() instanceof Beehive));
    }

}
slender elbow
#

wrong Beehive import

#

the beehive BlockState is org.bukkit.block.Beehive, not org.bukkit.block.data.type.Beehive

trim lake
#

hmm, but I cant get honez level from that org.bukkit.block.data.type.Beehive import, so I will need to get state and cast it to second import

young knoll
#

getBlockData then

trail coral
#

how would i make enchant glint dissapear on armor without removing the enchants? for example im wearing an armor thats all enchanted and i can see the glint, but other players wont see the enchantment glint. I know its possible with some packets magic

young knoll
#

Clear the enchantments for the packet being sent to other players

slender elbow
#

enchantment_glint_override 😌

trail coral
#

elaborate please

trim lake
inner mulch
young knoll
#

What’s there to elaborate on

#

If the packet is being sent to a player other then the one wearing the armor

#

Clear all enchantments

slender elbow
# inner mulch whats that?

1.20.5 added the ability to show/hide enchantment glint regardless of whether the item has enchantments or not

slender elbow
inner mulch
slender elbow
#

wdym "the component system too"?

inner mulch
#

item components

slender elbow
#

yeah mojang moved away from representing itemstacks in memory as nbt and they moved to item components

trail coral
young knoll
#

Uhh

trail coral
#

is there a packetsendevent or something?

young knoll
#

No

trail coral
#

i suck with packets

young knoll
#

Use a library like packetevents

trail coral
#

hmmm

inner mulch
#

or use 1.20.5

#

then u can disable that without packets

young knoll
#

Well yeah but it would disable it for the player wearing it too

trim lake
slender elbow
#

looks good

dawn flower
#

can u hide player to a player without removing them from the tablist

#

and without invisibility

inner mulch
dawn flower
#

how do u add someone to the tab list

inner mulch
#

with packets, maybe there is even api

dawn flower
#

that seems more complicated than just manually hiding the armor and considering the fact that using that method would most likely not be compatible with most plugins

glass raven
#

only way to understand NMS is decompiling spigot jar and reading?

#

afaik there’s no javadoc

dawn flower
#

yeah

#

read remapped one to understand better

#

?nms

trail coral
#

but the plugin is on 1.16.5

dawn flower
#

can u disbale camel dashing

#

without having a one tick timer that loops all camels...

glass raven
dawn flower
#

??

young knoll
#

lol who’s gonna write a javadoc for something that isn’t api

dawn flower
#

u can have fun reading aa, ab, ac fields

glass raven
dawn flower
#

then the only option is remapping for it to make sense

#

nms isnt an api

glass raven
#

i mean remapping is good, but reading each class to understand what to do gives you suicidal vibes

dawn flower
#

almost all classes start with Craft in craftbukkit which is already a huge portion, some classes end with it not start

#

so just search what u need and look into it through intellij idea

trail coral
dawn flower
#

nms has hundreds of classes so reading all of them isn't really possible (unless u really hate urself) and some classes are thousands of lines like CraftPlayer which is alone 2k lines not including what it extends. u dont have to understand all of nms

eternal oxide
#

Avoid NMS at all costs. Always API unless there is no other way

dawn flower
#

or jsut use protocollib

#

using nms for something that isn't packets is just straight up dumb

trail coral
#

@eternal oxide do you know how i would remove enchantment glint from armor without removing its enchants? im in 1.16.5 tho

dawn flower
#

i know

#

PacketType.Play.Server.ENTITY_EQUIPMENT listen for this if u use protocollib and im not sure what the nms one is

eternal oxide
#

There is a tag you can add to hide enchantyment glow

storm crystal
#

I can't update my spigot using buildtools.jar

wet breach
wet breach
#

mostly just need to look at methods more then just every piece of code

dawn flower
wet breach
#

not by much

dawn flower
#

not all of it but some of it

#

so ur gonna reread nms every year or so

wet breach
#

some of us here have basically memorized the implementation of MC

wet breach
#

not hard to do if you know how to do code comparisons

dawn flower
#

or just read the part ur working with

#

if ur working with CraftPlayer for example why would you read something like CraftPaining

wet breach
#

or that, but that isn't what you stated earlier. In general yes that is all you really need to do in regards to what your project requires.

dawn flower
# trail coral thanks
Pair<EnumWrappers.ItemSlot, ItemStack> pair = packet.getSlotStackPairLists().read(0)
    .get(0);

EnumWrappers.ItemSlot slot = pair.getFirst();
ItemStack item = pair.getSecond().clone();

if (slot != EnumWrappers.ItemSlot.MAINHAND && slot != EnumWrappers.ItemSlot.OFFHAND) {
    item.editMeta(ItemMeta::removeEnchantments);
    pair.setSecond(item);
    packet.getSlotStackPairLists().write(0, Collections.singletonList(pair));
}```
something like this should work
#

oh god

viral wyvern
#

hi guys i have a big problem on spigotmc.org

I have the problem that files are larger or smaller than specified on the download button.
This means that some plugins have problems.
I also experienced that I downloaded a plugin that had the right name but suddenly a completely different plugin was on my server. e.g. TAB suddenly became ultimate shop

wet breach
trail coral
storm crystal
viral wyvern
wet breach
#

as for download size, they are never going to be exact due to rounding and os etc

dawn flower
#

if it's obfuscated just get rid of it

viral wyvern
#

some are 390kb and my only was 355kb

#

some are 596kb my was 612kb

eternal oxide
#

check your server startup log for any warnings or errors. Infections almost always show up as errors in the log

viral wyvern
#

tab on spigotmc was 600kb and then from polymart 1300kb the polymart version works correct

dawn flower
eternal oxide
#

?paste your server latest.log from startup

undone axleBOT
wet breach
dawn flower
#

wtf is a malicious ISP

grim hound
#

does anyone know how to transfer data from the kyori CompoundBinaryTag to packet event's NBTCompound? I've tried this, but nothing gets copied java public static NBTCompound transformToNBTCompound(CompoundBinaryTag kyori) throws IOException { ByteArrayDataOutput baos = ByteStreams.newDataOutput(); BinaryTagIO.writer().write(kyori, baos); NBTCompound nbt = new NBTCompound(); DefaultNBTSerializer.INSTANCE.serializeTag(baos, nbt); return nbt; }

wet breach
dawn flower
#

arent isps big companies

dawn flower
eternal oxide
dawn flower
#

they can be shitty and scam u but not malicious

viral wyvern
#

i test it on 2 pc and exact the same download size

wet breach
dawn flower
wet breach
#

some abuse that

viral wyvern
wet breach
#

because of this, they are free to essentially do what they want

dawn flower
#

anyways, can u stop camel dashing??

wet breach
#

camel dashing?

young knoll
#

They dash instead of jumping

#

Which allows them to cross gaps

wet breach
#

not sure what that has to do with me

#

but I suppose that is handy for the camels

dawn flower
#

im talking in general to anyone that knows how to stop camel dashing

#

camels are abit new so there arent any threads about that

viral wyvern
dawn flower
#

that prob means ur isp is malicious according to frostalf

viral wyvern
#

i dont infectet

dawn flower
#

whats ur main problem?

viral wyvern
#

that spigotmc side is buggi

#

i have only problems on this side

dawn flower
#

what's the problem

#

like the problem ur facing rn

viral wyvern
#

i download litefish with 355kb but the file is 390kb big and i also download litefarm and this two plugins give me a problem what was not before.
and after i ask the author of the plugins he give me the correct one with 390kb downloaded from spigotmc, now this working
and i download tab in the morning this was some other plugin with the name of tab but it was ultimateshop that was loading on my server so
something is broken with spigotmc.org for me

river oracle
#

Sounds like their is malware somewhere along the line

dawn flower
#

i mean

#

since u downloaded it with another internet and it worked

#

it's on ur isp's side not spigot

eternal oxide
viral wyvern
#

no i download tab on ploymart that was working

river oracle
dawn flower
#

what if the anti malware is malware

eternal oxide
#

Can;t tell him any more without at least seeign a log

river oracle
eternal oxide
#

there are often tell tale signs of a virus plugin

dawn flower
#

spigot (the biggest server software i think) doesnt just infect people

#

if they do that then they would get sued

river oracle
#

Or from piracy

eternal oxide
#

^ they got it from some other site.

river oracle
#

He's resource staff

eternal oxide
#

its by Optic_Fusion1

dawn flower
#

so by spigot

river oracle
#

By optic

#

Spigot isn't officially affiliated with his anti malware

dawn flower
#

not open source as well, sussy

#

yeah no

#

dont use it, it's obfuscated

#

obfuscation isn't a clear sign but its too sus to use

#

(regaring the level one)

dawn flower
#

MobsToEggs isn't even downloaded from spigot

river oracle
#

@vagrant stratus someone might have malware if you care to investigate, they won't send logs tho...

dawn flower
#

MobsToEggs has some awfully obfuscated classes

eternal oxide
#

MobsToEggs looks clean but it's poorly written

#

it even uses BoostedYaml, a derivative of SnakeYaml, for no reason

#

Spigot already has its own Yaml support

dawn flower
#

my guy

#

MobsToEggs is massive for no reason

eternal oxide
#

very much

dawn flower
#

and wtf is @Metadata

eternal oxide
#

terrible plugin

stiff sonnet
#

what's the difference between these materials? BRICK vs BRICKS vs BRICK_WALL

dawn flower
#

thank me later

viral wyvern
#

^^

river oracle
stiff sonnet
#

I don't think there is a brick wall, as in fence block

#

oh my shit there is

#

I'm overcomplicating things

vagrant stratus
eternal oxide
#

Yeah I asked him twice for logs, but no go.

vagrant stratus
viral wyvern
eternal oxide
#

just post in channel

#

?paste

undone axleBOT
icy beacon
#

?paste

undone axleBOT
icy beacon
#

sniped

#

😦

dawn flower
#

banned for spam

#

real

#

you know your plugin is bad if it has a 3.4k line yml line

#

whoever wrote this needs a raise

storm crystal
#

Okay whoever told me several months ago that I wont be able to understand what I wrote back then

#

yeah they were pretty right lol

eternal oxide
#

lol

dawn flower
#

my guy it has a permission for EACH MOB registered

#

do u even need permission registration

eternal oxide
#

You can never have too many comments in code.

viral wyvern
#

that was with the tab.jar what was loading as ultimateshop

dawn flower
#

can u send the "ultimateshop" plugin to me in dms

#

dont send it here

viral wyvern
#

no sry

#

cant do this

dawn flower
#

ok

viral wyvern
#

is payed

dawn flower
#

oh

#

wait so u get a free paid plugin?

viral wyvern
#

utlimateshop is on the citybuild and skyblocjk server

#

that was the bedwars server

viral wyvern
#

its rly crazzy on some other server tab was working as tab

#

and on 3 minigames server it was ultimateshop premium

dawn flower
#

description isnt descriptioning

viral wyvern
#

thats the exact size what tab was

dawn flower
#

the logs look fine to me

viral wyvern
eternal oxide
#

Can you do a screenshot of your plugins folder?

eternal oxide
#

to compare

dawn flower
#

i feel like thats too much to ask ngl

#

most malwares dont create other files / plugins

viral wyvern
eternal oxide
#

what?

vagrant stratus
#

debatable

dawn flower
#

that just makes it more suspicious

vagrant stratus
#

okay and? Still happens

dawn flower
#

some of them download it in PluginMetrics cuz no one looks into that

vagrant stratus
#

Yea, I know

icy beacon
viral wyvern
#

^^

dawn flower
#

check pluginemetrics efor

eternal oxide
#

Logs look clean. Plugins match logs

vagrant stratus
eternal oxide
#

all bar TAB

viral wyvern
dawn flower
viral wyvern
#

i think it hide then i try to find

stiff sonnet
#

what is going on here

icy beacon
dawn flower
#

yeah lol

stiff sonnet
#

I'm intrigued but I don't get what this is even about lol

eternal oxide
#

[06:40:48] [Server thread/INFO]: [UltimateShop] Enabling UltimateShop v2.2.3 is definately not running from TAB v4.1.4

dawn flower
#

download tab from spigot not somewhere else

viral wyvern
#

i remove it and use the one from polymart and it was tab after that

eternal oxide
#

clear your browser cache first

#

then download from spigot

#

Untimate shop jar is only 637k

#

teh TAB jar is twice that size

stiff sonnet
#

has anyone actually taken a look into the jar itself and that it's not doing some weird stuff?=

eternal oxide
#

we can;'t

viral wyvern
#

yes and my was 637kb

eternal oxide
#

its a paid plugin

stiff sonnet
#

tab is a paid plugin?

viral wyvern
#

idk what it was if i try it now its 1,3mb big

#

no

eternal oxide
#

thats the correct size

#

did you clear cache?

stiff sonnet
#

you should check the checksums

viral wyvern
#

no it change on its own but i clear now

eternal oxide
#

actually, TAB is not a paid plugin

#

ah its both

#

paid support

stiff sonnet
#

spigot really should provide checksums for all plugins

#

like what is this

hybrid turret
#

When exactly does the PluginEnableEvent get called? After the onEnable-method is done or before?

storm crystal
#

Is gradle vs maven something one should be aware of? Im at a stage where rewriting my plugin project wont be a problem but I dont know what are pros and cons of each

hybrid turret
#

perfect

#

thanks

eternal oxide
#

the onEnable has to finish without error before an event is thrown

stiff sonnet
native ruin
#

Having some issues adding items to an anvil inventory, the itemstack is not showing, but clicking the slot the itemstack is supposed to be in still activates what it's supposed to do

hybrid turret
lost matrix
hybrid turret
storm crystal
#

I see

#

Thank

neon shoal
#

Use additem

#

Wait

#

Ye

native ruin
#

?gui

hybrid turret
#

Oh heck yeah

#

nvm then

#

Uhm, what's the code for the ItemStack you want to add?

hybrid turret
neon shoal
#

K ika read that then lmao

native ruin
neon shoal
#

Amount?

#

Don't u need to specify a amount?

#

I'm new so correct me if I'm wrong

native ruin
#

the default of an itemstack is always 1 iirc

hybrid turret
#

hmmm

#

from that code it should work i guess

neon shoal
#

Try the amount

#

You never know

hybrid turret
#

I suppose the super call is to create the inventory or something?

native ruin
#

wait a sec I think i know

#

yep i'm an idiot

hybrid turret
#

what was the problem?

native ruin
#

forgot the call decorate() šŸ’€

hybrid turret
#

HAHAHAHA

#

Well it happens lmao

native ruin
#

absolutely sorry to waste your time

hybrid turret
#

Dude no worries

neon shoal
#

XD

hybrid turret
#

I'm at work chilling my balls rn

neon shoal
#

Just started soo

hybrid turret
#

It's from the gui tutorial

#

?gui

native ruin
hybrid turret
#

Lol

neon shoal
#

XD

native ruin
#

really great resource

neon shoal
#

K

native ruin
#

9.5/10

neon shoal
#

I will

hybrid turret
#

It's a fairly advanced tutorial so if you just started with java you might not quite get it

#

I can also recommend the working with data tutorial

#

But i'm biting around at that as well still lol

neon shoal
#

Wtf was that image XD

hybrid turret
#

that was 7's profile picture lol

neon shoal
#

XD

hybrid turret
#

look in the users bar on the right under Discord Helper, 7smile7

#

(i don't wanna annoy him so i wont ping him)

icy beacon
#

@lost matrix how's your day going?

neon shoal
#

ZD

#

XD

#

Imagine ghost ping

#

And blame it on shioku

glass raven
#

no idea where to find those files, dont find them in buildtools outputs either

#

trying to add nms

eternal oxide
#

?nms

glass raven
hybrid turret
hybrid turret
eternal oxide
lost matrix
hybrid turret
#

procrastinating? why? ._.

eternal oxide
#

follow teh wiki to the letter

hybrid turret
#

is your bratwurst stinking less today?

glass raven
eternal oxide
#

If you do exactly as the post tells you it will work

stiff sonnet
lost matrix
hybrid turret
icy beacon
stiff sonnet
#

laughs in homelab

icy beacon
#

Depends on how large the thing is and how convoluted it is to install lol

lost matrix
#

Its... just a mc server ^^

hybrid turret
#

just

icy beacon
#

I can probably handle that I think possibly

#

You can DM me and we'll figure it out

lost matrix
#

Ah its ok. I can probably find something free.

hybrid turret
#

7, since you're here...
I'm still trying to work with your working with data tutorial (with an SQLite db).

I'm wondering.. If someone wishes to manually delete something with a command, should i delete it from the database directly AND from the ServerData (or whatever)? Bc idk if I can like compare the ServerData object and the DB-entries when something is missing

lost matrix
hybrid turret
#

ohhhhh

icy beacon
vital ridge
#

I'm creating my custom entity which extends EntityZombie. The class is called SupremeZombieEntity. When I print out #getEntity under EntityDamageByEntityEvent it returns CraftZombie and not SupremeZombieEntity, thus I cannot check if the entity is instance of my custom entity. But when I spawn the entity in and then print it out, it prints out SupremeZombieEntity. I'd like to stick to basic java if possible and not associate my custom entity with any metadata. Any1 has any advice?

hybrid turret
#

also, @lost matrix , i remember now i wrote this

rigid spire
#

Is there any API that would trigger the bubbling animation to play in the BrewerInventory window for players client side?

I'm assuming worst case scenario would be having to send network packets

native ruin
#

Why can't I cast it to anvilinventory?

private final Inventory inventory;
...
this.inventory = Bukkit.createInventory(null,  InventoryType.ANVIL, "");
...
AnvilInventory inv = (AnvilInventory) inventoryClickEvent.getClickedInventory();
Caused by: java.lang.ClassCastException: class org.bukkit.craftbukkit.v1_20_R3.inventory.CraftInventoryCustom cannot be cast to class org.bukkit.inventory.AnvilInventory (org.bukkit.craftbukkit.v1_20_R3.inventory.CraftInventoryCustom and org.bukkit.inventory.AnvilInventory are in unnamed module of loader java.net.URLClassLoader @46ee7fe8)
acoustic pendant
#

Do someone know how to solve that Intelijj is asking me for a GPG key when trying to commit to github?? I've tried actually setting the GPG key but for some reason it says "Cannot find suitable private key" even when they are detecting the key

stiff sonnet
#

if you haven't set a private key, you need to do that

acoustic pendant
#

I have actually

#

like

stiff sonnet
#

how did you generate the private key?

#

you usually generate a key pair

acoustic pendant
#

gpg --full-generate-key i believe

river oracle
#

you'll need NMS for this

#

virtual inventories such as anvils, looms etc aren't easy to pull off. it takes a lot more than you might think and current internals are not setup to allow this

acoustic pendant
acoustic pendant
brittle geyser
#

How to show message on top of the player when player send messages?

river oracle
stiff sonnet
river oracle
# native ruin That's annoying, thanks

annoying, but how the current system works. You need to patch every single container like this to get it to work. You also need to modify some NMS Containers to allow multiple players to modify them.

brittle geyser
acoustic pendant
river oracle
stiff sonnet
acoustic pendant
#

wdym

stiff sonnet
acoustic pendant
#

I don't have that one on intelijj

#

I have the small one

stiff sonnet
#

wdym long

#

file big?

acoustic pendant
#

----BEGIN PGP PUBLIC KEY BLOCK----

#

that one

stiff sonnet
#

that's the public key

#

as it sais in the header

acoustic pendant
#

yea

#

I have the private in intelijj

grim hound
#

I don't think I sent the correct registry data

stiff sonnet
#

there's probably a wiki

grim hound
#

I literally cannot do anything besides closing minecraft right now

dawn flower
#

can i make an invis person visible to himself

acoustic pendant
#

and i cannot commit to github or export without that

clear elm
#

how can i do an 2nd line at players nametag

stiff sonnet
acoustic pendant
inner mulch
dawn flower
#

text displays are amazing since they have transformation which is basically teleporting the text without changing the actual entity location

stiff sonnet
#

is there a way to force a queued task to be executed immediately?

#

e.g. runTaskLater

eternal oxide
#

cancel it and run task

stiff sonnet
#

huh? on BukkitTask?

dawn flower
#

BukkitTask#cancel

stiff sonnet
#

you cannot start a new bukkittask with a bukkittask parameter

eternal oxide
#

Use a BukkitRunnable, then you can cancel and directly call run

stiff sonnet
#

so you're telling me to extract that function?

#

agh I was trying to avoid that

eternal oxide
#

no

#

in a BukkitRunnable#run()

native ruin
#

I am getting this error
Caused by: java.lang.IllegalStateException: InventoryOpenEvent cannot be triggered asynchronously from another thread.
public void onChat(AsyncPlayerChatEvent event){
This works while using the depricated PlayerChatEvent, but because it's depricated I don't want to use it.
is there any way how I can circumvent this?

stiff sonnet
stiff sonnet
#

oh ok I get it. Yeah that'll work, thanks!

native ruin
eternal oxide
#

Same answer for both šŸ˜‰

stiff sonnet
#

a man of multitasking

dawn flower
#

how do i check if a bitmask is present in protocollib, i want to check if its setting the invisibility state

eternal oxide
#

& it

dawn flower
#

watchableObject.getValue() & 0x20?

eternal oxide
#

yes

dawn flower
#

if i want to make it so Is invisible is false, what do i do?

eternal oxide
#

then use a full bitmask, excluding 0x20

dawn flower
#

?

lilac dagger
#

Something like mask &= 0x20

stiff sonnet
lilac dagger
#

I think it's correct

#

Wait nvm

stiff sonnet
lilac dagger
#

It'll mess the whole thing

eternal oxide
#

if you want teh full byte with is invisible always false

stiff sonnet
#

bitwise stuff is black magic

eternal oxide
#

value = byte & 0b11111011

dawn flower
#

tf is 0B11111011

eternal oxide
#

binary

stiff sonnet
#

bruh

dawn flower
#

ik its binary

stiff sonnet
#

the 0B had me confused lol

eternal oxide
#

ah lower case b

#

there, fixed

stiff sonnet
#

I didn't even know anything other than 0x existed. I guess X for heX

dawn flower
#

aight thanks

eternal oxide
#

a name wider than my display is typing.

lilac dagger
#

Oh yeah it was Something like value &= ~0x20

#

I remember how to flip bits

lilac dagger
#

Those are octets

dawn flower
#

https://paste.md-5.net/otafefofox.bash <-- error

manager.addPacketListener(new PacketAdapter(this, ListenerPriority.NORMAL, PacketType.Play.Server.WORLD_PARTICLES, PacketType.Play.Server.ENTITY_EQUIPMENT, PacketType.Play.Server.ENTITY_METADATA) {
                @Override
                public void onPacketSending(PacketEvent event) {
                    PacketContainer packet = event.getPacket();
                    if (packet.getType() == PacketType.Play.Server.WORLD_PARTICLES) {
                        ?
                    } else if (packet.getType() == PacketType.Play.Server.ENTITY_EQUIPMENT) {
                        ?
                    } else if (packet.getType() == PacketType.Play.Server.ENTITY_METADATA) {
                        List<WrappedWatchableObject> metadata = event.getPacket().getWatchableCollectionModifier().readSafely(0);
                        WrappedWatchableObject watchableObject = metadata.stream()
                                .filter(obj -> obj.getIndex() == 0)
                                .findFirst()
                                .orElse(null);
                        if (watchableObject != null) {
                            Object value = watchableObject.getValue();
                            if (value instanceof Byte) {
                                byte bitmask = (byte) value;
                                Bukkit.broadcastMessage(String.valueOf((bitmask & 0x20) != 0));
                            }
                        }
                    }```
stiff sonnet
dawn flower
#

looks awful for big code like that

stiff sonnet
#

why is there no auto-breaking switch statement

#

switch statement should use continue to go to the next branch instead of always going there lol

slender elbow
#

fallthrough is already a thing in switch statements tho

eternal oxide
#

lambda switch is auto

slender elbow
#

switch expressions don't allow you to do that, yeah

eternal oxide
#

you have the yield keyword in switch expressions

stiff sonnet
slender elbow
#

yeah..?

stiff sonnet
#

in 9/10 cases you break out of switch statements at every condition

#

it should break by default and allow you to go to the next statement using continue

#

switch statements are really just mostly fancy if-statements and the breaking problem really takes away from the possible experience

median trench
#

Hi there, is there any reason why I can get the ender dragon battle not much longer after the dragon it was killed but I get null after an hour? Isn't it supposed to always return a battle in the end world?

eternal oxide
#
switch(true)
case true -> {};
case false -> {};
}```
stiff sonnet
#

how does that not continue to the next statement

#

I've seen that syntax

slender elbow
#

it just doesn't?

icy beacon
#

-> does not fall through

#

: falls through

#

that;'s just java thing syntax

stiff sonnet
#

ok neat I need this in like every other language now

slender elbow
#

any language designed post 2010 will have far better switch/when cases anyway :^)

icy beacon
#

does rust's match fall through

stiff sonnet
#

typescript doesn't

#

sad

#

lua and c++ are also both too old to have that lol

#

I know zero recent languages

icy beacon
# icy beacon does rust's match fall through

according to the rust book, it doesn't (awesome sauce)

Think of a match expression as being like a coin-sorting machine: coins slide down a track with variously sized holes along it, and each coin falls through the first hole it encounters that it fits into. In the same way, values go through each pattern in a match, and at the first pattern the value ā€œfits,ā€ the value falls into the associated code block to be used during execution.

worldly ingot
#

I'm banning you from r/java

slender elbow
#

can you ban me from reddit instead

#

and hackernews, that's just reddit for closeted redditors

worldly ingot
#

That adds up

river oracle
#

DId sOmEone say KotLin

icy beacon
#

😽

hot dune
#

Hello! I try to set the custom value of ender dragon bossbar using protocol lib, but I get error at the field "Action". I have tried to put bytes, but didn't work. Then I tried to use explosion packet, but I get the same error at the field with VarInt Enum type. Can someone help, how can I use it?

dawn flower
#

how do i get the previous inventory in a InventoryOpenEvent?

tardy delta
#

what prev inv

dawn flower
#

if u open an inventory to a player while he has an open inventory

#

it updates the inventory

eternal oxide
#

If one is open you will get a close event for it before the new inventory opens

dawn flower
#

ah

#

so i have to link 2 listeners somehow

eternal oxide
#

why do you want the old inventory?

dawn flower
#

so basically when it "updates" the currently opened inventory it doesnt move the cursor to the middle, the cursor remains where it is

#

wait...

#

why do i need the previous inventory..

slender elbow
charred blaze
#

when i for example create a variable:
String stuff = getConfig().getString("blabla")
will the code get string from the config every time i use that variable or will it do only once and save it?

#

i mean after i reload the config do i have to set stuff variable again to the same key thing?

charred blaze
#

yes you have to or?

tardy delta
#

yes you have

dawn flower
#

you have to

tardy delta
#

getConfig is not a pure function

#

code blocks man

#

and learn java

charred blaze
hot dune
# slender elbow do not use wiki.vg if you're going to use protocollib, wiki.vg shows you the byt...

Well, I just started to use packets (and still learning them), could you please tell me, what function should I use? In protocol lib there no such function with the name similar to "getBossBarOperation" or something.

As for NMS packet class, when I want to write my own value, it required FriendlyByteBuf, about which I can't find any tutorials and it possibly means that there's another way to set my custom amount

tardy delta
#

function with side effects

worthy yarrow
#

What defines ā€œside effectsā€?

icy beacon
#

a haskell dev nightmare

fringe yew
#

how would I detect when a player loses a potion effect via. /effect clear?

icy beacon
worthy yarrow
#

Custom event

worthy yarrow
icy beacon
fringe yew
icy beacon
#

#getMessage or smth

#

read the docs

fringe yew
#

i have

worthy yarrow
icy beacon
fringe yew
#

i read that

remote swallow
#

split on space

fringe yew
#

i just wanted to make sure i have understood it correctly...

fringe yew
remote swallow
#

check if args is 2 or 3 if 2 its on themself if its 3 its on someone else and boom

icy beacon
#

but why

worthy yarrow
#

I just trollin man

icy beacon
#

if you are listening it for multiple reasons then maybe yeah

#

otherwise no

fringe yew
worthy yarrow
#

nah theres no way it does

icy beacon
#

1 sec

remote swallow
#

but dont quote me

worthy yarrow
#

I can't imagine this to be one of the cases where it returns a /

remote swallow
icy beacon
#

lol in my listener i do this
final String commandMessage = message.startsWith("/") ? message.substring(1) : message;

remote swallow
#

where kotlin

icy beacon
#

this was a commission

#

dude requested that it be done in java

remote swallow
#

even bigger where kotlin

icy beacon
#

because he wanted the source code

remote swallow
icy beacon
#

and he only knew java

remote swallow
#

smh

worthy yarrow
#

Bruh

icy beacon
#

yeah i'd much rather do it in kotlin

worthy yarrow
#

if you know java you can very easily read kotlin D:

icy beacon
#

but it went fine

icy beacon
#

one sec

worthy yarrow
#

Not always in java either

#

depends on your knowledge base ofc

wraith apex
#

kotlin is bad

remote swallow
#

no

flint coyote
#

the interoperability between kotlin and java is bad

#

kotlin itself is great

worthy yarrow
#

Kotlin's use of var makes me wish java was as cool D:

remote swallow
#

everyone is entitled to their own opinion on kotlin you might not like it but others do

wraith apex
#

nah

icy beacon
remote swallow
#

ooo coroutines

flint coyote
#

also the out and in for arrays will be confusing when used to java

icy beacon
#

true

remote swallow
#

ye

icy beacon
#

i still confuse in and out

#

because i like never use them

wraith apex
#

looks like some node.js stuff

icy beacon
# icy beacon look at this stupid function signature that i wrote yesterday or smth lol ```kot...

full function because why not

  private suspend inline fun <reified T> downloadAndParse(crossinline downloadCallback: suspend BackendAPI.() -> Response<ResponseBody>): T? = coroutineScope {
    val file = api.downloadCallback()
    if (!file.isSuccessful) return@coroutineScope null

    val body = file.body() ?: return@coroutineScope null
    var input: InputStream? = null

    try {
      input = body.byteStream()
      return@coroutineScope input.reader().use { plugin.gson.fromJson(it, T::class.java) }
    } finally {
      input?.close()
    }
  }
ivory sleet
#

suspend fun!

icy beacon
#

not sure why i'm not using .use but try-finally instead

#

but it works so

remote swallow
#

i didnt know i cou ld do = coroutineScope {}

icy beacon
remote swallow
#

im stealing that tyvm

worthy yarrow
#

What's the difference between fibers and coroutines?

icy beacon
#

fiber optic cable core

worthy yarrow
#

Sure

remote swallow
#

do you mean futures

worthy yarrow
#

? that's what I said

#

oh

icy beacon
#

lmafo

worthy yarrow
#

Sorry my autocorrect

icy beacon
#

well truth be told i do not know, coroutines are just more convenient for me to use in kotlin because of fun syntax and cool stuff and stuff and stuff

#

maybe someone s willing to educate me on the matter

worthy yarrow
#

Ah gotcha

remote swallow
#

theyre basically the same thing just coroutines support kotlin better

ivory sleet
#

yea, now java AT LEAST has virtual threads, and soon structured concurrency

#

sooo i mean

remote swallow
#

nah

#

kotlin

ivory sleet
tardy delta
icy beacon
#

so basically

#

i made it inline because i needed to use reified generics

worthy yarrow
icy beacon
#

and then my ide screamed at me to make the argument callback thing crossinline

worthy yarrow
#

I didn't know fibers were a thing lol

icy beacon
#

so i guess it means that it gets inlined too

tardy delta
#

no

ivory sleet
#

well fibers is coroutines basically iirc

#

but w stack

tardy delta
#

it means theres a specialization of that function for every param of T

worthy yarrow
ivory sleet
#

yea, but w futures I assume u mean promises (more generally)

worthy yarrow
#

Well no I just meant in the fact that they both do basically the same thing and I wasn't sure if there was any big difference