#help-development

1 messages · Page 2092 of 1

noble lantern
#

is this true

#

or the other guy

lavish hemlock
#

I do this lmao

echo basalt
#

I do it when it's needed

coarse finch
#

yep its set

echo basalt
#

when customers are like "what's an sql"

lavish hemlock
#

Mainly uhh

#

I'm just a really big fan of binary data

#

Binary formats are so easy to read

#

When your decoder and parser are the same object :3

echo basalt
#

and then you theorize for 3 hours on how to lower the file size from 110kb to 90kb

small lynx
#

How to turn a player item into nothing

echo basalt
#

setItem(slot, null)

small lynx
#

Like He has a Apple on hand and i want to remove it from them

echo basalt
#

removeItem(new ItemStack(Material.APPLE))

lavish hemlock
#

you can do some cool shit like uhh

echo basalt
#

bitmasks

lavish hemlock
#

bit flags, variable-length primitives (varint, varlong), etc.

#

yeah

echo basalt
#

but like

#

why use int

noble lantern
echo basalt
#

just use bytes

noble lantern
#

cant remember which method it is for main hand

echo basalt
#

why save a uuid by its string form? just write its longs

echo basalt
noble lantern
#

ahh

#

^ rafael

echo basalt
#

I can't tell if you're a noob or just a 2015 developer

noble lantern
#

z_aCRYYY 2015 was the best years no cap

lavish hemlock
noble lantern
#

getInventory().getName()

#

:))

lavish hemlock
#

Oh so uhh

noble lantern
#

now you gotta getView() then get its name sadge

lavish hemlock
#

16 bytes?

echo basalt
#

which is closer to like 16 bytes yeah

lavish hemlock
#

Ah okay

#

Better than like

echo basalt
#

I remember doing them maths

lavish hemlock
#

32

#

Which you'd get from a string

echo basalt
#
  • 1 byte for string length
#

or 4 if you're using an int

lavish hemlock
#

Well you can represent a character as a single byte

echo basalt
#

true

#

you can

lavish hemlock
#

I believe shorts are for UTF-16

echo basalt
#

if you have a predefined alphabet string

#

and just save the indexes of each character

#

which is how you efficiently store player names btw

night wraith
#

yo

noble lantern
#

yo home slice

#

how may we assist you today my G

#

sorry that was uncharacteristic of me lmao

#

whats up?

static pendant
#

Sooooooooo I'm spawning projectiles, right

#

We're having a huge blast

#

With "wands" that shoot arrows lol

#

Thing is

#

We sit on a pile of arrows now.

#

Can i make them projectiles stay on the ground? Not being able to be picked up?

molten hearth
#

is there something different between an instance of Player and OfflinePlayer#getPlayer

eternal oxide
#

no

molten hearth
#

strange

eternal oxide
#

a Player will only exist if they are online

molten hearth
#

yeah thats fine

#

im using placeholderapi and I have private HashMap<Player, ProtectedRegion> regionMap;

#

but when I do regionMap.get(someOfflinePlayer.getPlayer()) its null

eternal oxide
#

Player object can go stale, store against their UUID

molten hearth
#

pain

dusk flicker
#

how is that pain lmao

molten hearth
#

that seemed like effort so I didnt

#

cause then I gotta compare a whole uuid instead of just a player object

#

waste of time smh smh

eternal oxide
#

theres multiple ways to compare, one easy as .equals

dusk flicker
#

it aint gonna be a waste of time when a player object goes stale lol

molten hearth
#

why would they go stale again

eternal oxide
#

player logs off and back on

molten hearth
#

shouldnt that just be something I should handle

dusk flicker
#

making something to handle that would be a lot more work than just using UUIDs

dire salmon
#

what effects could i add for drunk player? already have nausea

dusk flicker
#

blindness, slowness

static pendant
#

capture his textmessages and add gibberish to it

molten hearth
#

yeah well maybe ig im just scared of touching this class cause I broke it too many times and its the #1 source of lag on my server but ill give it a go

dusk flicker
#

prob for you storing so much data

molten hearth
#

naaah

#
            public void run() {
                for(Player p : Bukkit.getOnlinePlayers()) {
                    if(CitizensAPI.getNPCRegistry().isNPC(p)) return;
                    Location location = p.getLocation();
                    ApplicableRegionSet set = WorldGuard.getInstance().getPlatform().getRegionContainer().get(new BukkitWorld(location.getWorld())).getApplicableRegions(BlockVector3.at(location.getX(),location.getY(),location.getZ()));
                    boolean isInGangRegion = false;

                    ProtectedRegion r = null;

                    for(ProtectedRegion applicableRegion : set) {
                        if(applicableRegion.getId().contains("block")) {
                            isInGangRegion = true;
                            r = applicableRegion;
                        }
                    }

                    if(lastSeen.get(p) != null && lastSeen.get(p) == r) { // Player already seen
                        return;
                    }

                    if(!isInGangRegion) { // if the player is not in a gang region and region exists within map
                        // Player has left a region
                        WGRGangRegionLeave event = new WGRGangRegionLeave(p, lastSeen.get(p));
                        Bukkit.getServer().getPluginManager().callEvent(event);
                        regionMap.remove(p);
                        lastSeen.remove(p);
                    } else {
                        // Player is in gang region

                        if(lastSeen.get(p) == null || lastSeen.get(p) != r) { // if last seen for player is empty, or last seen is already this region
                            lastSeen.put(p, r);
                        }

                        WGRGangRegionEnter event = new WGRGangRegionEnter(p, r);
                        Bukkit.getServer().getPluginManager().callEvent(event);
                    }
                }
            }```
#

prob cause of this

#

I run dat bad boi every 20 ticks

noble lantern
#

github down for anyone else?

dusk flicker
#

Looks up to me, I can access it

small lynx
#

There is a way to compile a Java source on smartphone

#

Im away from computer

noble lantern
#

page just laoded second i said something smh

static pendant
#

Yep, can access github

#

lol

noble lantern
#

took like 2 minutes for this repo to load lmfao

static pendant
modest acorn
#

when I took that method that was giving null it created the DB correctly :v @noble lantern

static pendant
dire salmon
#

how do i use empty bottles for things? theres no Material.BOTTLE

#

nvm

static pendant
molten hearth
dire salmon
#

expFlask? i just need the empty bottle, i already got it

dusk flicker
#

thats just the var name

dusk flicker
molten hearth
#

oh right I forgot thats a thing tx

grim ice
#

Material.YOUR_MOTHER

#

Ok

dusk flicker
#

error EnumConstantNotPresentException

dire salmon
#

Ok

static pendant
#

ArrayOutOfBoundsException

#

:>

crude loom
#

I'm using LocalDateTime to calculate the time of a ban, is this a good way of doing it or is this reliant on the pc's time?

grim ice
#

throw new OutOfMemoryError(new RuntimeException(new IllegalArgumentException(new NullPointerException())));

dusk flicker
static pendant
dire salmon
#

throw new OutOfMemoryError("Too big");

static pendant
#

But any measures of time are, I think

#

Except you're pulling them from some kind of API.. but that'd be overkill

molten hearth
#

you can always use UTC time im sure

dusk flicker
#

When a punishment is issued I store the start system ms, and the duration in ms, and on the checks and what not I just check if that start time + the duration has passed

#

obviously its the system time, no real way to get away from that without like an api tho

crude loom
#

So a banned player can just set the date to a month from now and get ubanned couldnt he?

dusk flicker
#

its serversided

#

they would have no access to it

crude loom
#

Ohh it's the server's time?

dusk flicker
#

ye

crude loom
#

Unrelated to the client, wether he is the player banning or getting banned

dusk flicker
#

nothing here is really related to the client in spigot lol

molten hearth
#

this ain't gta

crude loom
#

Coding gta sounds horrible😳

static pendant
#

spoof me daddy?

molten hearth
#

nah but gta does a lot of things the client shouldn't be able to do

static pendant
#

Ahh I see

#

Well it's developed by a small indie game company, you know

#

Give them some time

#

:>

molten hearth
#

yeah ofc ofc

molten hearth
# static pendant wait - gta banns people based on their client?!

basically, the client has control over what unlocks they have, over their current position and whenever they feel like teleporting away, what they can spawn, their luck in-game eg getting lucky drops, their minimum payout from heists, the cooldowns for anything and so on

#

also their XP and xp and money modifiers

static pendant
#

dude what?!

#

are they stupid?!

#

lmfao

molten hearth
#

idk the game is client-side with a side of server-side

static pendant
#

why do they even need a server lol

molten hearth
#

well people wanna play online

static pendant
#

ah wait they need to process the in-game purchase stuff

#

wow dude didn't expect

molten hearth
#

yeah idk rockstar moment

#

health is also client-side lol

static pendant
#

why even bother right

#

I might check that client out once

molten hearth
#

it does tho

#

uh we were talking about gta

#

and im not sure about cod

#

I only know the client has the ability to control the position of vehicles it's entered and it can spam shop items without having purchased them

static pendant
#

can we kick this guy? lol

molten hearth
#

i dont think you are understanding what having access means lol

vocal cloud
#

age is irrelevant. Scope is everything

grim ice
vocal cloud
grim ice
lavish hemlock
#

Yeah

#

Who and why

grim ice
#

nah

#

just who

#

i know why

lavish hemlock
#

okay then, you omniscient bastard

grim ice
#

haha

#

each of us has a reason to get kicked

lavish hemlock
#

I have yet to be kicked

lavish hemlock
#

the mods just like me too much ;)

grim ice
#

wow

#

womanizer

#

mods women

molten hearth
#

🤔

#

therefore the client does have control

vocal cloud
#

A game that actually has this issue is payday 2 but that's cause you need to be able to have all your items offline

molten hearth
#

bruh this is like giving your enemy a gun without a bullet but you put the bullet in their pocket and you expect them not to use their bullet they clearly have access to it

lavish hemlock
#

The client has no control over how the server perceives their data unless they somehow can falsely authenticate it.

grim ice
#

nerd

#

go to nerd jail

vocal cloud
#

New World be like kek

lavish hemlock
#

At least, that's how I interpreted what Zack said.

grim ice
#

ew

lavish hemlock
#

Human brains are just <insert spoken language> interpreters

molten hearth
#

but the client is the one telling the server what data there is, so it clearly has access to it and to modify it

lavish hemlock
#

My brain is an English interpreter

crisp steeple
#

everyone knows language should be compiled instead

grim ice
#

my brain is a french, arabic, english interpreter

lavish hemlock
grim ice
#

i have a wip japanese branch

molten hearth
#

.

#

thats not really having control then is it

#

imo if its not persistent then its not

#

its like using dev tools to edit an html site that's not having control over the site

lunar forge
#

How to set the color of the players name in tab and above the player?

grim ice
#

add prefix>

#

or change

lavish hemlock
#

Mainly because the skin information of the player is stored within a Mojang database, most likely.

#

You can retrieve the profile of a user through their auth token or UUID.

#

Actually I think username works too.

modest acorn
#

does anyone know where i went wrong?

lavish hemlock
#

There is no request you can make to add a new cape, and you can only select capes that your account "owns."

golden turret
#

i need to draw a square in a map. I have the center of the square and its size. How could i draw it in the map?

fervent gate
#

How can I set a block type to a custom skull from the head db api?

#

rn it's doing steve heads

chrome beacon
#

Oh wait you want the plugin api?

fervent gate
chrome beacon
sterile token
#

Oh lmao i love maven i need to compile a project for a friend and always have issues with the fucking maven repos. Sometimes doesnt fiend the local dependencies sometimes doesnt work in the way it doesnt index dependencies neither download them

chrome beacon
#

Never had any issues with that

sterile token
#

Yeah i think its because a problematic person

#

hahaa

#

Dont you think that?

#

Im going to invalidate cache again

chrome beacon
#

So maven isn't the issue? Intellij is

#

Well that happens from time to time

rugged cargo
#
SmithingRecipe smithingRecipe = new SmithingRecipe(NamespacedKey.minecraft(name), result, new       RecipeChoice.MaterialChoice(baseTool), new RecipeChoice.ExactChoice(conversionKit));

Is there a way i can use my own item which is a diamond with metadata, but have the same pattern in the smithing table?

#

Ex : Pickaxe + Diamond w/ metadata = some item

chrome beacon
#

Listen to the prepare event and do your metadata checks there

sterile token
rugged cargo
#

ok thought so.. thanks

sterile token
chrome beacon
#

Try running maven without Intellij

sterile token
#

I cannot

#

I have tried many times running mvn commands without intellij and always get errors

chrome beacon
#

Sounds like you haven't installed maven correctly

#

Or skipped dependencies in your pom

sterile token
#

I only can run "mvn" commands if im using intellij console

#

If not its told me that mvn cmd doesnt exists

chrome beacon
#

If you're on windows you need to specify the install location in the path environmental variable

sterile token
#

I never defined a variable

#

🤡

#

I think its because i never installed maven just use the one that came with Intellij

chrome beacon
#

Yeah you haven't told windows where maven is installed so it doesn't know

#

Intellij does though since it installed maven in it's own folder

sterile token
#

LOl

#

Its too bug

#

It still doesnt find the fucked depend telling it using system path

#

I hate my life

#

I always have f*** issues

chrome beacon
#

After you added the path open a new cmd window

sterile token
#

He?

#

Which the command to reload maven itself?

chrome beacon
#

You don't reload maven

#

Use mvn build to see if it compiles. Or mvn package if you want a jar

sterile token
#

Yeah i know

#

But it cannot find the depend

#

So not find depend != not compile

#

For some reason its not finding spigot local depend when its inside the repo

#

It the 3rd time i check its inside

tranquil viper
#

Is it possible to store objects in yaml files or do I have to encode them?

#

For example if I want to store my "kit" object, could I put it directly into an array of kits in my yaml file or would I have to encode it

echo basalt
#

you can store kits as long as they implement ConfigurationSerializable

sterile token
tranquil viper
#

Link to a tutorial?

tranquil viper
#

Thanks 🙂

sterile token
#

Configuration seriable allows you to save an object directly into yaml

tranquil viper
#

That's what I still use

sterile token
tranquil viper
#

awesome, thanks

sterile token
chrome beacon
wooden fable
#

Is there any alternative for PlayerCommandSendEvent in lower versions?

chrome beacon
#

You can probably use the preprocess event

wooden fable
#

It's not the same, PlayerCommandSendEvent is for sending the list of available commands to the player

chrome beacon
#

Ah okay

sterile token
chrome beacon
#

Then you might have to use Protocollib

sterile token
wooden fable
#

Alr thx!

sterile token
#

Your welcome, have a nice day or night

#

Lmao its amazing i have reindexed the full local repo and maven still not resolving any local depend

#

😮‍💨

twilit wharf
#

I want to override the default world generator and tell the server where biomes are, but not generate the chunks myself. I tried a biomeprovider, which works 90% of the time, but stuff still generates where it isnt supposed to. Is there something I am missing besides a biome provider?

upper niche
#

how can i detect a player consistenly holding left click?
im open to nms methods

carmine nacelle
#

So uh... I'm trying to see if the player is standing on a path block... issue is if I check the block at the player's location, y - 1, it says path blocks are 1 full block lower than the surrounding blocks

upper niche
#

grass path is 15 pixels high so you're in y 86
round up the y coordinate

carmine nacelle
#

Round up, huh..?

#

hmmm...

carmine nacelle
#

also, should I be checking for location or block location?

echo basalt
echo basalt
#

should help with slabs and such

golden turret
echo basalt
#

ehhhh

cedar laurel
#

How do I cancel the spawning portal event when I portal the End Dragon?

I tried that and it didn't work:
On Main:

        Bukkit.getPluginManager().registerEvents(new DragonEntityListener(), this);```
On DragonEntityListener:
```java
     @EventHandler
     public void PortalCreateEvent(PortalCreateEvent event) {
         event.setCancelled(true);
     }```
knotty gale
#

Hey so I was just wondering if making a variable static and then doing (class).(variable) is a good idea to get variables from other classes

dusk flicker
#

not the best idea

#

could easily be considered static abuse

knotty gale
#

well is there any other way?

dusk flicker
#

access it through that class's object, obviously in some cases its not possible and static is one way to do that, there is also DI

#

?di

undone axleBOT
knotty gale
#

hmm ok

#

but sense the plugin is simple and if the first method works I will just use static abuse

#

because I will not be adding stuff

dusk flicker
#

the chance of actually having an issue from static abuse is low either way

knotty gale
#

ok

#

also (I am very new pls do not judge my lack of knowledge) Do I have to put on enable and on disable in other classes than main?

idle loom
#

Can I ask for help with the luckperms api?

unreal quartz
#

No

native siren
#

Spigot comes with a MySQL java connector right? I'm using the following (below) in my pom.xml but getting NoClassDefFoundError: com/mysql/jdbc/jdbc2/optional/MysqlDataSource
.

        <dependency>
            <groupId>mysql</groupId>
            <artifactId>mysql-connector-java</artifactId>
            <version>5.1.14</version>
            <scope>provided</scope>
        </dependency>
unreal quartz
upper niche
#

How can I get a Location object from a ProtocolLib packet?

maiden thicket
unreal quartz
echo basalt
#

LMBishop if you aren't here to help gtfo

echo basalt
#

It's often BlockPosition

unreal quartz
#

Fucking rude mate

echo basalt
maiden thicket
unreal quartz
maiden thicket
#

but whats up

maiden thicket
echo basalt
#

illusion more like dellusion

maiden thicket
#

oh

#

ok

echo basalt
#

go to bed taah

idle loom
echo basalt
#

What is your question

native siren
dusk flicker
#

I'd recommend contacting LuckPerms, they would be able to give you greater insight on their documentation/API

echo basalt
#

spigot has a very outdated mysql driver which you can use

#

or you can just use your updated one but you have to include it yourself

idle loom
dusk flicker
#

Check that out, should answer your question

echo basalt
#

you can just call LuckPermsProvider.get() for that

native siren
echo basalt
#

no

idle loom
native siren
# echo basalt no

Ok thanks
Is there any alternative you think to making my jar so bulky? I guess my only issue is that I need to use MysqlDataSource class which isn't available on older versions

echo basalt
#

or just don't use mysqldatasource

quaint mantle
#

its provided by spigot

echo basalt
#

the version he wants to use contains features that spigot doesn't include

quaint mantle
#

just dont use it?

echo basalt
#

¯_(ツ)_/¯

coarse finch
#

can i make my plugin.yml version the same as in build.gradle?

unreal quartz
#

Nah

coarse finch
#

my updater doesnt work ```java
if (!configFile.getString("config-version").equals(pdf.getVersion())) {
Bukkit.getLogger().warning("Config outdated. Updating.");
configFile.getBoolean("back-enabled", true);
configFile.getBoolean("kickall-exempt-enabled", true);
configFile.getString("messages.permission-message", "You don't have permission to use this!");
configFile.getString("messages.kickall-message", "Kickall command was used!");

configFile.set("config-version", pdf.getVersion());

configFile.options().copyDefaults();

saveConfig();

configFile = YamlConfiguration.loadConfiguration(file);

}```

#

i deleted the kickall message from the config and restarted the server, but it didnt get added

maiden thicket
#

that way it wont take up increase ur jar size and the server will automatically download and load the dependency

#

assuming its on maven central,, pretty sure it should be

#

to add to the library loader i think u add "libraries:" to your plugin.yml

#

then hit enter, then type

  • "mysql:mysql-connector-java:5.1.14"
dense geyser
#

does anyone know of a guide to forking spigot? I want to change some of the methods slightly, add new ones etc to craftbukkit, spigot and bukkit classes but I can't figure it out (I don't intend to share it anywhere, it'd stay private)

maiden thicket
dense geyser
#

I ran buildtools and opened the entire contents in intellij which didn't work because there were class clashes, so I opened Spigot in intellij and it's giving me compilation errors (System cannot be resolved?)

coarse finch
#

help why does my config updater not work

rugged cargo
#

does anyone have a working example of how to implement PrepareSmithingEvent?

#

I am setting the result, but i can't take it out.

#

is it the SmithItemEvent?

coarse finch
#

how can i update my config

quaint mantle
#

like?

coarse finch
coarse finch
sullen marlin
#

you dont want that

#

saveDefaultConfig is a dumb copy

#

options().copyDefaults(true); saveConfig() is what you want

quaint mantle
#

thought they were the same thing

sullen marlin
#

saveDefaultConfig should probably be deprecated now that the API has comment support

quaint mantle
#

thats nice

#

pr 😳

quaint mantle
#

would be weird to have such changes in a minor version increment

coarse finch
worldly ingot
#

Only thing that bothers me about copyDefaults() & saveConfig() is the fact that it removes all whitespace

#

I know, very minor thing that honestly doesn't matter, but it's literally the reason I still use saveDefaultConfig() lol

spring pike
#

how can I get the killer Entity of PlayerDeathEvent?
player.getKiller() is null unless the killer is a player

#

player.getLastDamageCause.getEntity strangely always returns the player himself

summer scroll
#

However there is a workaround, you can listen to EntityDamageByEntityEvent

last ledge
#
    private int List<Integer>percentages = 0;
    private List<String> commands = new ArrayList<>();

    public BlockProperties(List<Integer>percentages, List<String> commands) {
        this.percentage = percentages;
        this.commands = commands;
    }```
#

why is this giving error

rugged cargo
#

this isnt for java help, but what's the error?

#

line 2 looks fishy btw int List<>?

lavish hemlock
#

tf do you mean "isn't for Java help"? lmao

#

this is the development help channel

rugged cargo
#

Java specifically

#

ok, well it says at the top, Serious Spigot and BungeeCord programming/development help | *Ask other questions here*. ok ignore that comment... 😊

tranquil viper
#

https://hastebin.de/uwamicahev.md

My code:


        for (String s : kits) {
            byte[] serializedKit = Base64.getDecoder().decode(s);
            try {
                ByteArrayInputStream in = new ByteArrayInputStream(serializedKit);
                BukkitObjectInputStream is = new BukkitObjectInputStream(in);

                Kit k = (Kit) is.readObject();

                ItemStack i = new ItemStack(k.getIconMaterial(), 1);
                ItemMeta m = i.getItemMeta();
                m.setDisplayName(format(k.getDisplayName()));
                i.setItemMeta(m);

                inv.addItem(i);
            } catch (IOException | ClassNotFoundException ex) {
                ex.printStackTrace();
            }
         }
#

Anyone know why I'm getting this error?

hexed orbit
#

Hi guys, could anyone help me? I would like to make a nether portal indestructible, but every time a block NATURALLY breaks next to the portal, it breaks. I've already tried to use BlockPhysicsEvent, it fires correctly, but even canceling the event, the portal keeps breaking.

tranquil viper
#

Do you care about efficiency?

hexed orbit
#

Well, the portal is massive, it takes up thousands of blocks, my fear is loss of performance

tranquil viper
hexed orbit
tranquil viper
#

I don't really get how a block breaking naturally next to a portal would break it

#

maybe I'm missing something

#

can you give me an example?

hexed orbit
tranquil viper
#

Why would that break a portal, it would not normally happen in vanilla minecraft?

#

Have you looked into it being caused by a plugin you're using?

hexed orbit
tranquil viper
#

You could clear all the blocks around the portal

#

When you initially load it in

#

It could be something to do with the portals hitbox

hexed orbit
jovial sparrow
#

Is it more efficient to use try/catch or use one or more if statement to prevent errors from occurring in the first place?

tranquil viper
#

Ideally if you can, you'd like to avoid errors being thrown in the first place

#

Although sometimes that's not possible

ebon coral
#

Any libraries for 1.18.2 that load schematics without WorldEdit?

#

Been looking all day through loads but they seem a bit outdated.

chrome beacon
#

Why not use WorldEdit?

ebon coral
jovial sparrow
# ebon coral Any libraries for 1.18.2 that load schematics without WorldEdit?

Schematics are not officially supported by mojang, if you want to use structures which are this resource could help:
https://www.spigotmc.org/threads/structure-util-nms-schematics.199250/

ebon coral
jovial sparrow
ebon coral
#

But I prefer schematics, I don't think I can make a 300x250x300 structure if I recall.

jovial sparrow
#

They all use stuff inside of actual minecraft.

jovial sparrow
ebon coral
#

Not a chance

chrome beacon
#

Alright make your own schematic implementation then

ebon coral
#

Am working on it, but I cannot figure out how to load a .schem file lol

#

And fetch the NBTs for entities, blocks, etc.

jovial sparrow
ebon coral
#

Yeah obviously, but not sure about how to do so.

jovial sparrow
#

If your lucky the files are in plaintext, if your not you need to look at the world edit source code and revere engineer it.

#

If they are in plaintext you should be able to use a bunch of regex to pull the values you want.

#

Keep in mind they also may be base64 encoded plaintext or something similar, so if you open them in your text editor and see a bunch of non-unicode charechters I would try to run it through a base64 decoder.

#

It's probably easier to build a system for fragmenting and re-combining structure files.

ebon coral
#

O lawd

chrome beacon
ebon coral
#

Python here we go

chrome beacon
#

Choose your version and start coding :)

ebon coral
#

Yeah reading into that right now, let's see how it goes :> :>

wet breach
#

the schematic format is actually documented on the minecraft wiki if I recall

#

world edit is open source so you can see how they do it

#

world edit also uses JNBT but their own modified version

#

basically the schematic format uses similar format to what would get saved in chunks

#

so as long as you know how that works, you know how schematics work 🙂

maiden thicket
#

frostalf goated

tardy delta
#

Well i saw it on intellij but that's all

jovial sparrow
#

Does using multiple listener classes for different events instead of one listener class with every event have an impact on performance?

#

If not, which one is considered to be better practice?

wet breach
#

not sure what performance impact you would be referring to

#

its like asking will having multiple classes in a project cause performance problems

#

or will just having a single large one be better

tacit drift
#

how can I make my plugin support placeholders from commandblocks?

#

like @a @p etc

wet breach
#

you implement/parse for what those mean

tacit drift
#

omg

#

not like in commands that I send

#

commands sent from a commandblock

wet breach
#

my answer hasn't changed

#

you can use command preprocess event

#

to parse commands from almost anything

#

how you choose to parse what those placeholders mean, is up to you. it is similar to how regex works

#

except we are just only looking for very specific identifiers so you can swap that out with valid values

tacit drift
#

ServerCommandEvent triggers constantly

#

nvm it was a cmd block

#

seems like it triggers for commands from minecraft

wet breach
#

there is ServerCommandEvent

tacit drift
#

yeah

wet breach
#

normally shouldn't use it but I don't see anything better

#

and then you can check if sender is BlockCommandSender

tacit drift
#

it triggers only for commands registered by minecraft

#

just tested

#

kinda dumb

#

right now I am checking if player if pressing a button and if in a radius of 2-3 there is a commandbloc

#

but I think the better way to go is to just make a special checkpoint system based on buttons on the map

#

rather than pretty much make what mojang/spigot should have made

wet breach
#

I could have sworn there used to be a commandblock event

#

but I don't see it in the latest javadocs so not sure how you are supposed to check for commands coming from such things

tacit drift
#

in 1.8 commandblocks used to work as they should

#

replacing the placeholders in ANY commands

wet breach
#

1.8 also doesn't have brigadier either

vocal cloud
#

1.8 is also like a horse with a limp

terse ore
#

how do I make that a crop grows at it's max?

#

I am using blockData.setAge(7)

#

but it doesn't make a change

#

it's still age 1

supple elk
#

Is there any way I can make an implementation of a bukkit runnable which will call a function when it finishes?

#

I was thinking I could override the cancel method, but I don't think that's called when it finishes..?

remote gazelle
supple elk
#

yeah

#

I actually wait nvm

#

they do run until cancelled

#

so yeah I can just override cancel method

remote gazelle
#

uhh

#

ok

supple elk
#

like that

quaint mantle
#

is there a way to remove the default 'attack_damage' or 'armor' from an item, with NMS if not with the API

quaint mantle
#

it seems, when I add an attribute of 0.5 to a normal netherite sword, the final damage comes out as 3.5

#

this is less than a normal netherite sword

#

but I want the damage to just be 0.5

#

anyone know where the rest is coming from?

#

I don't have any strenght or other attributes on there

terse ore
#

How can I summon a mob that ignores a player?

#

like hypixel's skywars mobs

candid galleon
#

cancel the EntityTargetEvent

quaint mantle
#

so weapon damage + 3 always? whatt

crude loom
#

?paste

undone axleBOT
quaint mantle
#

what

crude loom
#

I've been trying to calculate the time for players to be banned for hours and I can't managed to do it
This is my code:
https://paste.md-5.net/egenohitem.cs
Any idea what's wrong with what I'm doing?

pale pendant
#

hello, can someone help me?

#

because i tried to make that if i get wooden pickaxe from "PrepareItemCraftEvent" it makes it into a enchanted diamond pickaxe

#

i will paste the code

crude loom
#

Events need to be in a class the implements listener and have the @EventHandler annotation above them

pale pendant
#

its in the java plugin class

tardy delta
#

babymode lol

pale pendant
crude loom
#

Yeah, you already have 2 classes that have listeners in them, PlayerJoinedListener() and BabyModeListener()

#

You need a class like this to handle events

pale pendant
#

baby mode listener is like stuff that explosion doesnt attack the player and it doesnt do it too

crude loom
#

Then do you want to put it in a seperate class?

pale pendant
#

yeah

#

i need one listener class only?

crude loom
#

So you will need to create a class that implements listener and put the event there

tardy delta
#

why do you have a listener without @EventHandler annotation in your main class?

crude loom
pale pendant
crude loom
#

That's because your class doesn't implement listener

tardy delta
eternal night
crude loom
#

The player chooses a preset and I get the time from there

pale pendant
#

also will it work?

#

it implements listener

crude loom
#

Whenever the player isn't banned and he is trying to rejoin I get

java.lang.NullPointerException: Cannot invoke "net.minecraft.server.players.GameProfileBanEntry.f()" because the return value of "net.minecraft.server.players.GameProfileBanList.b(Object)" is null

#

I mean after he is unbanned

eternal night
#

lemme see what those methods are 😅

#

are you on 1.18.2 ?

crude loom
#

Yeah, but I need the plugin to also work at 1.8

pale pendant
eternal night
#

How are you enforcing the ban ?

crude loom
pale pendant
#

i did

#

in the class

crude loom
#

Than yes it should work

crude loom
#

plugin.getServer().getBanList(banType).addBan(target, reason, date, banning.getName());

eternal night
#

can you provide the entire exception

crude loom
#

Sure

[WARNING] Failed to handle packet for 

java.lang.NullPointerException: Cannot invoke "net.minecraft.server.players.GameProfileBanEntry.f()" because the return value of "net.minecraft.server.players.GameProfileBanList.b(Object)" is null

at net.minecraft.server.players.PlayerList.canPlayerLogin(PlayerList.java:586) ~[spigot-1.18.2-R0.1-SNAPSHOT.jar:3477-Spigot-ffceeae-a459f4d]

at net.minecraft.server.network.LoginListener.d(LoginListener.java:156) ~[spigot-1.18.2-R0.1-SNAPSHOT.jar:3477-Spigot-ffceeae-a459f4d]

at net.minecraft.server.network.LoginListener.c(LoginListener.java:74) ~[spigot-1.18.2-R0.1-SNAPSHOT.jar:3477-Spigot-ffceeae-a459f4d]

at net.minecraft.network.NetworkManager.a(NetworkManager.java:258) ~[spigot-1.18.2-R0.1-SNAPSHOT.jar:3477-Spigot-ffceeae-a459f4d]

at net.minecraft.server.network.ServerConnection.c(ServerConnection.java:172) ~[spigot-1.18.2-R0.1-SNAPSHOT.jar:3477-Spigot-ffceeae-a459f4d]

at net.minecraft.server.MinecraftServer.b(MinecraftServer.java:1352) ~[spigot-1.18.2-R0.1-SNAPSHOT.jar:3477-Spigot-ffceeae-a459f4d]

at net.minecraft.server.dedicated.DedicatedServer.b(DedicatedServer.java:429) ~[spigot-1.18.2-R0.1-SNAPSHOT.jar:3477-Spigot-ffceeae-a459f4d]

at net.minecraft.server.MinecraftServer.a(MinecraftServer.java:1237) ~[spigot-1.18.2-R0.1-SNAPSHOT.jar:3477-Spigot-ffceeae-a459f4d]

at net.minecraft.server.MinecraftServer.w(MinecraftServer.java:1047) ~[spigot-1.18.2-R0.1-SNAPSHOT.jar:3477-Spigot-ffceeae-a459f4d]

at net.minecraft.server.MinecraftServer.lambda$0(MinecraftServer.java:304) ~[spigot-1.18.2-R0.1-SNAPSHOT.jar:3477-Spigot-ffceeae-a459f4d]

at java.lang.Thread.run(Thread.java:833) [?:?]
echo basalt
#

You should probably hide that ip address

wet breach
#

this is most likely you don't have a null check somewhere

#

and you assuming that they exist in the banlist

eternal night
#

that is the server code

#

not their plugin

crude loom
wet breach
echo basalt
#

Likely himself

wet breach
#

and their ISP will give them a new ip if there is issues

crude loom
wet breach
#

standard procedure

echo basalt
#

People have got swatted based on their ip

#

That's the main concern :)

wet breach
#

ip addresses don't contain anyones address and the closest you get is the nearest major city

#

when I was living in Cali, my ISP may have been down the road but if you ever queried where my IP address belongs to

#

the place it would show is some 300 miles away 😛

echo basalt
wet breach
#

if I had to guess its going to be in one of the onjoin events where you just assume they should be in the banlist and then attempt to remove them

#

when they are not in there

crude loom
#

I'm not removing them myself

#

I leave it to the server, it prevents them from joining because of the banlist

#

The banlist isn't something I created

wet breach
#

then you have some plugin doing something that it isn't supposed to

eternal night
#

check your servers ban json

#

and its content

#

looks like it is fucked

wet breach
#

just note this is the development channel and not the #help-server so if you are not making custom plugins or whatever and this is something being thrown

eternal night
#

they are

#

ya gotta read up a bit

wet breach
#

then what I said applies

eternal night
#

they parse some user input, issue a ban

#

Well, there is no plugin execution logic in the stacktrace. Unless a plugin injected itself prior and mutated the ban list entry

#

to cause the NPE

wet breach
#

unless they were doing something with packets

#

as it says it failed to handle the packet

eternal night
#

no

#

it failed to handle the packet because the server ran into a NPE

#

while processing the userban list

#

it is invalid state or a spigot bug

wet breach
#

or it could be because the packet was mangled

#

a mangled packet can cause NPE's

eternal night
#

the packet is the player login packet

wet breach
#

don't care what it is

#

mangled packets with invalid data causes problems

eternal night
#

the server should have checks in place to prevent this NPE

wet breach
#

not if it appears correct

eternal night
#

no matter what data is throw at it

wet breach
#

no

#

that isn't how that works

terse ore
#

can I check how many miliseconds/ticks ¿/any kinf of time are left in a runTaskLater?

eternal night
#

yes, the server should be able to handle malformatted packets gracefully

pale pendant
#

i tried to check if my plugin works, it supposed to give me a enchanted diamond pickaxe when crafted a wooden pickaxe, but it keep giving me the normal tool (the wooden pickaxe that i crafted)

eternal night
#

alright then

#

I shall start spamming your server with malformatted packets and blow up your log

wet breach
#

There is some situations where not handling is the best approach

eternal night
#

yes not handeling is graceful. you can just throw it out

#

running into an exception is not

wet breach
#

no it isn't

terse ore
#

Can I get the time left of a runTaskLater() ?

eternal night
#

If the login packet is malformatted, the server should prevent the player from joining, discarding their packet

wet breach
#

I didn't say malformed

#

you can have a packet that is appropriately formatted just invalid data

#

because it was again mangled

#

if everything looks correct how is the server supposed to know 🙂

#

it can't until it tries to do something with the data

eternal night
#

but that is exactly where it fails

wet breach
#

alright well obviously you don't understand networking well enough to understand

eternal night
#

:kekw:

#

the server is not doing a null check that it should do here

#

that is all that it is

#

or its local state is fucked

wet breach
#

I don't think it is the server that is the issue, banlist for the server has existed since forever, its not like it magically goes away on that feature

#

and I don't recall spigot touching it at any point recently

#

so, either it is a plugin or they have mangled packets which again a plugin can cause

eternal night
#

no, it is probably just bad state

wet breach
#

the only way the state can be bad is if they deleted the file while the server is running

eternal night
#

like

#

feel free my dude

#

it is just bad server code

#

but if you want to jerk yourself off to your networking prowess, you do you

foggy aurora
#

Does anyone know how to use Firebase in a spigot plugin?

pale pendant
#

..

simple silo
#

is there a way to set multiple blocks at once in code? like structure blocks but in code

eternal night
#

firebase has a java sdk doesn't it ?

eternal night
wet breach
#

considering its google

#

most likely

wet breach
# eternal night lol 😂

didn't realize that Mojang natively added tempbans so it explains why the server code is messed up

#

anytime mojang touches something they screw something up

eternal night
#

alright well obviously you don't understand networking servers well enough to understand

#

xd

wet breach
#

that has nothing to do with networking 🙂

#

Networking is a whole different ball game that most here will never get to really understand or experience

eternal night
#

Well if a network god like yourself cannot see that from the stacktrace, it cannot be that hard of a topic can it

wet breach
#

but unfortunately I doubt you will get to mess with satellites anytime soon

#

but again feel free to do so 🙂

eternal night
#

I'll get to you when my ego is as high up as yours and your satellites

foggy aurora
proper pawn
#

how do i only check for xyz movement in PlayerMoveEvent? i still want people to be able to look around
but this doesnt seem to work.

if (config.getString("players.minecraftids." + player.getUniqueId()) == null) {
    if (event.getFrom().getX() == event.getTo().getX() && event.getFrom().getY() == event.getTo().getY() && event.getFrom().getZ() == event.getTo().getZ()) {
        event.setCancelled(true);
        player.sendMessage("Please link an account first.");
    }
} else if (!config.getBoolean("players.minecraftids." + player.getUniqueId() + ".verified")) {
    if (event.getFrom().getX() == event.getTo().getX() && event.getFrom().getY() == event.getTo().getY() && event.getFrom().getZ() == event.getTo().getZ()) {
        event.setCancelled(true);
        player.sendMessage("You have to verify yourself first.");
    }
}
eternal night
#

anyway tho, if you are down for it, lets drop it 😅 glad we found the issue, I am sure your work on satellites is pretty sick and you for sure have a load of network experience. It wasn't applicable here, so no need for us to spam a channel and ruin a usually good relationship 🙂

wet breach
glossy venture
#

when tf is PrepareItemCraftEvent called

wet breach
#

That should be called when they put the items in for the recipe and shows the result

#

if I am not mistaken

#

shows the result but haven't taken it out

eternal night
#

basically part of the slot changed logic yea

glossy venture
#

it doesnt seem like its calling it

#

or i registered my listener wrong

#

oh wait

#

used the wrong @EventHandler i think

#

bruh

eternal night
#

😅

wet breach
#

done that one before

glossy venture
#

i should really change the name of my own event systems event handler

#

lmao

echo basalt
glossy venture
#

happened 3 times now

wet breach
#

where I used Java imports instead of Bukkit ones

#

used to happen often when messing with Vectors

proper pawn
glossy venture
#

yeah

eternal night
#

or maybe the bukkit imports instead of the bukkit imports, looking at you block data

echo basalt
#

gets me like 30% of the time

wet breach
#

and then for event

#

I once accidentally imported JWT events

#

always fun to have that stuff happen

#

and then to run your code wondering why its spewing some nonsense

glossy venture
#

yeah

#

i made my own system

#

but a few of the names are the same

#

including @EventHandler

hardy swan
#

If only there is a way to block certain imports

#

Maven enforcer

zealous osprey
#

If I may ask, what was used in 1.12.2 plugins which can have the same effect as the more modern 1.14 implementation of the PersistentDataContainer ?
Maybe changing the NBT data manually ?

eternal night
#

Pretty much

#

NBTAPI was pretty much the go to if you don't want to directly mess with internals

hardy swan
#

Isnt there a metadata or sth

eternal night
#

metadata is something different tho

#

it does not persist restarts

hardy swan
#

Sounds useless

wet breach
#

you basically had to track your own custom data instead of being able to save it as part of the world files

zealous osprey
eternal night
#

well metadata was just your fancy everyday map

zealous osprey
#

Or maybe it'll be quick, who knows XD

eternal night
#

NBT API isn't too difficult 👍

wet breach
#

the only problem there was in allowing people just access to store whatever in regards to NBT is people are too lazy to clear their custom stuff

terse ore
#

how can I cancel a BukkitRunnable?

eternal night
terse ore
#

yeah

#

I've cheked that

#

but I am using a repeating task that idk how to cancel

#

for using cancel I need to use new BukkitRunnable() {

}. <- here I need to ad repeating task but it's not a thing

wet breach
#

?scheduler

eternal night
#

runTaskTimer

wet breach
#

?schedulerprogramming

past vapor
#

something = bukkit.scheduler.runtaskthing
something.cancel

#

don’t know exact syntax!

eternal night
#

?scheduling

undone axleBOT
past vapor
#

but that’s it

eternal night
#

EY

wet breach
#

there we go

#

lol

eternal night
#

lol

wet breach
#

need to keep a list of these commands

eternal night
#

?help

undone axleBOT
#
CafeBabe Help Menu
*Red V3*
**__Admin:__**

selfrole Add or remove a selfrole from yourself.

**__Cleanup:__**

cleanup Base command for deleting messages.

**__Core:__**

embedset Commands for toggling embeds on or off.
info Shows info about CafeBabe.
licenseinfo Get info about Red's licenses.
mydata Commands which interact with the data CafeBabe has about...
set Commands for changing CafeBabe's settings.
uptime Shows CafeBabe's uptime.

**__Downloader:__**

findcog Find which cog a command comes from.

**__Mod:__**

names Show previous names and nicknames of a member.
userinfo Show information about a member.

**__ModLog:__**

listcases List cases for the specified member.
reason Specify a reason for a modlog case.

**__Permissions:__**

permissions Command permission management tools.

eternal night
#

oh that is useless

wet breach
#

yeah

hardy swan
terse ore
#

ok

hardy swan
#

That is, if you run it via calling a scheduler

eternal night
#

Preferably you just keep track of the BukkitTask the scheduler returns you

#

instead of an int

#

makes your life a lot easier

wet breach
#

also, you can cancel the task from inside the task as well

#

just depends how/when you want it to cancel

#

not sure why you would want to do that

#

in essence you can change the players name but like only for what is displayed and not what the server tracks

#

most people who want this is because of offline mode servers, if that is the case we don't support such things here 🙂

grim ice
#

btw

#

a discord account cant be stolen with a website right

noble lantern
#

a website could create a login that looks exactly like discords and trick you

grim ice
#

Nah like automatically

#

without u entering

noble lantern
#

but no website can just magically steal your stuff to my knowledge

grim ice
#

anything

#

Well it can with roblox

#

Theyre store tokens and stuff in cookies afaik in roblox

noble lantern
#

Nah shouldn't be possible as tokens are stored per URL and the website shouldnt be able to access cookies from other websites

noble lantern
grim ice
#

then how tf do they do it

#

damn

#

ok

noble lantern
#

i visit sketchy links bots send all day and nothing ever happens

#

maybe im lucky

wet breach
#

so as long as the site that created the cookie uses encrypted cookies then no it won't be accessible

noble lantern
#

well im sure discord would do that (hopefully)

wet breach
#

not sure, but hopefully it does

#

discord isn't exactly known for their security though

noble lantern
#

yeah but tbf encrypting a cookie is pretty basic

#

well

#

they might use JWT tbh

#

if so thats fine

wet breach
#

yes nowadays encrypting cookies is basic

noble lantern
#

imma check brb

wet breach
#

and a built in feature easily usable

noble lantern
#

cant really tell if its an encrypted jwt or not but it looks encrypted

#

cookie is seperated by a - though for one of them

#

which is odd, as thats not a JWT thing or any encryption method i know

crude loom
#

How do I check if an offline player exists?

noble lantern
#

Typically when i deal with tokens i find it best to re-encrypt the 3 strings in this seperating by ., then slap it back together and then encrypt the entire string over again with a different encryption key than the other 3 used

noble lantern
crude loom
#

Thanks!

grim ice
#

or has ever existed in the server?

#

or exists as a minecraft player but not necessarily in the server

#

1 or 2 or 3

crude loom
#

Exists as a minecraft player

grim ice
#

oh

#

then burchard method wont work

crude loom
#

But on the server works as well

grim ice
#

check if the offline player equals null i guess

grim ice
#

then use what he said

crude loom
#

I'm checking if the player is banned so

#

This works

noble lantern
#

you could just check the ban list instead

#

OfflinePlayer requests mojang's api iirc

small lynx
#

How to remove a bowl after a player has eaten a soup

crude loom
#

Yeah but I did my own banList because the normal one didn't work for some reason

noble lantern
eternal night
#

the issue is a temporary ban

noble lantern
#

do note if you ban a player with this you need to kick them as well

eternal night
#

as laid out prior

#

in the jira issue I linked

small lynx
#

How to remove a bowl after a player has eaten a soup

eternal night
#

either switch to paper or create your own ban logic

eternal night
#

exists on spigot

noble lantern
small lynx
#

@noble lantern it is for a kitpvp plugin. So idk if consumeitemevent works because the soup regen health

noble lantern
#

so your cancelling that event and instantly applying the soup benifits then

#

just remove the bowl when you apply the soup effects then

#

or

#

remove 1 from the stack as a whole

glossy venture
#

why does the result item flash for a second when im setting it to null in the event

#

does the client do recipe matching too?

restive tangle
#

I have a HashMap<Material, Int> called gearMap, basically I set all the armor types such as leather, chainmail, gold and so on to numbers to denote their levels. So all leather armor would be - 1, all chainmail would be 2... The way I'm doing this is by

    private val gearMap = HashMap<Material, Int>(
        Material.LEATHER_HELMET, 1,
        Material.LEATHER_CHESTPLATE, 1,
        Material.LEATHER_LEGGINGS, 1,
        Material.LEATHER_BOOTS, 1,
        Material.CHAINMAIL_HELMET, 2,
        Material.CHAINMAIL_CHESTPLATE, 2,
        Material.CHAINMAIL_LEGGINGS, 2,
        Material.CHAINMAIL_BOOTS, 2,
        Material.GOLDEN_HELMET, 2,
        Material.GOLDEN_CHESTPLATE, 2,
        Material.GOLDEN_LEGGINGS, 2,
        Material.GOLDEN_BOOTS, 2,
        Material.IRON_HELMET, 3,
        Material.IRON_CHESTPLATE, 3,
        Material.IRON_LEGGINGS, 3,
        Material.IRON_BOOTS, 3,
        Material.DIAMOND_HELMET, 4,
        Material.DIAMOND_CHESTPLATE, 4,
        Material.DIAMOND_LEGGINGS, 4,
        Material.DIAMOND_BOOTS, 4,
    )

This does not work but right now I'm just copy pasting the values for each armor type, is there a better way to do this?

quaint mantle
#

I actually have a system for this kinda

glossy venture
#

you cant initialize a map like that

restive tangle
#

I know.

glossy venture
#

ohk

restive tangle
#

I was trying to organize the code but I haven't found a solution to initialize a map without having to

map[eee] = kk
#

And I'm not fond of pasting all that into my manager initializer

glossy venture
#

to null

glossy venture
#

yeah

#

i pushed source

noble lantern
#

You should really use the Shaped Recipe api and the un shaped recipe api

manic furnace
#

How can I set a block to a cobblestone-step?

echo basalt
noble lantern
#

Its a lot cleaner and no events needed

glossy venture
glossy venture
#

its at the bottom

glossy venture
#

like eith meta and nbt matching

echo basalt
#
private static final String armorKeywords = "HELMET CHESTPLATE LEGGINGS BOOTS";
private static final String rarities = "LEATHER CHAINMAIL GOLDEN IRON DIAMOND NETHERITE";
#

then just use indexof and whatev

glossy venture
#

also i have a custom tag system

#

like oredictionary

noble lantern
#

Well fuck

echo basalt
#

PrepareItemCraftEvent

noble lantern
#

I havent used PrepareItemEvent but im going to assume its like PrepareAnvilEvent and in that case its gonna be very jittery

noble lantern
echo basalt
#

it's not that jittery

glossy venture
restive tangle
noble lantern
#

Its likely a lot like PhysicsEvent too where it flickers for 10% of a tick

noble lantern
echo basalt
#

etc

glossy venture
#

i have custom Ingredient interface which is matched against item stacks in a decision tree to match recipes

noble lantern
#

Ill have to use that event eventually for my plugin maybe ill take a look at it tmrw

quiet ice
#

As a rule of thumb, there is no API worse than PrepareAnvilEvent

glossy venture
#

well prepareitemcraftevent isnt great either for me

echo basalt
#

the name must be in lowercase, otherwise funky stuff happens

noble lantern
#

Orby when I take a look at this tmrw ill let you know and upload my src

glossy venture
#

whenever i click the result slot the original result shows but you cant take it

#

k

echo basalt
#

WorldSaveEvent fires before the file contents are written to, if you're using paper

#

lots of funny stuff

noble lantern
#

Its 5am for me rn or else ide take a crack

quiet ice
glossy venture
#

to the event

#

itemcraftprepare

#

prepareitmecafraft

quiet ice
#

prepareitemcraftevent

glossy venture
#

ah yes

#

im on phone so typing slow af

glossy venture
quiet ice
#

Idk, at least you can add recepies

#

No idea

glossy venture
#

yeah but thats the reason im using this stupid event in the first place

quiet ice
#

?jd if you really want the name, use javadocs but I think noone wants to know the correct one

restive tangle
glossy venture
#

it doesnt allow for custom items

restive tangle
#

Something like this?

echo basalt
#

uhh

#

something close to that

crude loom
#

Is there an equivalent statistic to Statistic.PLAY_ONE_MINUTE in 1.8?

noble lantern
glossy venture
noble lantern
#

Orby try InventoryClickEvent maybe it won't be as jittery but may also not be the right event to use in most cases

glossy venture
#

ill try

#

thanks

quiet ice
glossy venture
#

wdym add the recipe

noble lantern
#

Ie like you do with ShapedRecipe

glossy venture
#

Im trying to cancel vanilla recipes if it contains a custom iten

#

item

quiet ice
#
    @EventHandler
    public void onAttemptCrafting(PrepareItemCraftEvent evt) {
        Recipe recepie = evt.getRecipe();
        if (recepie == null) {
            return;
        }
        ItemStack result = recepie.getResult();
        if (result.getType() == Material.COMPASS) {
            ItemMeta meta = result.getItemMeta();

            PersistentDataType<Long, Long> longType = PersistentDataType.LONG;
            PersistentDataType<Byte, Byte> byteType = PersistentDataType.BYTE;
            if (byteType == null || longType == null) {
                throw new NullPointerException();
            }
            if (!meta.getPersistentDataContainer().has(compassTier)) {
                return;
            }
            meta.getPersistentDataContainer().set(compassShelfLife, longType, System.currentTimeMillis() + ThreadLocalRandom.current().nextLong(60_000L, 240_000L));
            result.setItemMeta(meta);
            evt.getInventory().setResult(result);
        }

I use something like this in one of my plugins

glossy venture
#

oh

quiet ice
#

In your case you wouldn't need to add the recepie though

glossy venture
#

i see what you mean

#

yeah

noble lantern
#

60_000 is valid wtf

glossy venture
#

but there may be multiple recipes with the same base materials

glossy venture
quiet ice
#

So is 6_0_5_88

noble lantern
#

I quit java

glossy venture
#

i always do 1_000_000

noble lantern
#

Thats my limit right there

#

Im out

glossy venture
#

when converting ns to ms

austere zenith
#

how to use better bees

restive tangle
#

How would I initialize a map like this or something like this, I put this in my PlayerUtils class so it was more organized

    private val gearMap = HashMap<Material, Int>(
        Material.LEATHER_HELMET, 1,
        Material.LEATHER_CHESTPLATE, 1,
        Material.LEATHER_LEGGINGS, 1,
        Material.LEATHER_BOOTS, 1,
        Material.CHAINMAIL_HELMET, 2,
        Material.CHAINMAIL_CHESTPLATE, 2,
        Material.CHAINMAIL_LEGGINGS, 2,
        Material.CHAINMAIL_BOOTS, 2,
        Material.GOLDEN_HELMET, 2,
        Material.GOLDEN_CHESTPLATE, 2,
        Material.GOLDEN_LEGGINGS, 2,
        Material.GOLDEN_BOOTS, 2,
        Material.IRON_HELMET, 3,
        Material.IRON_CHESTPLATE, 3,
        Material.IRON_LEGGINGS, 3,
        Material.IRON_BOOTS, 3,
        Material.DIAMOND_HELMET, 4,
        Material.DIAMOND_CHESTPLATE, 4,
        Material.DIAMOND_LEGGINGS, 4,
        Material.DIAMOND_BOOTS, 4,
    )
noble lantern
#

We use it in AE but I always thought it was a hard coded enum....

austere zenith
#

plugin

quiet ice
#

It's the best feature to exist

noble lantern
#

getVersionNumber() > 1_16_4

austere zenith
#

how to use better bees plugin

noble lantern
#

Always thought it was an enum lmfaaao

noble lantern
eternal night
#

to be cool

quiet ice
#

If the > wasn't there I would also think that it is an enum without syntax hilighting

glossy venture
eternal night
#

ye

quiet ice
eternal night
#

that is valid java

austere zenith
glossy venture
#

fr

noble lantern
#

Yeah when I first say that I was mad confused cause my ide didn't import it on a new class lmao

eternal night
#

ye

noble lantern
#

Saw*

glossy venture
#

epic

noble lantern
#

Are you just trying to detect all armor in general

#

Way easier way to do this thats safe for all MC versions

restive tangle
#

A YAML?

noble lantern
#

you can just do this if you want what armor piece something is

#

Material#getType().name().endsWith("HELMET");

quiet ice
# restive tangle How would I initialize a map like this or something like this, I put this in my ...
    private val gearMap = new HashMap<Material, Int>() {{
        Material.LEATHER_HELMET, 1,
        Material.LEATHER_CHESTPLATE, 1,
        Material.LEATHER_LEGGINGS, 1,
        Material.LEATHER_BOOTS, 1,
        Material.CHAINMAIL_HELMET, 2,
        Material.CHAINMAIL_CHESTPLATE, 2,
        Material.CHAINMAIL_LEGGINGS, 2,
        Material.CHAINMAIL_BOOTS, 2,
        Material.GOLDEN_HELMET, 2,
        Material.GOLDEN_CHESTPLATE, 2,
        Material.GOLDEN_LEGGINGS, 2,
        Material.GOLDEN_BOOTS, 2,
        Material.IRON_HELMET, 3,
        Material.IRON_CHESTPLATE, 3,
        Material.IRON_LEGGINGS, 3,
        Material.IRON_BOOTS, 3,
        Material.DIAMOND_HELMET, 4,
        Material.DIAMOND_CHESTPLATE, 4,
        Material.DIAMOND_LEGGINGS, 4,
        Material.DIAMOND_BOOTS, 4,
    }};

something like that

noble lantern
#

val >:(

chrome beacon
#

Use EnumMap

quiet ice
#

Do not use enum map

#

At least not anymore

chrome beacon
#

Why not?

noble lantern
quiet ice
#

Relying on the fact that material is an enum is a ticking time bomb

noble lantern
wet breach
#

can't worry about what future versions may do

noble lantern
quiet ice
#

In the 1.18 (or 1.17?) release announcement it was declared that material will no longer be an enum in the future so don't start doing useless reliances

noble lantern
#

Using the method I sent would make it work for netherite on higher version

quiet ice
glossy venture
#

didnt see it

quiet ice
#

Yet everyone seems to forget it

wet breach
#

it makes sense for it to not be an enum but there will always be a mapping

noble lantern
#

NMS has Blocks

#

Which is a fatass list of enums

chrome beacon
#

It's not an Enum iirc

quiet ice
#

It's more of a registry than an enum (though you can make the argument that both are quite similar)

glossy venture
#

Blocks and Items from nms are not enums

#

just a lot of static fields

noble lantern
#

Im not at pc cant check

#

Ah yeah I think it is just static fields

glossy venture
#

i checked

#

yeah

quiet ice
#

If it was an enum modding would be much harder

glossy venture
#

air has its own block class

chrome beacon
#

Forge had (has) a hacky system for messing with enums

#

Though I think they removed it in 1.13+

quiet ice
#

Yeah, it is doable, just hacky and pretty hard to get working with other mods

#

Unless you are the person to hand-write ASM Transformers

noble lantern
#

Gnight yall

glossy venture
#

gn

coarse finch
#

i do not know why but my config updater will not work

restive tangle
#

Kotlin has a mapOf() function, my bad