#help-development

1 messages · Page 1577 of 1

torn shuttle
#

because discord didn't send it

#

I know it's printing villager isn't valid, that's what I specifically told it to print

#

that is also specifically my issue

chrome beacon
#

um... did discord die or smth the same thing just happened to my reply

timid kraken
#

umm so i looked more into this and apparently it requires a md5 hash, and i have 0 idea on how to get one and what hash is it even asking for. could you provide some insight?

chrome beacon
#

It's the hash of the resourcepack

#

It's to validate the file recieved

dire marsh
torn shuttle
#

yeah this issue consistently only happens during startup

#

what's up with that

timid kraken
torn shuttle
#

seems like something is busted with world loading

timid kraken
dire marsh
#

get the hash from some site

eternal oxide
dire marsh
#

upload the resourcepack zip file

#

just select sha1

timid kraken
#

ok thanks a lot!

dire marsh
eternal oxide
#

The consumer is run on the entity before its spawned so you get to do all your modifications before its added to the world.

torn shuttle
eternal oxide
#

Your issue is likely due to world loading and mob spawning timings

#

if you use a consumer it doesn't matter

#

your entity will be spawned when its ready

torn shuttle
#

how would a consumer help when it's just not ever spawning

timid kraken
torn shuttle
#

consumers modify a spawn, right? they don't schedule one

chrome beacon
#

;/

#

idk then

eternal oxide
#

They modify the Entity. I don;t believe your entity is not spawning

torn shuttle
#

well you better believe it

#

it isn't

eternal oxide
#

I just think its not spawned when you expect it to be

torn shuttle
#

it never gets flagged as valid

outer crane
#

Anyone knows if I can access the Vault API async?

eternal oxide
#

depends on the plugins its hooked into

outer crane
#

I think the only one I have right now is Towny? Is that safe?

eternal oxide
#

probably not

outer crane
#

damn i wish there was some actually good claims plugin

#

towny works nicely for users but is a pain for admins

#

anyway, thanks

eternal oxide
#

The point of Towny is its run by users not admins

outer crane
#

but its painful to manage

eternal oxide
#

Set it up and you are done. No admin to do

outer crane
#

such as "emergency mode" when it decides to corrupt once in a while

#

anyway, im getting carried away

eternal oxide
#

ah well, yea corruption has been a thing for a long time

sage swift
#

no issues in my experience, only on my end when i did something wrong

#

or rarely when the server crashed

eternal oxide
#

I never experienced a corruption unless I did somethign silly myself.

sage swift
#

had a lot of crashing back in the day when i was first starting

#

but that's why there are automatic backups!

torn shuttle
#

I still remember when we could expect corruption with every update

ivory sleet
#

If it’s economy it will be most likely be essentialsx which iirc does not support it, maybe for permissions (luckperms)

eternal oxide
#

GroupManager would likely be ok, but I'd not guarantee it

torn shuttle
#

clearly it's not null

#

it just goes from existing to not existing instantly

eternal oxide
#

Is the chunk actually loaded?

torn shuttle
#

yeah and also ffs I think the consumer thing worked just now even though it shouldn't

#

argh

#

this is so dumb it's not materially any different...

#

oh and now it didn't work

#

cool

#

these rng-based issues are the best

eternal oxide
torn shuttle
#
        try {
            //this.villager = (Villager) spawnLocation.getWorld().spawnEntity(spawnLocation, EntityType.VILLAGER);
            Consumer<? extends Villager> consumer = new Consumer<Villager>() {

                @Override
                public void accept(Villager entity) {
                    // do something
                    entity.setRemoveWhenFarAway(false);
                    entity.setPersistent(false);
                    entity.setAI(false);
                    new DeveloperMessage("Spawning entity: " + entity.getType());
                }

            };
            this.villager = spawnLocation.getWorld().spawn(spawnLocation, Villager.class, (Consumer<Villager>) consumer);
            this.uuid = villager.getUniqueId();
        } catch (Exception ex) {
            new WarningMessage("NPC " + npCsConfigFields.getFileName() + " tried to spawn in an invalid location. " +
                    "This may be due to region protection preventing it from spawning correctly. If not, delete the location" +
                    " in its configuration file and try setting it up again.");
            ex.printStackTrace();
            return;
        }

        if (this.villager == null)
            new DeveloperMessage("Villager is null");
        if (!this.villager.isValid())
            new DeveloperMessage("Villager isn't valid");

still returning not valid

#

it does run the spawning entity message

eternal oxide
#

If you are doing it in the consumer don;t bother checking isValid

#

It won't exist in the world yet

torn shuttle
#

it never exists in the world

eternal oxide
#

so all the code is running, but it never appears in game?

torn shuttle
#

yes, that's what I'm saying

#

except on a reload

#

if I reload the plugin and this code runs again but the world's been loaded the whole time it works just fine

#

also this is a 1.17 exclusive issue

eternal oxide
#

Then you issue IS that the world/chunk is not loaded

torn shuttle
#

this code worked for every single update before this

#

the world is loaded, the location exists

#

you can't make a valid location with a valid world without the world fundamentally existing

#

also it runs after the world initialization

eternal oxide
#

just because your location is valid doesn't mean teh chunk is loaded

torn shuttle
#

sure, that's why I also had code to load the chunk in manually

#

no difference

eternal oxide
#

chunk load I'm fairly sure is not instant when you call load

#

same as unload

#

you have to wait for it to be available

#

easy test, set yoru loaction to spawn

torn shuttle
#

this world does not keep spawn chunks alive

eternal oxide
#

then change the setting so it does

#

it will prove or disprove your issue

torn shuttle
#

fyi

eternal oxide
#

you are likely going to have to delay your spawing a tick until the chunk is loaded.

torn shuttle
#
try {
            //this.villager = (Villager) spawnLocation.getWorld().spawnEntity(spawnLocation, EntityType.VILLAGER);
            Consumer<? extends Villager> consumer = new Consumer<Villager>() {

                @Override
                public void accept(Villager entity) {
                    // do something
                    entity.setRemoveWhenFarAway(false);
                    entity.setPersistent(false);
                    entity.setAI(false);
                    if (!entity.isValid())
                        new DeveloperMessage("Minecraft is a busted-ass game");
                    new DeveloperMessage("Spawning entity: " + entity.getType());
                }

            };
            this.villager = spawnLocation.getWorld().spawn(spawnLocation, Villager.class, (Consumer<Villager>) consumer);
            this.uuid = villager.getUniqueId();
        } catch (Exception ex) {
            new WarningMessage("NPC " + npCsConfigFields.getFileName() + " tried to spawn in an invalid location. " +
                    "This may be due to region protection preventing it from spawning correctly. If not, delete the location" +
                    " in its configuration file and try setting it up again.");
            ex.printStackTrace();
            return;
        }
#

the consumer dev message #1 runs

#

it's not valid even in there

eternal oxide
#

Its not spawned yet so I would expect that to be false

torn shuttle
#

yeah, yet

#

keeping the chunks alive seems to bypass the issue so I guess that's the issue (?)

#

I have to assume this changed for 1.17, how come this was never an issue before?

eternal oxide
#

yep, your best approach, is place a ticket on the chunk, then fire in a delayed task the spawn

#

at the end of your spawn remove the ticket (if you are done spawning)

steady rapids
#

anyone knows how can I get server warns? i coded an easy launchpad plugin but if the velocity is too much, my console spams warnings about it. Is it possible to make an event when one of those warnings pops up?

#

[18:40:17 WARN]: Excessive velocity set detected: tried to set velocity of entity #0 to (9.890552185889112,5.0,-1.249544380443629).

sour loom
#

if i do player.getLocation().distance(someOtherPlayer.getLocation()) what type of data will it return? a double or a vector?

unreal quartz
#

distance (double)

#

though you should consider using distanceSquared as distance will sqrt the result

hasty prawn
steady rapids
hasty prawn
#

Nope, I would just try to tweak the numbers until you like the velocity & it doesn't spam

steady rapids
#

kk

#

ty

torn shuttle
#

the chunk claims it's loaded when the code runs

eternal oxide
#

I guess it lies then

torn shuttle
#

well it's a problem innit

robust crypt
#

abcd

eternal oxide
#

yep

#

Have you tried with chunk tickets?

torn shuttle
#

I don't know if chunk tickets are something specific but I have changed the code to be initialized based on chunk loads

#

?paste

undone axleBOT
torn shuttle
eternal oxide
#

I'd also delay 1 tick after the chunk load event to run your code.

torn shuttle
#

well it's not that the code in the chunk load doesn't work

#

it's that it doesn't run because the chunk is already loaded lol

eternal oxide
#

at startup (1 tick after) get a list of loaded chunks

torn shuttle
#

I already have another alternative that works based on delays after boot but I would really like to have a way of doing this that isn't 100% jank from the start

eternal oxide
#

yep

#

work arounds are a pain

torn shuttle
#

I will say this proves that the chunk was loaded the whole time

eternal oxide
#

I believe there are different levels of loaded now

torn shuttle
#

wait what

#

is that exposed on the api?

eternal oxide
#

I think I remember Choco talking about it a week or so back

#

Not to my knowledge

eternal night
eternal oxide
#

My fix would probably be...

  1. Add a chunk ticket for any Entities I want to spawn.
  2. Run delayed any spawn code for those entities.
  3. Check if the Entity was already spawned in some other server startup.
  4. Use the spawned Entity or spawn a new one if none exists.
outer crane
#

I'm trying to use guice for my api and plugin

unreal quartz
torn shuttle
eternal oxide
#

java 1.8 and spigot 1.17 are not a match

eternal oxide
shut field
#

why does this not cancel the event?

eternal night
#

your IDE already yells at you

#

lol

unreal quartz
#

read the warnings your IDE gives

robust crypt
#

why does lmbishop have to be here :(((

unreal quartz
#

lemme guess

torn shuttle
#

I guess the point is to make sure the chunk doesn't try to unload between the time you load it and the time the frankenstein's monster of a code that enforces waiting delays after a chunk load right

unreal quartz
#

you're here to abuse ewen again

hidden delta
#

String cannot be use with ==

robust crypt
#

how do i set the score of my scoreboard to 69

unreal quartz
#

yep

shut field
robust crypt
outer crane
# unreal quartz

that was a typo with me putting it on the paste site, it wouldn't compile in the first place if that was my normal pom.xml 😅

hidden delta
#

You need to use equal or equalOrIgnoreCase

shut field
unreal quartz
#

objectives don't have scores

worldly ingot
#

getScore()

#

Then set its value

grizzled warren
#

I'd like to get the ip and username with the uid, anyone know how?

robust crypt
worldly ingot
#

Dude, use your IDE

eternal oxide
unreal quartz
#

no, you get the score of a specific entry

hidden delta
#

getScore(string).setScore(int)

torn shuttle
#

yo choco is it true that there's different chunk loaded states with 1.17?

unreal quartz
#

the objective itself doens't have a score

robust crypt
#

no way someone just dmed for free nitro

#

no way

robust crypt
#

xd

robust crypt
torn shuttle
#

and also doesn't really fix the core issue of it happening when the chunks are already loaded to start with

eternal oxide
#

nope

quaint mantle
#

then cry when you realize you dont know what the fuck youre doing

eternal oxide
#

@worldly ingot Was it you the other day having a discussion about chunk load levels? Something about them being new?

worldly ingot
#

Don't think so

robust crypt
eternal oxide
#

ok

torn shuttle
#

should I even report this as a bug

#

it's clearly busted somewhere

eternal oxide
#

It possibly is a bug as it doesn;t happen on earlier versions

torn shuttle
#

yeah it certainly didn't

eternal oxide
#

You would have to come up with a reliable method to replicate it

torn shuttle
#

uh

#

it's not too hard

#

on startup create a world, get a location in that world, spawn an entity on the same tick

#

or even better spawn 100 different entities spread out a little bit

#

you'll get about 20% of them

eternal oxide
#

You would have to demonstrate that it would work 100% in 1.16

torn shuttle
#

you can run the same code in 1.16

#

I've been doing it to thousands of entities and it never missed

eternal night
#

as you will find in the issue, there is an open PR to introduce chunk loaded level (e.g. isEntityLoaded) to the API

eternal oxide
#

interesting

#

That is the same issue

eternal night
#

PR has gone kind of stale tho

#

not much of a fan of that

torn shuttle
#

I guess it's a deeper-seated issue

sharp bough
#

how can i use anvils to get user inputs? i cant manage to find anything on google

#

or some useful API

#

Inventoryframework doesnt explain it well enough

muted idol
#

hey there so right now i have this JSON string. now im wondering how would i go about desteralizing this string to for example only get the info the json object has which id is 0?
my JSON string: [{"X":-887,"Y":100,"Z":482,"ID":0},{"X":-24,"Y":54,"Z":284,"ID":1}]

quaint mantle
sharp bough
#

but i cant find anything working

quaint mantle
muted idol
quaint mantle
sharp bough
#

maybe i did something wrong

#

?

muted idol
lusty cipher
#

AnvilGUI is awesome

quaint mantle
muted idol
#

i am basically asking how i would go about getting the "ID" value from my json object

muted idol
quaint mantle
#

just not in Java

muted idol
#

haha np man

lusty cipher
#

Spigot has Gson built-in iirc

quaint mantle
eternal oxide
#
JsonObject json = new Gson().fromJson(reader, JsonObject.class);
int id = json.get("id").getAsInt();```
ivory garnet
#

hi, how can i get a instance of a block but a instance of a block vanilla

eternal oxide
#

A Block is a representation of the location in the World

#

You can get a snapshot of that block

sharp bough
#

any ideas?

#

using anvilGUI

quaint mantle
#

its your java version lol

#

what mc version are you trying to target?

ivory garnet
sharp bough
quaint mantle
#

Hey does anyone know a good tutorial of spigot?

eternal oxide
quaint mantle
#

i wanna learn

sharp bough
#

in yt

quaint mantle
#

actually wait

#

you're using java 8 right?

ivory garnet
sharp bough
quaint mantle
eternal oxide
sharp bough
#
Java(TM) SE Runtime Environment (build 1.8.0_291-b10)
Java HotSpot(TM) Client VM (build 25.291-b10, mixed mode, sharing)```
quaint mantle
#

update to java 16

ivory garnet
sharp bough
#

k

ivory garnet
#

"chestnbt" are just "chestblock"

smoky oak
#

what's the event that fires when something grows (not when its random ticked)?

#

nevermind got it

#

trying to disable mushrroms destroying end portal

ivory garnet
eternal oxide
smoky oak
ivory garnet
#

ok thx

ivory garnet
#

its the error

eternal oxide
#

cast to chest

stone sinew
#

How can I convert BlockData cbd = Bukkit.createBlockData(String); to IBlockData? I can't cast it...

eternal oxide
#

((Chest) location.getBlock().getState()).getPersistentDataContainer()

eternal oxide
stone sinew
eternal oxide
#

yep nms

stone sinew
stone sinew
prisma needle
#

Hey guys! I've been taking a look at adding custom tab complete suggestions to custom commands (in bungeecord). I've looked it up online and haven't found a clear answer on how to use it, or how to add the tab suggestions to a command. Are there any tips or resources I could use? Thanks :)

sharp bough
quaint mantle
#

what the fuck with passengers?

#

When i'm seeing in north side i'm catching this bug

#

(chest is armorstand)

quaint mantle
final monolith
#

how to remove a path from .yml?

tried with config.set("path", null) but doesnt work

quaint mantle
#

config.remove?

final monolith
#

doesnt exists

quaint mantle
#

or smth like this

final monolith
#

i searched too 😅

quaint mantle
#

it's time for javadocs!

unreal quartz
#

well that is how you remove it

#

by passing null

#

?jd

final monolith
#

already tried

unreal quartz
#

how does it not work

#

what is the behaviour

final monolith
#

wait, i will debug

#

to see

#

show me that error

unreal quartz
#

sned your code

final monolith
#

e.getKey().getName() returns "name" (its correct)

unreal quartz
#

i mean the full thing

final monolith
#
public static void deleteVariable(Player p, String name) {

        File player = new File(instance.getDataFolder() + "/data/" + p.getUniqueId() + ".yml");
        FileConfiguration playerConfig = YamlConfiguration.loadConfiguration(player);

        for (Map.Entry<DataAPI, Player> e : data.entrySet()) {
            if (e.getKey().getName().equalsIgnoreCase(name)) {
                data.remove(e.getKey());
                playerConfig.set(p.getUniqueId() + "." + e.getKey().getName(), null);
            }
        }

        Main.getInstance().saveCustomConfig(playerConfig, player);
    }
unreal quartz
#

the error is the line above

#

use an iterator

final monolith
#

data.remove(e.getKey());?

unreal quartz
#

you can't remove from a list while you iterate over it with a for loop

ivory garnet
final monolith
unreal quartz
#

you can add it to a list to remove after, or use an Iterator

eternal oxide
final monolith
unreal quartz
#

i am sure you can google one

final monolith
#

oh ok

ivory garnet
eternal oxide
#

the exact code I showed you and you quoted back to me

eternal night
#
final Chest chest = (Chest) location.getBlock().getState();
final var pdc = chest.getPersistentDataContainer();
#

there

#

java

#

you can one-line it similar to how elgar did it

#

but then you don't have the chest, which is sad

quaint mantle
#

why use var when you know what it is?

eternal oxide
#

less typing 🙂

eternal night
#

because I don't want to write out the class name ??

#

you always know what it is lol

#

java is not a dynamically typed language lol

hasty prawn
#

So lazy... it's so much easier to read & understand if you don't do that.

quaint mantle
#

thats what im thinking ^

eternal night
#

I mean, if you need the type definition you do you /shrug

hasty prawn
#

The compiler might be able to infer but if someone else comes along and reads your code they might have a difficult time inferring.

unreal quartz
#

its their source code, let them do whatever they want

eternal night
#

idk there is very specific java documentation on this

hasty prawn
quaint mantle
ivory garnet
#

@eternal oxide thx thx

eternal night
#

Yeah dang, java is really the only language in which you can just let the compile infer the type

#

rust and kotlin are gonna cry in a corner

#

golang does too

ivory sleet
#

Infer what type? 😮

eternal night
#

the PersistentTooSlowToUseContainer

#

just such a long word 😭

ivory sleet
#

Ah lol

#

Yeah spigot enterprise 😌

eternal night
#

tho I guess, flame ItemMeta not PDC

ivory sleet
#

Lol

ivory sleet
sour loom
eternal night
#

yes

unreal quartz
#

yes

sour loom
#

Thankyou

unreal quartz
#

well as long as there is no difference in y and z ofc

ivory sleet
hasty prawn
#

How would it?

sour loom
hasty prawn
#

I guess if the naming is obfuscated or something then it could to an extent I guess

unreal quartz
ivory garnet
#

@eternal oxide oops, i have do
Chest chestnbt = (Chest) locplyrc.getBlock().getState();

PersistentDataContainer tilesttc = chestnbt.getPersistentDataContainer();
but the Chest chestnbt = (Chest) locplyrc.getBlock().getState() do a error

ivory sleet
#

You might have something like ByteArrayInputStream in a twr block, in that case just declaring a var might make it easier to read.

eternal night
#

runtime tho ?

#

var is also just useful if you actually name your variable.

final var persistentDataContainer = ...
final PersistentDataContainer persistentDataContainer = ...
#

like, it is just doubled

ivory garnet
#

you speak to me ?

eternal oxide
sour loom
hasty prawn
ivory sleet
#

Also anonymous exposure which is like super pog

sour loom
ivory sleet
#

Or whatever it’s called

ivory garnet
eternal oxide
#

What import have you used?

sour loom
#

I mean the Pythagorean theorem

ivory garnet
#

org.bukkitidk

unreal quartz
eternal oxide
#

you need the Block one

unreal quartz
robust crypt
#

omg why is he here

sour loom
eternal night
#

this chest

#

specifically

ivory garnet
eternal oxide
#

yes

robust crypt
#

how do i set score REEEEE

#

its still 0

granite stirrup
#

so you need a 0-68

#

but scoreboards cant even go past 16 i think

robust crypt
#

wtf

#

is this scam

eternal night
#

what ? Scores can definitely go up to 16 and way beyond

granite stirrup
#

pretty sure you can only have 16 scores

robust crypt
#

than explain how health scoreboard works

#

with 20

eternal night
#

I think idkidk is talking about order of scores on the scoreboard

hasty prawn
#

Thats the value, not the positioning

#

You're setting the position to 69

#

Which isn't valid

eternal night
#

Fam what ?

#

the position is just the value on the sidebar

granite stirrup
eternal night
#

Yes

hasty prawn
#

Oh wait yeah 🤔 hang on

eternal night
#

individual scores

robust crypt
eternal night
#

but they are just trying to create a single score with value 69

robust crypt
eternal night
#

which should be perfectly fine

granite stirrup
#

oh

robust crypt
#

BELOW NAME PLS

#

no side bar

hasty prawn
#

Are you making a separate Scoreboard for each player or is it all on the same scoreboard

robust crypt
#

same

#

i want everyone to see that ewen is fat

#

i might be wrong wait

#
    private Scoreboard createScoreboard(String Ewen_Is_Fat_XD) {
        final Scoreboard scoreboard = Bukkit.getScoreboardManager()
                .getNewScoreboard();
        final Objective objective = scoreboard.registerNewObjective(
                "test", "dummy",
                ChatColor.RED + "Ewen_Is_Fat_XD" + ChatColor.RESET);
        objective.setDisplaySlot(DisplaySlot.BELOW_NAME);
        objective.setDisplayName(ChatColor.RED + "Ewen_Is_Fat_XD" + ChatColor.RESET);
        objective.getScore("Ewen_Is_Fat_XD").setScore(69);
        return scoreboard;
sour loom
hasty prawn
#

Try getScore(ChatColor.RED + "Ewen_Is_Fat_XD" + ChatColor.RESET)

robust crypt
#

wat

#

but i want it to be 69

hasty prawn
#

Change this:
objective.getScore("Ewen_Is_Fat_XD").setScore(69);
to this
objective.getScore(ChatColor.RED + "Ewen_Is_Fat_XD" + ChatColor.RESET).setScore(69);

robust crypt
#

:(

#

i gotta open my server again

sour loom
#

What do you guys do to run something every 10seconds? Do you multiprocess or smth? Or just puting it in a different class and doing while would work?

granite stirrup
#

BukkitScheduler

sour loom
#

Without blocking the whole plugin

eternal oxide
#

?learnjava

undone axleBOT
hasty prawn
#

?scheduling

undone axleBOT
granite stirrup
#

BukkitScheduler

ivory garnet
#

the block can have custom nbt ?

eternal oxide
#

no

ivory garnet
#

ok thx

granite stirrup
#

but no other blocks

eternal oxide
#

true

granite stirrup
#

tile entities is kinda like blocks with nbt

#

tbh i dont think you can set nbt of a tile entity in vanilla like custom nbt cuz i tried and it didnt work

eternal oxide
#

Thats ok, we have PDC 🙂

granite stirrup
#

thats 1.14+ xd

eternal oxide
#

Life begins at 1.14

granite stirrup
#

not everyone uses that

#

if your making a public plugin you probs wanna support to 1.12 atleast

eternal night
#

nah lol

granite stirrup
#

because some people still use old verisons

hasty prawn
#

If only Mojang would add 1.8 pvp back we could all use the latest :(

eternal night
#

either go full on 1.8 or just latest

#

the intermediate versions are pretty useless

eternal night
#

The jeb_ patches look very useful

hasty prawn
#

Yeah we do, I don't really understand why they insist on not adding a gamerule for it

eternal night
#

I mean you want a unified experience over all of minecraft

#

they saw something wrong with 1.8 PVP

#

so bringing it back makes no sense

hasty prawn
#

Sure it does. Get people to stop using the version that's like 6 years old. Clearly people liked it, why change it?

#

Compromise. Add both.

#

Let the server decide which it uses.

eternal night
#

tbh old combat mechanics already does a LOT of what 1.8 did but people just are hardstuck on the "omg this one single thing is not the same I cannot uses it"

hasty prawn
#

Still think it should be a Mojang feature so 1.8 can die

#

:/

granite stirrup
eternal night
#

idk I think they just gotta work on their new combat patches

sour loom
#

Anothwr question, does using spigot latest version allow older versions of minecraft java to play on it? If so, where can i see how old?

eternal night
#

spigot does not

#

there is viaversion

hasty prawn
eternal night
#

which does what you are describing

hasty prawn
#

Doesn't really feel the same

eternal night
#

Yea but the extra effort on their end to implement a combat system back that feels "exactly the same" is a lot

#

for a system that, remind you, they do not see fit as a combat system for minecraft

#

Also, according to bstats 1.8 is dying steadily

hasty prawn
#

It's a PvE system. IMO they're being a little petty not doing something about it, people very clearly avoid 1.9 combat, especially when it comes to pvp. All bug fixes & features are completely worthless to PvP servers because of that change.

eternal night
#

idk man, according to bstats not even 9% of spigot servers run 1.8 at this point

#

so either there is not a single pvp server in the 1.9+ servers, or OCM is good enough for most people that aren't petty af or bstats sucks

hasty prawn
#

9% of servers doesn't necessarily mean 9% of the playerbase. I mean just look at Hypixel, they HAVE to support 1.8 so they're effectively locked to 1.8's features. Imagine what they could do if they had access to all the new stuff.

eternal night
#

hypixel does not use vanilla server software anyway

#

nor spigot or paper

sour loom
#

Is there a way to see a players client version?

peak depot
#

idk but maby its because 1.8.8 is not counting to 1.8

hasty prawn
#

It's still built off the vanilla server software is it not? 🤔

eternal night
#

nah

granite stirrup
eternal night
#

doubt it

hasty prawn
eternal night
#

if hypixel server software is still based of vanilla, they are doing something wrong

granite stirrup
hasty prawn
#

Well, either way, they're still locked to mainly 1.8 features because of clients :l

granite stirrup
#

cuz buildbattle has terracotta i think and thats a 1.12 feature

#

pretty sure

hasty prawn
#

Nope, it supports 1.8

granite stirrup
#

it does?

hasty prawn
#

I mean it might have terracotta but it must just change the block to 1.8 clients

eternal night
#

also very much something you could do btw.

#

enable 1.9+ features only for those clients

hasty prawn
#

So you're saying the server should take the time to make sure their stuff supports both versions?

eternal night
#

honestly they should just work out their combat update, release it any just keep watching 1.8 servers die

granite stirrup
#

ok but im pretty sure there is some 1.12 stuff

hasty prawn
#

Probably is

eternal night
#

if you think your userbase is petty enough for care about 1.8 combats vs OCM

#

then yeah, your server will have to do more work

hasty prawn
#

Could just be avoided if they added the gamerule, that's my point lol

#

People ARE petty enough to stay on 1.8

#

So all that effort & time going into new stuff is mostly wasted anyways

quasi flint
#

Ocm Not that Bad afaik

hasty prawn
#

Might as well put a little time into re-adding 1.8 combat and have ALL features be used!

quasi flint
#

Not many points that are bad

eternal night
#

dude, 1.16 was the most successful release of minecraft in a while

#

their work is definitely not wasted

quasi flint
#

Well there already is one

hasty prawn
#

Yeah OCM is great, and even my server we use latest with OCM. I'm not saying praise 1.8 and use it, nonono. I use latest.

It's just a MAJOR headache for everyone that people still play on a 6 year old version.

quasi flint
#

Neat

hybrid spoke
#

1.8 🤢

granite stirrup
#

but also whats keeping most people on 1.8 is performance

hasty prawn
#

Well true but that's an entire different issue LOL

hybrid spoke
#

performance? 1.12.2 & 1.16 are mostly more stable

quasi flint
granite stirrup
hybrid spoke
#

buy a better computer

granite stirrup
#

i dont mean laggy

#

i mean like its just slow

quasi flint
#

Well not everyone has money to do that

granite stirrup
#

the server is just like uses so much memory

quasi flint
granite stirrup
#

and it barley can handle 100 players

#

bungeecord cant even handle that much you have to balance out the players just to fix that

quasi flint
#

Rewrite resource intensive parts of the game would maybe welp

eternal night
#

it is a decade old code base ¯_(ツ)_/¯

quasi flint
#

That's what I am syaing

hybrid spoke
#

they did a huge step by upgrading to java 16

#

isnt that enough for the following 5 years?

granite stirrup
#

performance got worse in 1.17 tho

eternal night
#

lol

granite stirrup
#

it dropped like 100 fps

#

optifine only helps like gaining 5% back

quasi flint
#

At least it does smth

eternal night
#

sodium works a lot better

granite stirrup
quasi flint
granite stirrup
#

lol

eternal night
#

sodium is fabric

#

lmao

quasi flint
#

:v

#

:c

granite stirrup
#

i never tried sodium tho

eternal night
#

give it a shot

granite stirrup
#

¯_(ツ)_/¯

hasty prawn
#

Never even heard of Sodium, gonna try it. Ty 👀

quasi flint
#

Can't be worse

granite stirrup
#

maybe one day

quasi flint
#

And like 2 more

#

1 of em was Phosphor

chrome beacon
#

Sodium
Lithium
Phosphor
Hydrogen

#

Those are the mods maintained by JellySquid (and the Caffeine group)

timid kraken
#

is there an event for when the player has fully connected and loaded into the world?

#

PlayerJoinEvent fires before the player has loaded the world

granite stirrup
#

it shouldnt?

chrome beacon
timid kraken
chrome beacon
#

Then what's the problem?

granite stirrup
#

PlayerJoinEvent should fire as soon as the player loads into the world?

#

your server must be slow as ass if 1 tick delay doesnt fix it

timid kraken
#

i am prompting a resource pack installation it works fine locally but when i do it on my server (which gives me like 150ping and slow world load) it shows for a sec then dissapears before i even have the chance to interact with it

granite stirrup
#

then just do more delay?

timid kraken
#

so is there an event for a full load/connection?

chrome beacon
#

Don't think so

timid kraken
granite stirrup
#

pretty sure PlayerJoinEvent does that

timid kraken
granite stirrup
#

¯_(ツ)_/¯

coral sorrel
muted idol
#

hey there how would i go about parsing (getting) the CheckpointCounter int?
json code:

{
    "CheckpointInfo": {
        "CheckpointCounter": 0
    }
}
granite stirrup
#

it dropped alot of fps

coral sorrel
#

what did it drop?

#

not really

#

have the same fps as before

granite stirrup
#

about 100 fps dropped

coral sorrel
#

some say they even have more fps

#

on 1.17

granite stirrup
#

it dropped like 100 fps on 1.17

coral sorrel
#

for you

#

doesn't mean for everyone

granite stirrup
#

in singleplayer

#

but in multiplayer i have the same fps in 1.16

coral sorrel
#

and?

granite stirrup
#

it still dropped alot in singleplayer

chrome beacon
#

It depends on many things

#

For some people it got better and for others not

slow oyster
#

Does anyone use Hibernate or something similar in their plugins at all?

granite stirrup
#

?

slow oyster
#

I've been using a yaml file basically as a flat file database at this point and it's getting a bit ridiculous now

granite stirrup
#

¯_(ツ)_/¯

#

idk wtf Hibernate is

#

probs go to help-server

slow oyster
#

It's an ORM

granite stirrup
#

this is for development help not for helping with a plugin

slow oyster
#

No lol, it's an ORM for managing relational databases

granite stirrup
#

¯_(ツ)_/¯

#

idfk

slow oyster
#

true to your name I guess

granite stirrup
#

i dont use orm

#

or hibernate

#

dont even know what it is

#

cuz never heard of it

torn oyster
#

?paste

undone axleBOT
torn oyster
#

okay

unreal quartz
torn oyster
#

so i use the same method for connecting with mysql

unreal quartz
#

it's too.. 'enterprisey' for a simple application such as a spigot plugin

torn oyster
#

i used this method on my discord bot

#

im now making my plugin

#

but now it breaks

#

on my plugin

#

when it works fine on my discord bot

#

its giving this error

unreal quartz
#

maybe

#

if you sent code

#

and stopped typing like this

torn oyster
#

yes im doing that

slow oyster
#

True, I basically use it every day in work so I thought it'd be useful to use it in my plugin too

austere cove
#

When I'm in creative and I use my number keys InventoryClickEvent doesn't have ClickType.NUMBER_KEY

#

halp

unreal quartz
#

if you're used to using it then go for it

granite stirrup
unreal quartz
#

but i usually just handle the mappings myself

#

what is line 31..

#

whatever it is it's null

unreal quartz
#

Class.forName("com.mysql.cj.jdbc.Driver"); is that correct?

granite stirrup
#

LOLLLLLLL

austere cove
#

idk if that would get the correct click type tho

austere cove
#

hold on

torn oyster
#

i tried without cj

granite stirrup
#

it has been months and forge still doesnt have 1.17

torn oyster
#

it says

#

"outdated class"

#

or something

unreal quartz
#

you still haven't told me what line 31 is

torn oyster
#

well this is on discord

#

line 31 is setConnection

#

and the rest of the stuff

granite stirrup
#

forge doesnt support 1.17

#

lol

unreal quartz
#

what is DriverManager

torn oyster
#

a java sql class

granite stirrup
#

forge is really fucking late to the party

torn oyster
#

that connects to a database

unreal quartz
#

still unconvinced that path is correct

torn oyster
#

what do you think it is

unreal quartz
#

and you're not even doing anything with is

torn oyster
#

you have to do that

unreal quartz
#

com.mysql.jdbc.Driver, you can check inside the spigot jar yourself

torn oyster
#

it initializes the class

#

it isnt in spigot

unreal quartz
#

yes it is

torn oyster
#

so they have their own version of it

#

wtf

unreal quartz
#

it's mysql connector/j, which is packaged with spigot

torn oyster
#

how do i not package it with spigot

unreal quartz
#

you don't not package it with spigot

torn oyster
#

now i know why it isnt working

unreal quartz
#

you use it

torn oyster
#

yes but i am using another mysql connector

unreal quartz
#

well then

#

have fun

austere cove
eternal oxide
austere cove
#

action PLACE_ALL, type CREATIVE

eternal oxide
#

try just calling getHotbarButton() See if it returns anything other than -1

#

you could always getClick().isKeyboardClick() then test the hotbar

austere cove
#

nope slot is -1

eternal oxide
#

Broken then 😦

quaint mantle
unreal quartz
#

could consider deferring the handling of each argument to other classes if you ever plan on expanding that command

quaint mantle
#

My question is, is the code bad?

#

🥲

unreal quartz
#

and you might want to inform the user that they can't access it from console rather than just having no feedback

#

not bad

austere cove
#

it's kinda messy

unreal quartz
#

just gonna have a lot more if/else if you ever plan on adding to that command, and soon you will have a 600 line long file

ivory sleet
unreal quartz
#

is homesManager a class?

quaint mantle
unreal quartz
#

any reason the whole thing is static

ivory sleet
#

Your code is fragile and rigid to start with

quaint mantle
ivory sleet
#

First of all that nasty if else statement chain

#

Create an abstraction for each sub command

chrome beacon
#

Switches, language managers sub classes and general clean up to make the code easier to follow

ivory sleet
#

A function/method should only do one thing so another tip is to extract larger methods

granite stirrup
#

my brother ran 1.17 on java 8 in the minecraft launcher

#

how

#

he didnt change anything

chrome beacon
#

Also please follow naming conventions for class names

unreal quartz
#

well he didn't

ivory sleet
#

Also try not to jump from low to high level but that’s kinda enterprise pedantic thingy

granite stirrup
#

i never seen him download java 16

unreal quartz
#

ok

granite stirrup
#

and he played with me on it before

quaint mantle
unreal quartz
#

doesnt minecraft download java now

granite stirrup
#

oh maybe it does but idk

ivory sleet
#

Dimensions google what polymorphism is

#

And inheritance

quaint mantle
austere cove
#

figured out it's a limitation of the protocol spec

ivory sleet
#

Start with learning Java capabilities fully, like for instance abstract classes, interfaces and such.

#

Then learn SOLID and design patterns.

austere cove
#

when you double click an item in your inventory to stack all items of the same type, is there a way to tell what slots you took items from?

ivory sleet
#

But fragile means that changing one part of the code would end up changing the behavior of your another part of your code, which now when I think of it might not be very visible in your code.

Rigid means when you want to change something it often leads to you having to change major parts of your code and ultimately changing something isn’t as trivial as it could be.

Just a short explanation

quaint mantle
#

I got it, thanks. That's what was happening

#

Would it be recommended to put the ifs in the function?

ivory sleet
#

To prevent this we to make sure higher level modules don’t depend on lower level ones. This can be done by adhering to SOLID. Although to understand SOLID fully a good knowledge of OO and Java is a fundamental demand.

granite stirrup
#

sad when you want to require something thats in a folder up you have to do in lua lua package.path = package.path .. ';../?.lua'

ivory sleet
#

Uh yeah dimensions arguably

#

Usually creating a lot of functions which get composed to larger ones cleans your code.

#

Partly because we can have useful names for every function we declare.

quaint mantle
#

Would you like to make a messaging system by function, how would you recommend?

#

I currently use it.

#

🥲

ivory sleet
#

Uh that can be useful but make those fields final

#

Also read on the official Java naming specifications

prisma needle
#

I figured out how to make a tab completer for my command, however for some reason it stops working when there are more than 1 arg. It should suggest a tab completion of the number of args the command has, however it only shows "1". Likewise, if (args.length == 2) doesn't do anything. Any reason why the args would get messed up like that? (Bungeecord)

        Collection<String> suggestions = new ArrayList<>();
        suggestions.add(String.valueOf(args.length));
        return suggestions;
    }```
ivory sleet
#

That sound weird, your code looks like it would complete the args.length every time

chrome beacon
#

I really miss the Brigadier system for spigot. I know Commodore exists for bukkit but doesn't look like it works for bungeecord

river spear
#

java.lang.ClassCastException: class org.bukkit.craftbukkit.v1_16_R3.inventory.CraftItemStack cannot be cast to class org.bukkit.inventory.meta.MapMeta (org.bukkit.craftbukkit.v1_16_R3.inventory.CraftItemStack and org.bukkit.inventory.meta.MapMeta are in unnamed module of loader 'app')

     MapView view = meta.getMapView();
     view.setScale(MapView.Scale.FARTHEST);
     meta.setMapView(view);
     this.getMapItem().setItemMeta(meta);``` i have a error but why
vital ridge
#
@EventHandler
    public void onJoin(PlayerJoinEvent e) {
        
        Player p = e.getPlayer();
        
        IChatBaseComponent header = ChatSerializer.a("{\"text\":\"" + "§cWelcome!" + "\"}");
        IChatBaseComponent footer = ChatSerializer.a("{\"text\":\"" + "§cEnjoy!" + "\"}");
        
        PacketPlayOutPlayerListHeaderFooter packet = new PacketPlayOutPlayerListHeaderFooter();
        
        try {
            Field field = packet.getClass().getDeclaredField("f");
            field.setAccessible(true);
            field.set(packet, footer);
            
        } catch (Exception x) {
            x.printStackTrace();
        }
        
        ((CraftPlayer) p).getHandle().playerConnection.sendPacket(packet);
        
    }

I use this code but I get a nosuchfieldexception. How do I know whats the field called?

#

Do I have to manually check it?

#

Or like how is it in reflection?

quaint mantle
#

Anyone know how to make a sign input gui? I have done a lot of research but cannot find a way to make one.

chrome beacon
river spear
#

thanks

chrome beacon
vital ridge
#

With a nullpointerexception on screen.

vital ridge
#

1.16.5

chrome beacon
#

Then why are you using reflection for this

#

It's part of the API

vital ridge
#

Just to get more knowledge on this.

#

I know it is.

chrome beacon
#

Anyway for your nullpointer I'm guessing you need to set the header too

#

Decompile the class and see what it contains and then use reflection accordingly

vital ridge
#

Tho what do i need to check for to fill the declaredField?

#

The method parameter names?

chrome beacon
#

Well you should check everything

#

You need to know what things do

vital ridge
#

Aigh

chilly reef
#

is there a way to be more specific with the PlayerDeathEvent without using EntityDamageEvent.DamageCause because it does not show entity type

granite stirrup
#

.getEntity()?

#

or .getPlayer()?

chilly reef
#

doing that gets the player thats dying not the entity that is killing the player

granite stirrup
#

wait no

#

getDeathMessage()?

chrome beacon
#

getKiller can be used if it's a player

granite stirrup
#

or maybe getEntityType()?

chilly reef
#

get entity type would be player because it is asking for the dying player not the damaging entity

#

getDamager also does not work for some reason

granite stirrup
#

getKiller()?

chilly reef
#

only works if its a player that kills the player

granite stirrup
#

then switch to entitydeathevent

#

idk

chilly reef
#

okay i will try that thanks

unreal quartz
#

get the last damage cause

#

it will return the associated damage event

#

from which you can get the entity

chilly reef
#

how would i get the entity from that

#

oh i found it

unreal quartz
#

make sure it's an instance of EntityDamageByEntityEvent

chilly reef
#

with customizing death messages as context would that still work

chrome beacon
#

Most of the time

chilly reef
#

if(player.getLastDamageCause().getEntityType().equals(EntityType.)); this works

#

thanks

chrome beacon
#

The message will be messed up if something cancels the damage event

#

I would store entities in a weakmap

final monolith
chrome beacon
#

?paste

undone axleBOT
final monolith
#
package net.redewhite.Data;

import org.bukkit.Bukkit;
import org.bukkit.configuration.file.FileConfiguration;
import org.bukkit.entity.Player;
import org.bukkit.plugin.java.JavaPlugin;

import java.io.File;
import java.io.IOException;
import java.util.HashMap;

public class Main extends JavaPlugin {

    private static Main p;

    public HashMap<DataAPI, Player> data = new HashMap<>();

    public void onEnable() {
        p = this;
        saveDefaultConfig();
        Bukkit.getPluginManager().registerEvents(new Events(), this);
        for (Player p : getServer().getOnlinePlayers()) {
            API.loadVariables(p);
        }
    }

    public void onDisable() {
        for (Player p : getServer().getOnlinePlayers()) {
            API.saveVariables(p);
        }
    }

    public HashMap<DataAPI, Player> getData() {
        return data;
    }

    public static Main getInstance() {
        return p;
    }

    public void saveCustomConfig(FileConfiguration ac, File a) {
        try {
            ac.save(a);
        } catch (IOException e) {
            e.printStackTrace();
        }
    }

    public HashMap<DataAPI, Player> getDataHashMap() {
        return data;
    }

}

chrome beacon
#

?paste

undone axleBOT
final monolith
#

oh sorry

granite stirrup
#

two things i hate in that code

#

"package net.redewhite.Data;"

chrome beacon
#

Just 2 👀

granite stirrup
#

and you named your class "Main"

granite stirrup
#

i didnt look at all of it

final monolith
#

sorry guys im starting 😅

granite stirrup
#

its fine its just i dont like the capital in Data

unreal quartz
#

you have sent the wrong class

final monolith
unreal quartz
#

net.redewhite.Data.API.loadVariables(API.java:29)

granite stirrup
#

and you should name your main class as the plugin name

unreal quartz
#

you should learn to read these stacktraces

granite stirrup
#

not Main.java

granite stirrup
#

playerConfig.getConfigurationSection(uuid).getKeys(true) this is null

#

pretty sure

final monolith
#

the error is because the configuration section is not set?

granite stirrup
#

is it in your file?

#

pretty sure it needs to be

final monolith
#

yeah, i think that is this

#

im gonna insert a if (!uuid == null)

granite stirrup
#

not the uuid

final monolith
#

its a example

#

😅

granite stirrup
#

i think you need to do before for loop if(!playerConfig.isSet(uuid)) return; but dont ask me on that one

final monolith
#

yeah, i will do this

dense pulsar
#

Is there any way to slap some data onto a player object that will stay on join/leave?

#

without writing to a file.

hexed hatch
#

?pdc

opal juniper
#

Lmaooo

dense pulsar
#

O::::

opal juniper
#

Literally the use of a pdc

granite stirrup
#

1.14+ though

opal juniper
#

Like you were describing it

eternal night
#

the agressive double slap

dense pulsar
#

I figured something like that existed lmao

eternal night
#

but not for the 1.8 plebs :>

#

makes me very happy

dense pulsar
#

am in 1.16.5

granite stirrup
opal juniper
#

Good

granite stirrup
#

1.16.5 has it

opal juniper
eternal night
hexed hatch
#

Imagine using 1.8 in 2021 lol

dense pulsar
#

i'll do 1.17 once I stop doing my worldedit cheese with commands and just use their API

granite stirrup
#

1.17 isnt stable

#

i recommend not using it

ivory sleet
#

I mean pdc still has to write/read to the disk

eternal night
#

wow xD

#

also 1.17 isn't stable ? what

opal juniper
granite stirrup
hexed hatch
#

I've had a server running on 1.17, it's pretty damn stable at this point

eternal night
#

you good ? 1.17 is latest isn't it

hexed hatch
#

But I am on Paper

ivory sleet
#

idkidk that’s the part I’m unsure of lol

eternal night
#

paper 1.17 has also been marked as "stable enough"

opal juniper
#

Paper cool

granite stirrup
#

fortnite has this new thing with a roblox logo on it

#

lol

opal juniper
#

Shut it

hexed hatch
#

That's so cool but who asked

ivory sleet
#

Yatopia tho hypixel_this_is_fine

granite stirrup
#

idk i saw it

hexed hatch
#

Wow that's a relevant topic thanks for sharing said absolutely no one

granite stirrup
ivory sleet
#

No need to be rude now

final monolith
#

solved, @granite stirrup thanks

opal juniper
sharp bough
#

when you do Bukkit.gerServer().getVersion() you get the version of the spigot.jar of the server, or the version of the player?

granite stirrup
opal juniper
#

Player version lmao

ivory sleet
#

Oh yeah didn’t they disband the project jeff

ivory sleet
opal juniper
#

What will I do now

sharp bough
#

but does the player version matter?

granite stirrup
#

it says in there discord

hexed hatch
#

Player version does matter lol

#

I mean, in what way are you wanting to know how it matters?

sharp bough
#

if you allow a player using 1.8 join a 1.16 server, this works just fine right?

opal juniper
ivory sleet
#

What a good reason, totally couldn’t figure that out 😌

sharp bough
opal juniper
hexed hatch
granite stirrup
#

how do you get client version?? nms?

opal juniper
#

No

sharp bough
hexed hatch
#

Probably by intercepting packets or some shit if it even is possible

opal juniper
#

Yeah probably in the handshake packets or something

chilly reef
#
    @EventHandler
    public void deathEvents(PlayerDeathEvent e) {
        Player player = e.getEntity();
        if(player.getLastDamageCause().equals(EntityDamageEvent.DamageCause.FALL));{
            e.setDeathMessage(player.getDisplayName() + " landed on their feet and fucking died.");
        }
        if(player.getLastDamageCause().equals(EntityDamageEvent.DamageCause.BLOCK_EXPLOSION));{
            e.setDeathMessage(player.getDisplayName() + " got 9/11'ed");
        }
        if(player.getLastDamageCause().equals(EntityDamageEvent.DamageCause.ENTITY_EXPLOSION));{
            e.setDeathMessage(player.getDisplayName() + " got 9/11'ed");
        }
        if(player.getLastDamageCause().getEntityType().equals(EntityType.SKELETON));{
            e.setDeathMessage(player.getDisplayName() + " was shot by a boner.");
        }
        if(player.getLastDamageCause().getEntityType().equals(EntityType.ZOMBIE)){
            e.setDeathMessage(player.getDisplayName() + " was eaten alive");
        }
    }
``` i just tested this by tping to y100 and falling and the message was the skeleton message
granite stirrup
#

that sucks

#

lua doesnt have switch cases

dense pulsar
#

@chilly reeflol wtf

#

you are putting semicolons at the end of the if statement

chilly reef
#

oh i didnt realize

dense pulsar
#

furthermore

chilly reef
#

all of the messages are the skeleton one i guess

#

even ones that i didnt specify

dense pulsar
#

you should also use else ifs

#

so you aren't checking the conditions unnecesarily

chilly reef
#

whats that

granite stirrup
#

?learnjava

undone axleBOT
chrome beacon
quaint mantle
#

😭

chilly reef
#

shhh

dense pulsar
sharp bough
#

bro thats fucked up

quaint mantle
#

Lmfao

granite stirrup
#

?

chrome beacon
#

Wouldn't kintetic energy fit better

chilly reef
#

maybe but explotions work too

dense pulsar
#

i mean in the future yes, but he isn't just checking the EntityDamageEvent but also the EntityType which is an obj

#

it'd work for the first couple though

quaint mantle
#

where are they checking the entitytype?

chilly reef
#

for death message

quaint mantle
#

oh wait

#

i see what you're saying, was confused for a second

dense pulsar
#

also, I have a question ```java
event.setCancelled(true);
player.damage(1);

new BukkitRunnable() {
    @Override
    public void run() {
        player.setFireTicks(60);
    }
}.runTaskLater(plugin, 1);
#

is this a legit way to do it or am I being dumb

#

heres the full method ```java
@EventHandler(priority = EventPriority.HIGHEST)
public void onArrowHit(EntityDamageByEntityEvent event) {

    if (!(event.getEntity() instanceof Player)
            || !(event.getCause().equals(EntityDamageEvent.DamageCause.PROJECTILE))
            || !(event.getDamager().getType().equals(EntityType.ARROW)))
        return;

    Player player = (Player) event.getEntity();
    if (!PartyManager.inAMiniGame(player)) return;

    event.setCancelled(true);
    player.damage(1);

    new BukkitRunnable() {
        @Override
        public void run() {
            player.setFireTicks(60);
        }
    }.runTaskLater(plugin, 1);
}
ivory sleet
#

Wat

dense pulsar
#

how so

#

np

chilly reef
dense pulsar
# chilly reef i removed the semi colons but all of the messages are the default messages
    @EventHandler
    public void deathEvents(PlayerDeathEvent e) {
        Player player = e.getEntity();
        if (player.getLastDamageCause().getCause() == null) return;

        if (player.getLastDamageCause().getCause() == EntityDamageEvent.DamageCause.FALL){
            e.setDeathMessage(player.getDisplayName() + " landed on their feet and fucking died.");
        }
        else if (player.getLastDamageCause().getCause() == EntityDamageEvent.DamageCause.BLOCK_EXPLOSION){
            e.setDeathMessage(player.getDisplayName() + " got 9/11'ed");
        }
        else if (player.getLastDamageCause().getCause() == EntityDamageEvent.DamageCause.ENTITY_EXPLOSION){
            e.setDeathMessage(player.getDisplayName() + " got 9/11'ed");
        }
        else if (player.getLastDamageCause().getEntityType() == EntityType.SKELETON) {
            e.setDeathMessage(player.getDisplayName() + " was shot by a boner.");
        }
        else if (player.getLastDamageCause().getEntityType() == EntityType.ZOMBIE){
            e.setDeathMessage(player.getDisplayName() + " was eaten alive");
        }
    }
granite stirrup
#

@ivory sleet lua makes me very sad :( theres no switch cases

dense pulsar
#

dont use lua then

#

luaser

granite stirrup
#

i have to

#

im using computercraft 🙄

dense pulsar
#

lol lua was the only reason I didn't get super into computercraft

ivory sleet
#

It protects you from writing rigid code

granite stirrup
#

atleast i have fake switch cases

ivory sleet
dense pulsar
#

back in my day we just try catched everything! didnt even use if statements

ivory sleet
granite stirrup
#
local test= {
        ["Something"]=function() print("test1") end,
        ["Something2"]=function() print("test2") end,
        ["Something3"]=function() print("test3") end
}

local test2 = {"Something","Something2","Something3"} 

for index, value in ipairs(test2) do
  test[value]()
end
ivory sleet
#

Map where the values are functions?

granite stirrup
#

its kinda like switch cases

ivory sleet
granite stirrup
#

["Something"] is the case

#

function() print("test1") end is what gets run

#

idk

ivory sleet
#

Btw

#

Doesn’t lua have the arrow syntax

granite stirrup
#

?

granite beacon
#

Why am I getting the error

[18:38:43 ERROR]: Could not pass event ProjectileHitEvent to LearningSpigot v1.0-SNAPSHOT
java.lang.NullPointerException: null

When doing this

@EventHandler
    public void onShootSnowball(ProjectileLaunchEvent e){
        System.out.println(e.getEntity().getType().toString());
        if (e.getEntity().getType().equals(EntityType.SNOWBALL)){
            addProjectile((Entity) e.getEntity());
        }
    }

    @EventHandler
    public void onShootSnowball(ProjectileHitEvent e){
        System.out.println(e.getEntity().getType().toString());
        if (e.getEntity().getType().equals(EntityType.SNOWBALL)){
            removeProjectile((Entity) e.getEntity());
        }
    }
public class projectileHelper {
    public static Set<Entity> projectiles;

    public static boolean addProjectile(Entity e){
        projectiles.add(e);
        return true;
    }

    public static boolean removeProjectile(Entity p){
        projectiles.remove(p);
        return true;
    }
}
eternal night
#

if only you had java 15+

#

tho looking at it projectiles seems very null xD

granite stirrup
#

yeah but also doesnt the projectile get deleted?

#

when it hits

#

so wouldnt it not work anyway???

eternal night
#

what

#

the static set in the projectHelper

granite stirrup
#

no i mean in the game

granite beacon
granite stirrup
#

wouldnt the entity not exist anymore after it hits?

granite beacon
#

it's still in the set

#

but I think you can still get it

granite stirrup
#

the entity doesnt exist anymore isnt that object gonna be useless

eternal night
#

but it has to be removed from the set, else you are leaking memory

granite beacon
#

the weird thing is when I print e.getEntity().getType() it print out the type

public void onShootSnowball(ProjectileLaunchEvent e){
        System.out.println(e.getEntity().getType().toString());
        if (e.getEntity().getType().equals(EntityType.SNOWBALL)){
            System.out.println(e.getEntity().getType().toString());
        }
    }
#

but when I try to add it to the set it does the null error

granite beacon
granite stirrup
#

because the Set is null

eternal night
#

your set is just null my man xD