#help-development

1 messages · Page 148 of 1

pseudo hazel
#

wow, that looks like witchcraft xD

flint coyote
#

that looks cool. Is that a resourcepack? :D

shrewd sphinx
#

yeah

#

honestly much easier than expected

flint coyote
#

Why is there double vip tho?

shrewd sphinx
#

one is vip+

#

see da little +

flint coyote
#

yeah just saw it when I made it larger

shrewd sphinx
#

lol

#

imma try doing bigger frames

flint coyote
#

but the + is not symetric

lethal knoll
#

Someone who can please explain me why that 2nd dependency doesn't want to resolve? Trying to import NMS for 2 hours now

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <groupId>org.example</groupId>
    <artifactId>NMSProject</artifactId>
    <version>1.0-SNAPSHOT</version>

    <properties>
        <maven.compiler.source>15</maven.compiler.source>
        <maven.compiler.target>15</maven.compiler.target>
            <spigot.version>1.19.2-R0.1-SNAPSHOT</spigot.version>
    </properties>

    <repositories>
        <!-- This adds the Spigot Maven repository to the build -->

        <repository>
            <id>spigot-nms</id>
            <url>https://repo.codemc.io/repository/nms/</url>
        </repository>
    </repositories>


    <dependencies>
        <dependency>
            <groupId>org.spigotmc</groupId>
            <artifactId>spigot-api</artifactId>
            <version>${spigot.version}</version>
            <scope>provided</scope>
        </dependency>

        <dependency>
            <groupId>org.spigotmc</groupId>
            <artifactId>spigot</artifactId>
            <version>${spigot.version}</version>
            <scope>provided</scope>
        </dependency>
    </dependencies>


</project>
shrewd sphinx
#

surprisingly it is

flint coyote
#

looks off on the screenshot xD

shrewd sphinx
#

true

iron glade
#

twitch is missing the daker layer behind the text

pseudo hazel
#

I think you need to convert it to a normal array

#

i.e. Type[]

#

then you can pass it

#

yeah thats fine

#

yeah but its the only way afaik

shrewd sphinx
iron glade
shrewd sphinx
golden turret
#

How those custom bars works?

shrewd sphinx
#

texture packs

#

basically:

golden turret
#

Wait

shrewd sphinx
#

texture pack

golden turret
#

I meant another custom bars

shrewd sphinx
#

no texture pack

#

yeah

#

textures too

#

same princible

golden turret
#

I meant the ones that goes here

#

they place it basically anywhere

#

how

shrewd sphinx
#

texture offsetting using actionbars

golden turret
#

how

echo basalt
#

negative width characters

#

usually the top bars are made with bossbars

#

then you do the rest with actionbars

#

just send a bunch of aligned characters

#

there are unicode characters for positive and negative X alignment

#

so like

#

<space.-20>text would make "text" appear 20 pixels to the left

#

thing is you can make a custom font that just renders a special chinese unicode character as any image

#

Which is how servers make custom guis

#

just set the image on the gui's title

fluid river
#

noobs are all sleepin'

vocal cloud
#

Idk you made that really overly complicated thing earlier 👀

#

You were poking at them I poked at you lol

sterile token
#

Hey stop it

#

Stop it

vocal cloud
#

Well they thought you wanted to make the block class itself contain a method for it or something iirk.

prime reef
#

Are hex chat colors broken now or something? A method that worked perfectly before no longer works.

#

Had a chat color gradient generator, updated the plugin for 1.19.2 (from 1.18) and now it's just

#

yo

#

nah

#

this was always my own IP

#

i worked on embercore/emberrpg long before that server rolled around

#

emberrpg dates back to 2017 actually

#

i have a six figure TC package now, no way in hell would I ever go back to them

#

actually, I can build a 1.18 server and test this, because the plugin is cross compatible

#

but it seems like what's happening is that ChatColor.of is just building a string along the lines of §x§f§f§0§0§0§0 for pure red (#ff0000) and only the last color is registering - or in this case, it's supposed to be a gradient from black -> blue -> aqua and the second half of the blue section is being treated as its own color code

#

you still with your new company as well?

#

i'd hope so

#

java is...it's alright.

#

they're adding SIMD support now, which is wild

#

would actually make some of the work i'm doing a lot more efficient, too

#

i kinda want to just finish emberrpg because i have the free time to do it for now, and because i still feel like there's a lack of a genuinely flexible and comprehensive rpg plugins out there

#

though I guess part of the reason for that is that I still haven't found a particularly flexible serialization/deserialization API for Spigot; the one that Spigot has built in is pretty awful, tbh

#

i mean. i straight up wrote one and it works great, but obviously that's super under the radar even though it's open source

#

i don't expect anything i write to be popular lmao

#

hopefully no RPG-oriented minecraft servers since those seem to cause catastrophe 😔

prime reef
#

nice, all the pet plugins rn are sus

#

been working on uhh

#

3d model stuff from blockbench files, actually

#

feel free to hit me up if you're implementing that

#

granted, all I have to do is name the fields in the data classes after the fields in the JSON for a blockbench model and the data loads itself

#

at the end of the day, though, it's still weirdly simple to pull the data in, and I wanted to make that accessible to more people, because rn the only plugin with any real 3d model integration is ModelEngine, and uh

that's not free

#

which sucks

#

that's what i meant, yeah, api

#

i'm not making any myself, just gonna use the demo ones from modelengine to test since they use the same file format

quaint mantle
#

tips on making java code more optimized?

prime reef
#

figure out what you need to optimize, first and foremost

#

don't spend 3 hours microoptimizing something with no overhead

#

first step is to profile your code

#

i think that's more about readability/etc.

#

and proper code structure

#

you can have very well structured code that runs slow as shit

#

like maybe you're unintentionally doing an O(n^3) operation somewhere

#

also a lot of java patterns suck ass

#

factories can shove it

#

not talking about universal patterns like MVC, those are solid

#

builders are fine too

#

factories are something else entirely

#

enterprise java level shit

#

i've looked extensively into what the point of a factory is and i just cannot find one that can't be addressed by just not writing shit code

#

but again, builders/etc. are used in other languages too

#

only java, and specifically enterprise java, seems to use the bullshit ones

#

anyway, offtopic from the original question, mb

prime reef
quaint mantle
#

okay

#

thanks so much

prime reef
#

feel free to ping me if you've got a specific question

quaint mantle
#

👍

prime reef
#

sure wish Java could use pointers, though

quaint mantle
#

one question rq

#

im making a generator plugin ( drops an item above a block ) and im looping around 10k locations at a time. Im thinking of using more than 1 thread is there a way to do that?

fluid river
#

nah

fluid river
#

and learn java

prime reef
#

more details?

#

why are you going through so many locations?

#

look at your algorithm before you look at multithreading

fluid river
prime reef
#

simplest solutions first

fluid river
#

but for dropping items you have to go back to the main thread

quaint mantle
#

yeah

prime reef
#

also yeah item spawns are sync thread

fluid river
#

most of the mc is sync

prime reef
#

anything that affects the game world belongs in sync, basically

#

but anything that doesn't need to be applied to the game world in real time can be computed async

#

like...I save data async so it doesn't lag the server if there are 3k people on lmao

quaint mantle
#

yeah

#

im using json atm

#

should i look into mysql?

prime reef
#

i have no idea what you're doing with it

abstract sleet
prime reef
#

i'm working on a format-agnostic data/config system that can be saved to remote SQL servers, but

flint coyote
quaint mantle
#

just storing a string "0||0||0" then parsing it as a location

prime reef
quaint mantle
#

aka spiting the string

prime reef
#

lmao

#

also

#

wait, why aren't you just using a regular config

#

even spigot config supports serializing vectors

abstract sleet
prime reef
#

I still don't know why you're going through 10k locations, either

#

what does this plugin do and why

quaint mantle
#

okay so, you place generators then every x seconds i'll drop an item above that generator. Then you can sell that drop for money

#

and you can upgrade generators

prime reef
#

aye

#

right

fluid river
#

you can store with , btw

quaint mantle
fluid river
#

to split later

prime reef
#

that's fair actually, there's no real way to avoid doing that

#

however

#

I'll say this much

fluid river
#

one task for every block goes wroooooooom

abstract sleet
#

make sure you are not trying to access generators from unloaded chunks

quaint mantle
fluid river
#

See, my sweat is all around
See, my t-shirth's never drought
Didn't know which, which way to turn
Code was cool but my P-C burnt

quaint mantle
flint coyote
prime reef
#

10k operations isn't actually a whole lot either, I was worried you were doing something that was gonna scale super hard

prime reef
#

though if it really becomes a problem

quaint mantle
prime reef
#

some kind of stateful cache would be helpful

#

e.g. maintain a set of generators in loaded chunks so you don't query unloaded ones

flint coyote
#

cache the loaded ones with chunk load and unload event ye

prime reef
#

but yeah the timestamp thing is what I was going to suggest

quaint mantle
#

i was thinking of calculating the amount of the type of generators then just drop x amount at the last generator

prime reef
#

It's actually how Core Keeper handles automated drills/etc

quaint mantle
#

instead of dropping on every block

flint coyote
prime reef
#

because Core Keeper unloads the game world if you're not in those chunks, but drills will still process ore chunks, and the reason for this is actually that they do something similar - each drill stores damage while it's running, then applies that damage to the block in front of it when it loads again

#

so if you leave it alone for an hour, it effectively stores an hour's worth of damage, which then drops an assload of ores from the ore chunk

prime reef
fluid river
#

just make generators stack for each players

quaint mantle
#

thinking of just doing this

#

private Map<UUID, Map<Material, List<Location>>> map = new HashMap<>();

wind tulip
#

Does anyone know how to get the item that was clicked in an InventoryClickEvent? event.getCurrentItem() and event.getCursor() are the two things I've tried so far

fluid river
#

so instead of 1 drop player will have one extra generator

#

which drops 100 items

#

at a time

#

so you avoid having 9999 locations for each player

abstract sleet
#
{
  "tier": 1,
  "material": "IRON_INGOT",
  "location" {
      "world": "world",
      "chunk" {
        "x": 50,
        "z:" -32
      },
      "coordinate" {
        "x": 12345,
        "y": 12345,
        "z": 12345
      }
  }
}

maybe this can help @quaint mantle

prime reef
#

Also, from a gameplay perspective, you can probably get around this by making progressively more powerful tiers of generator instead

fluid river
#

literally what i just mentioned

prime reef
#

It's what Slimefun does - you just keep upgrading shit instead of making a bunch of new ones, unless you REALLY need extra power, etc.

#

so instead of like 9 solar generators, you just make the next tier up

prime reef
#

I read it as "add more generators but only have one drop the items, then increase the item drop count based on how many generators are registered to that player"

prime reef
fluid river
#

i'm just dumb

prime reef
#

straightforward data formats 😤

fluid river
#

sometimes

prime reef
#

you can't avoid shitty unintelligible formats in my field, sadly

prime reef
#

the idea was good

#

easier to correct a miscommunication than fix a bad idea lmao

#

my boss and I do this thing where we approach a problem from similar angles but communicate those ideas in different ways and more than once we've ended up stopping dead for a second as we realize we've been saying the same thing for 15 minutes

fluid river
#

that's why i write code, not words

#

so easy to communicate by sending the code

prime reef
#

honestly for other devs yeah

wind tulip
#

Does anyone know how to get the item that was clicked in an InventoryClickEvent? event.getCurrentItem() and event.getCursor() are the two things I've tried so far

fluid river
#

today i used while loop to talk to my gf lmao

wind tulip
#

returns air for me

fluid river
#

getCursor returns item which is on cursor(which you are dragging or something)

wind tulip
#

I know

fluid river
#

well you probably messed up the code

#

or literally clicked air

wind tulip
#

getCurrentItem returns the item in the slot that was clicked, but it only returns this value after you click

wind tulip
fluid river
#

idk

#

lmao

#

show ur code

quaint mantle
#

suggestions?

wind tulip
#

"Gets the ItemStack currently in the clicked slot."

quaint mantle
#
    public static void createGenerator(Player player, Location location) {
        Material mat = location.getBlock().getType();
        Map<Material, List<Location>> map = new Storage().map.get(player.getUniqueId());
        List<Location> list = map.containsKey(mat) ? map.get(mat) : new ArrayList<>();
        list.add(location);
        map.put(mat, list);
    }```
wind tulip
#

currently refers to after the event

fluid river
abstract sleet
#

@quaint mantle if you want to go the MySQL route this might work

CREATE TABLE Generators (
    GeneratorId     INT          NOT NULL PRIMARY KEY,
    Tier            TINYINT      NOT NULL,
    Material        VARCHAR(64)  NOT NULL,

    LocWorldName    VARCHAR(128) NOT NULL,
    
    LocChunkX       INT          NOT NULL,
    LocChunkY       INT          NOT NULL,

    LocCoordX       INT          NOT NULL,
    LocCoordY       INT          NOT NULL,
    LocCoordZ       INT          NOT NULL
);
fluid river
#

no

#

it doesn't

quaint mantle
fluid river
#

and never refered

wind tulip
#

okay then I'll just double check I guess?

#

Bukkit.broadcastMessage(Objects.requireNonNull(event.getCurrentItem()).getType().toString()); not sure how this could lie to me

fluid river
#

idk

#

Like that's the only way i checked which item i clicked on

wind tulip
#

ok wait no you're right

fluid river
#

?

wind tulip
#

oh I see

fluid river
#

???

wind tulip
#

what

#

I figured it out

prime reef
fluid river
#

is this like a visual bug or smth

fluid river
quaint mantle
#

its just a function for the generator place

prime reef
#

store a last-generated timestamp in each generator

#

then calculate how many items it should output based on its next update time

#

that way generators that have been unloaded for a while will still output the correct amount of items

sterile token
#

Who is tagging me?

fluid river
#

nobody?

#

me

#

you

#

@fluid river

#

lmao got self-tagged

arctic moth
#

wrong server oops

fluid river
#

meow

arctic moth
#

whatever

fluid river
#

hey guys how do i code scdehuler which scdehules after server restart + 5 nanosex. I had been wanting to store player's inventory lore and history to hashmap of primitive ints. So when scdehuler scdehules i run -Xmx128M and pass lore as args

also where is a way to increase tickrate to 21

omg i just attended to i'm using 1.4.6. Can anybody provide me MNS guide(ya know NBT)

also why do i keep getting Unsupported class file version(52.0) error when running need for speed mine crafted

umm and in the end why doesn't it work

nigAss().get().put(1, 228);
HashMap<Integer> mep = new HashSet<String>();
player.sendMessage().mep.get(4), 4);```
it's underlined with red and i have chinese intellij from my father and i forgot how to read it
#

pliz

#

everybody died?

#

@ev

#

@every

fluid river
#

whynot

worldly ingot
#

Wait wait wait I have a better one

fluid river
#

@worldly ingot help me

#

look at my queztion

quaint mantle
#

is there a better way of doing this?

#
    public List<String> splitLore(String lore) {
        List<String> list = new ArrayList<>();
        String[] strings = lore.replace("||", "@@").split("@@");
        for (String string : strings) {
            list.add(string);
        }
        return list;
    }```
fluid river
#

what is this

quaint mantle
#

converts

fluid river
#

oh i see

quaint mantle
#

lore: 'lore of generator, split the lore by ||' this to a lore

fluid river
#

why can't u split by ||

quaint mantle
#

doesn't work

fluid river
#

but convert || to @@

quaint mantle
#

idk why

fluid river
#

well just store by comma

#

so you have less code

#

@quaint mantle btw help me with my questions

#

abov

#

return new List<String>(lore.replace("||", "@@").split("@@"));

#

i'm sure you can do smth like this

#

or return Stream.of(ore.replace("||", "@@").split("@@")).toList();

hazy parrot
#

If your list can be immutable, you can use Arrays.asList

fluid river
#

oh true

#

Arrays.asList

quaint mantle
#
return Stream.of(lore.replace("||", "@@").split("@@")).collect(Collectors.toList());```?
fluid river
#

you can just do toList()

#

instead of collect

quaint mantle
#

cant

fluid river
#

jdk issue

flint coyote
#

just split by "\\|\\|"

hazy parrot
#

BTW why are you first replacing with @@ then splitting by @@

fluid river
#

regex i think

flint coyote
#

| is a logical operator of regex

fluid river
#

java counts | as a special character

hazy parrot
#

Escape it?

flint coyote
#

so you have to escape it

#

nah

fluid river
#

\\|

flint coyote
fluid river
#

discord sucks with \\

flint coyote
#

indeed

fluid river
#

fabsi help me

#

with my queztions

#

above

flint coyote
#

what kind of cosplay are you doing here?

fluid river
#

99% of guys asking for help here

flint coyote
#

that's not accurate

fluid river
#

who i send ?learnjava

#

or FREE JAVA LESSONS

checkmybio

#

ya know

sterile token
undone axleBOT
fluid river
#

omg

#

i got outplayed

flint coyote
#

You forgot the part where you give 0 details about the problems and are just like -> Here's an error, pls help

fluid river
#

oh true

#

one sec

#

made it

#

actually improved

flint coyote
#

the chinese intellij from my father killed me lmao

fluid river
#

ez

#

i forgot to add bad english

flint coyote
#

I selled my wife 💀

fluid river
#

for internet connection

#

to play counter stirk

#

i made bad english

flint coyote
#

Makes perfect sense to me

fluid river
#

used past perfect continuous

#

in message

#

nooo i didn't save

flint coyote
#

rip

quaint mantle
#
public void loadGenerator(String gen_name) {
        new BukkitRunnable() {
            @Override
            public void run() {
                json.setPathPrefix("storage." + gen_name + ".");

                String name = json.getString("name");
                Material genType = Material.matchMaterial(json.getString("type"));
                ItemStack generator = new ItemStack(genType);
                ItemMeta genMeta = generator.getItemMeta();
                genMeta.setDisplayName(name);
                genMeta.setLore(splitLore(json.getString("lore")));
                generator.setItemMeta(genMeta);

                Material nextGenerator = Material.matchMaterial(json.getString("next_generator.type"));

                String dropName = json.getString("dropped_item.name");
                Material dropType = Material.matchMaterial(json.getString("dropped_item.type"));
                ItemStack drop = new ItemStack(dropType);
                ItemMeta dropMeta = drop.getItemMeta();
                dropMeta.setDisplayName(dropName);
                dropMeta.setLore(splitLore(json.getString("dropped_item.lore")));
                drop.setItemMeta(dropMeta);

                if (name == null) return;
                if (genType == null) return;
                if (generator == null) return;

                if (nextGenerator == null) return;

                if (dropName == null) return;
                if (dropType == null) return;
                if (drop == null) return;

                generator_names.add(json.getString("name"));
                generator_material.put(gen_name, genType);
                generator_itemstack.put(genType, generator);

                generator_nextMaterial.put(genType, nextGenerator);

                generator_drop.put(genType, drop);
            }
        }.runTaskAsynchronously(GenCorePlus2.plugin);
    }``` can i do this?
#

yeah i can

#

nvm

#

im dumb

fluid river
#

saved now

#

final version

#

if (name == null) return;
if (genType == null) return;
if (generator == null) return;

            if (nextGenerator == null) return;

            if (dropName == null) return;
            if (dropType == null) return;
            if (drop == null) return;
#

bro just do ||

quaint mantle
#

ehh

#

is that better in any way?

flint coyote
fluid river
#

java developers: implemented OR

#

java users: what the heck is this

quaint mantle
#

well ik what || is

fluid river
#

just a joke

quaint mantle
#

but i'd rather do this

fluid river
#

don't take this seriously

#

btw got inspired by Unsupported class version (52.0)

#

it's really common

#

everyday at least one guy asks what is this error

flint coyote
#

True that. Idk why people can't use google before jumping in here

fluid river
#

offtop but

#

today my gf played Freddi Fish

#

which i installed for her

#

nice experience

#

after forcing her to create a character in modded skyrim

#

: )

fluid river
#

basic logic

#

which does not persist on 99% noobs here

#

what's new in your life guys

quaint mantle
#

why tf can't i get the class

#

nvm

#

im dumb

#

again

flint coyote
#

It's probably a little late already :D

fluid river
#

go to sleep my friend

#

tomorrow will do better

quaint mantle
#

better way of doing this or nah?

#
    public dropItem() {
        new BukkitRunnable() {
            @Override
            public void run() {
                Iterator<? extends Player> players = Bukkit.getOnlinePlayers().iterator();

                while (players.hasNext()) {
                    Map<UUID, Map<Material, List<Location>>> map = new Storage().map;

                    for (Map.Entry<Material, List<Location>> entry : map.get(players.next().getUniqueId()).entrySet()) {
                        List<Location> list = entry.getValue();
                        Material mat = entry.getKey();
                        ItemStack item = new loadGenerators().generator_drop.get(mat);
                        Bukkit.getScheduler().runTask(GenCorePlus2.plugin, new Runnable() {
                            @Override
                            public void run() {
                                Item i = list.get(list.size()).getWorld().dropItemNaturally(list.get(list.size()), item);     
                                i.setVelocity(new Vector());
                            }
                        });
                    }
                }
            }
        }.runTaskTimerAsynchronously(GenCorePlus2.plugin, 20, 20);
    }```
#

100x better than my first one

#

lmao

flint coyote
#

Why the iterator instead of a simple foreach loop?

fluid river
#

why don't u just use var + forEach

#

it's unreadable

flint coyote
#

for (Player player : Bukkit.getOnlinePlayers())

quaint mantle
#

oh, okay

#

i thought iterator's are better

fluid river
#
Bukkit.getOnlinePlayers().stream().map(p -> p.getUniqueId()).forEach(uuid -> {
    var map = new Storage().map;
    for (var entry : map.get(uuid).entrySet()) {
        var list = entry.getValue();
        Material mat = entry.getKey();
        ItemStack item = new loadGenerators().generator_drop.get(mat);
        Bukkit.getScheduler().runTask(GenCorePlus2.plugin, new Runnable() {
            @Override
            public void run() {
                Item i = list.get(list.size()).getWorld().dropItemNaturally(list.get(list.size()), item);
                i.setVelocity(null);
            }
        });
}```
flint coyote
#

or that

fluid river
#

just use iterator when have concurrent modification

quaint mantle
#

okay

#
public dropItem() {
        new BukkitRunnable() {
            @Override
            public void run() {
                Bukkit.getOnlinePlayers().forEach(player -> {
                    Map<UUID, Map<Material, List<Location>>> map = new Storage().map;

                    for (Map.Entry<Material, List<Location>> entry : map.get(player.getUniqueId()).entrySet()) {
                        List<Location> list = entry.getValue();
                        Material mat = entry.getKey();
                        ItemStack item = new loadGenerators().generator_drop.get(mat);
                        Location loc = list.get(list.size() - 1).clone().add(0,0.5,0);
                        Bukkit.getScheduler().runTask(GenCorePlus2.plugin, new Runnable() {
                            @Override
                            public void run() {
                                Item i = loc.getWorld().dropItemNaturally(loc, item);
                                i.setVelocity(new Vector());
                            }
                        });
                    }
                });
            }
        }.runTaskTimerAsynchronously(GenCorePlus2.plugin, 20, 20);
    }``` like this?
quaint mantle
#

var wouldn't work

#

ain't using kotlin

fluid river
#

it's added in java 9

abstract sleet
#

var is in java

quaint mantle
#

tf!?!?!?!??!

fluid river
#

lol

#

read jdk history

#

there is also a new switch

quaint mantle
#

wait, im using java 17 doe

fluid river
#

and pattern matching

abstract sleet
#

so many cool things since j8

fluid river
#

and much more

quaint mantle
#

i c

fluid river
#

optimized it even more

#

list.get(list.size())

#

shouldn't it be list.size() - 1

#

otherwise you get ArrayIndexOutOfBoundsError

fluid river
#

look

quaint mantle
#

i've done that

fluid river
#
if (entity instanceof Player player) {
    player.sendMessage();
}```
#

so you don't need to cast and declare a variable on a new line

#

even works out of if body

#
if (!(entity instanceof Player player)) return;
player.sendMessage();```
abstract sleet
#

I have been using this feature and it has been ❤️ ❤️

fluid river
#

pattern matching

quaint mantle
#
@EventHandler
    public void onGeneratorPlace(BlockPlaceEvent e) {
        Material mat = e.getBlock().getType();
        Player plr = e.getPlayer();
        Collection<Material> list = new loadGenerators().generator_material.values();
        if (list.contains(mat)) {
            GenCore.createGenerator(plr, e.getBlock().getLocation());
        }
    }```
#

im sorry

fluid river
#
switch(phrase) {
    case "Hi" -> dieFromCringe();
    case "Hello", "Good morning" -> greetBack(speaker);
}```
quaint mantle
#

xD

#

i just wanna make sure its okay

fluid river
#

you don't need to use break; anymore

fluid river
#

except

#

var list = new loadGenerators().generator_material.values();

#

hehe

quaint mantle
#

👍

#

xD

fluid river
#

Imagine writing

#

List<HashMap<String, HashMap<Integer, Function<UUID, Location>>>> list = inst.getList();

#

instead of var

quaint mantle
#

ikr 😔

vocal cloud
#

Imagine using such a terrible List of hashmaps instead of writing good code to avoid it KEKLEO

fluid river
#

list of hashmaps of Strings and Functions of UUIDs and locations

vocal cloud
fluid river
#

mike help me

fluid river
#

hey guys how do i code scdehuler which

vocal cloud
#

Didn't realize it was a joke till line 4.

fluid river
#

pseudocoders language

fluid river
#

silence

quaint mantle
#

imagineee

quaint mantle
#

that totally isn't my code

#

kek

#

let meh fix dat

wind tulip
#

Does anyone know if there's any way to cancel an event in an async thread? I know events can't be cancelled after any delay, however I was wondering if there's any workaround to cancelling an event inside an async thread (with no delay before it)

young knoll
#

No

quaint mantle
#

So I ran BuildTools so I could get the server software as well as the api

What is the difference between these files, aside from the shaded one having a substantially larger file size:

spigot-api-1.19.2-R0.1-SNAPSHOT.jar
spigot-api-1.19.2-R0.1-SNAPSHOT-shaded.jar
#

I... should probably make a SpigotMC forum account ._.

#

wait nvm. read the docs roxie 🤦‍♀️

worldly ingot
#

;p

#

-shaded includes all of Spigot's dependencies

young knoll
#

Sadly it doesn’t include a pair of sick sunglasses

river oracle
#

damn :(

#

I was always under the impression it did kinda mad about that now

remote swallow
river oracle
#

Fr

civic wind
kindred valley
#

Just extend "Bukkit" okay

rotund pond
green prism
#

How could I calculate an Estimated Time value in a Queue Plug-in?

granite burrow
#

How can I save data in any block? Like say a string inside of stone or something

green prism
granite burrow
green prism
chrome beacon
granite burrow
minor spoke
#

when i use static functions outside of my command executer class it doesnt appear/work in minecraft

green prism
chrome beacon
#

Anyways use the Chunk PDC for storing your data I guess

#

Haven't really looked at how Alex did it

minor spoke
chrome beacon
young knoll
#

Yeah he just wraps chunk pdc

chrome beacon
#

?paste

undone axleBOT
green prism
#

hm

minor spoke
#
public final class Main extends JavaPlugin {
    public static Player Wolf;
    public static List<Player> InGameP;
    public static MainGame Main;
    public static Boolean GameStarted;

    public SpookyPlugin(MainGame Main) {
        this.Main = Main;
    }

    @Override
    public void onEnable() {
        getCommand("wolf").setExecutor(new StartGame());

        getLogger().info("Test of difference");
        GameStarted = false;
    }
}
young knoll
#

Oh my that’s some static abuse

minor spoke
#

sorry im new to java

#

dw i have experience in other languages

#
public class StartGame implements CommandExecutor {

    Random rand = new Random();
    public void Start() {
        SpookyPlugin.Wolf = null;

        List<Player> players = Objects.requireNonNull(Bukkit.getWorld("world")).getPlayers();
        int randomInt = rand.nextInt(players.size());

        SpookyPlugin.Wolf = players.get(randomInt);
        SpookyPlugin.InGameP = players;
        SpookyPlugin.GameStarted = true;
        SpookyPlugin.Doit();
    }
}
chrome beacon
night copper
#

polymorphism, inheritance

#

and 3rd thing

green prism
#

How can I bot my bungeecord hosted on the computer to test my queue plug-in?

agile anvil
#

I know there is some JUnit plugin to test minecraft servers. iirc there is also one for bungee. But I don't remember correctly the name

kindred valley
#

n make the boolean lowercase

#

I mean dont use Wrappers

agile anvil
#

And don't add a constructor to that main class

#

And remove the uppercase of those variables

kindred valley
#

Ah yes

#

Why class is final

#

Taking lists not lower case is a problem

agile anvil
green prism
#

Can't find anything over the worldwideweb

chrome beacon
#

That probably won't work well for your Bungee though

#

Set the Bungeecord to offline mode and use Mineflayer

green prism
chrome beacon
#

It's not hard

#

You should be able to just copy paste one of the examples and join

green prism
#

And I want to test with multiple players

agile anvil
green prism
remote swallow
#

just get 3 alts smh

green prism
# remote swallow just get 3 alts smh

Hahaha I would like to remind you of something:

  • I need 2 open 1.19 servers (at least)
  • One bungeecord server
  • 2 open minecraft 1.19
  • IntelliJ

My computer is dying, despite having 32GB of ram lmao

remote swallow
#

its prob cpu maxing out

#

or disk

#

i know thats a problem sometimes

green prism
#

rlly not

chrome beacon
#

I'd also say it's the CPU

green prism
chrome beacon
#

I can run the same things as you with only 16gb of ram in my system

remote swallow
#

i can run intellij, minecraft and a server

#

if i run another mc client my computer dies

chrome beacon
remote swallow
#

lol

chrome beacon
#

My Samsung A51 can run 1.19 at around 40 FPS

remote swallow
#

cant say ive tested what mine can do

green prism
young knoll
#

Are you sponsored by Samsung

remote swallow
#

i remember i installed povjav but never did anything

chrome beacon
young knoll
#

That’s java edition at 40 fps?

green prism
#

Which launcher could I use for a third minecraft 1.19

remote swallow
remote swallow
young knoll
#

What’s wrong with the vanilla launcher

remote swallow
#

only one .minecraft

chrome beacon
#

You can change the .minecraft folder

young knoll
#

Also why do you need to

#

I regularly run 2 clients at once from the same dir

remote swallow
#

i could use essentials because they have separate mod files but mc launcher is just slow as hell

#

still havent figured out why 1.19 takes like 5 minutes to boot but 1.18.1 takes a minute

young knoll
#

Probably that integrated graphics card you have md_5

remote swallow
#

leave my computer alone

green prism
#

Or, I could have the bots come out after 10 to 15 seconds with a nice runnable and when they come in they are put directly into the queue

young knoll
#

Sounds like the first step to a robot takeover

remote swallow
#

custom model data probably

young knoll
#

Does it move

remote swallow
#

or its the shit lunar client 3d stuff

young knoll
#

If it doesn’t move it’s just a simple model

#

Just a simple 3D model then

#

With custom model data

remote swallow
#

if you can set nbt tag via a plugin, it is technically all resource pack

green prism
#

WORKSSSSSSS

#

but, that's not the format that I want

#

nice

#

thank you guys

torn oyster
#

neither of these are working

    @EventHandler
    public void onPotion(PotionSplashEvent e) {
        MinigameManager mm = MinigameManager.get();
        if (e.getEntity().getShooter() != null && e.getEntity().getShooter() instanceof Player p) {
            if (!mm.isInMinigame(p)) return;
            Minigame throwerMinigame = mm.getMinigame(p);
            for (Entity entity : e.getAffectedEntities()) {
                if (entity instanceof Player attacked) {
                    if (!mm.isInMinigame(attacked)) continue;
                    if (throwerMinigame.equals(mm.getMinigame(attacked))) {
                        if (throwerMinigame.getMinigamePlayer(p).getTeam() ==
                                throwerMinigame.getMinigamePlayer(attacked).getTeam()) { // getTeam() is enum
                            e.setCancelled(true);
                        }
                    }
                }
            }
        }
    }

    @EventHandler
    public void onPotion(PlayerItemConsumeEvent e) {
        MinigameManager mm = MinigameManager.get();
        if (mm.isInMinigame(e.getPlayer())) {
            if (e.getItem().getItemMeta() instanceof PotionMeta) {
                e.getItem().setAmount(e.getItem().getAmount() - 1);
            }
        }
    }```
#

1st is meant to disable splashign teammates with poison

remote swallow
#

any errors?

torn oyster
#

nope

#

the 2nd is meant to remove the empty bottle when drinking a potion

kindred valley
#

Custom model datas?

#

You can prolly make every concrete thing with model data

drowsy helm
#

it's just a model

#

a bunch of armourstands

kindred valley
#

Do you hav

#

Have information about custom models?

young knoll
#

It’s probably just one armorstand tbh

kindred valley
#

How do you make texture of a model

remote swallow
#

block bench is the common one people use

kindred valley
#

It does not worked for me

remote swallow
#

do you have the minecraft plugin

night copper
#

it's cool what spigot can do

night copper
torn oyster
#

bruh 💀

#

no

#

i'm not that stupid

young knoll
#

For the bottom one you probably need a 1 tick delay

#

Then just remove a single glass bottle from the inv

kindred valley
remote swallow
#

pick a minecraft item, mostly used is a pumpkin and create the model

kindred valley
#

modelling is simple

#

i dont have a texture

remote swallow
#

create one

glossy venture
#

the event gets called twice

#

once for offhand and once for main

#

check if it is the main hand being called before you do anything in the event

#

that doesnt entirely work i think

#

they return different types

#

check using

if (e.getHand() == EquipmentSlot.HAND)
#

try that

mighty pier
mellow edge
#

can I get a block out of inventory click event

glossy venture
#

the material is shared between items and blocks

#

you should just be able to get the material of the item stack

mellow edge
#

ok

#

I also found InvetoryHolder

glossy venture
#

and maybe you can load block data from it too

#

?

young knoll
#

Imma guess

glossy venture
#

oh

young knoll
#

hiz.getAmount is always 1

#

You should be using the held item amount

glossy venture
#

oh yeah

#

nah hiz isnt the item in the inventory right

#

its the template item

#

the item you check against

#

hes right

hasty obsidian
glossy venture
#

first of all use a switch statement

hasty obsidian
remote swallow
remote swallow
#

its a joke that @young knoll would say

glossy venture
#

so, hiz or h1z is the variable holding your 'example item' right

#

its what you use to check if they have the correct item in their hand

remote swallow
#

where is h1z even set

glossy venture
#

you need to get the item held by the player e.getItem() and use its amount

young knoll
#

Oh gosh hiz and h1z

remote swallow
#

i didnt even notice that

glossy venture
#

yea

young knoll
#

Painful variable names

glossy venture
#

i just noticed

remote swallow
#

rename them to something descriptive, will probably help

glossy venture
hasty obsidian
#

o

glossy venture
#

show where you are setting h1z

#

or whatever its called

#

hız

#

wtf even is that

hasty obsidian
young knoll
#

I prefer to name my variables mixes of I and l to keep things exciting

glossy venture
#

a

hasty obsidian
remote swallow
glossy venture
#
switch (number) {
  case 0 -> { /* code */ }
  case 1 -> { /* code */ }
}
``` its basically a very fast if statement
#

but with constants

#

so the compiler can jump to it

remote swallow
#

switch is better tho

glossy venture
#

immediately

hasty obsidian
#

ok

glossy venture
#

yeah

#

so your speed item is the example item

#

it always has amount one

#

you need to use the e.getItem().getAmount()

#

yes it is

mighty pier
#

wjat that mean

glossy venture
#

you fucked up your jdk dependencies

mighty pier
#

yes

glossy venture
#

idk how to fix it though

#

you using gradle?"

#

or something

mighty pier
#

maven

#

i changed sdk from 8 to 17

#

minecraft version 1.18

#

pom.xml

young knoll
hasty obsidian
#

o ok

torn oyster
#

JavaPlugin.getPlugin(JavaPlugin.class)

#

what does that do

onyx fjord
torn oyster
#

is that a real thing that works

remote swallow
mighty pier
onyx fjord
#

yeah

remote swallow
#

?di

undone axleBOT
onyx fjord
#

who cares about old java

mighty pier
#

i do

torn oyster
mighty pier
#

1.8 bgest

onyx fjord
#

nah

mighty pier
#

yes

onyx fjord
#

shouldnt expect much (or any) support if you develop for 1.8

remote swallow
#

would be commonly used for di

young knoll
#

It gets the plugin who’s main class is the one provided

#

No plugin has JavaPlugin as their main class

glossy venture
# mighty pier maven

no

ItemStack itemInHand = e.getItem();
if (itemInHand.getAmount() >= 1) {
  itemInHand.setAmount(itemInHand.getAmount() - 1);
}
mighty pier
#

no

young knoll
#

Huh I did not know the new arrow syntax for switch

#

Beautiful

remote swallow
#

whats the difference

young knoll
#

It looks nicer

hazy parrot
#

It's "enchanted switch"

glossy venture
#

and you dont have to do break shit

young knoll
#

Also no break

glossy venture
#

and the variables arent shared

#

its multiple scopes

young knoll
#

It can also be used as a return statement

glossy venture
#

very glad they enchanced it

young knoll
#

String message = switch (errorCode) {
case 404:
yield "Not found!";
case 500:
yield "Internal server error!";
default:
throw new IllegalArgumentException("Unexpected value: " + errorCode);
};

#

Fancy

remote swallow
#

coming to spigot soon™️, MineErrors™️ by @young knoll

glossy venture
#

np

#

glad yoiu get it now

young knoll
#

So many switch formats now

#

We are truly in the future

remote swallow
#

you'll be in the future when you use intellij

dire marsh
young knoll
#

Lol

cobalt thorn
#

Hi a question getfinaldamage include strength and armor or only the armor because im recalculating everything for doing lightning without removing the items

remote swallow
#

ij

#

also mc dev

#

very useful

young knoll
#

I will start using vs code just to spite you

remote swallow
#

nah

remote swallow
young knoll
cobalt thorn
young knoll
#

Everything

#

Strength, weakness, armor, etc

cobalt thorn
#

Is possible by making setdamage(event.getfinaldamage() + 4.0)

#

Totaly not making them usable

red sedge
#

is there not an event for player swing?

young knoll
#

Swing?

#

The interact event?

red sedge
#

Kinda ig

young knoll
#

There’s also the animation event

red sedge
#

Ooo

#

Seems like exactly what I need

#

but I just realised this could be altered client side

young knoll
#

No

remote swallow
#

pretty sure there client side

young knoll
#

Entity models are hardcoded

red sedge
#

you could do stuff w armor stands, tho it will take a LOT of effort and will probably not be efficient

young knoll
#

ModelEngine

#

Well good luck doing something without it

green prism
#

How can I create a placeholder in a bungeecord plug-in?

#

Is it the normal path?

#

Like for spigot ones

cobalt thorn
#

How i can put an enchant higher then possible like unbreaking vanilla max 3 but i want it to 4 fixed

earnest forum
#

should i use citizens for npcs?

red sedge
#

How would I go about making a custom crafting table? I could just iterate over a list and check each item but that would get slower and slower as I add more recipes, or I could use a tree but that would require A LOT of ram

quaint mantle
red sedge
#

so that would already be a memory hog

quaint mantle
#

You could instead of storing recipes, store a matrix of characters.

red sedge
#

thats not the issue rn tho

#

im not quite sure how i should do the checking for items

quaint mantle
red sedge
#

Cos like theres just a lot of stuff that can be done yk

quaint mantle
#

Then it's as simple as checking against the other hashes

#

Must faster than a bunch of if statements in a for loop, you could use java's built in hash checking.

red sedge
#

like if a recipe requires 20 of an item if they put 25 items it should also work

#

so i cant do an exact check

quaint mantle
#

What you could do is instead of using a hashmap<recipe, result> you could do a HashMap<recipe, validator<result>> sort of thing.

#

That way you are only executing the validator on recipes that include those items, and the validator gets the final say as to what is crafted and how much.

#

Or if anything is even crafted at all.

red sedge
#

Ohhh

#

So at the first stage i'd just look for the same kind of item

#

and after that the validator would decide if the amoutns are valid

quaint mantle
#

Yeah, something like that. It can probably be very versatile if implemented correctly.

red sedge
#

alrighttt got it

quaint mantle
#

Another potential optimization could be grouping, like all recipes that include x item between y amounts are grouped together, and then whenever you need to check what item is being crafted you would only be checking against items in that group specifically.

quaint mantle
# red sedge alrighttt got it

Also, if you don't really feel like optimizing the recipe search, you could try to push the search into an asynchronous operation and then display the result to the player after a match is found.

red sedge
#

Hmm, I think imma go with the hashmap and validator, that should be fast enough

cobalt thorn
#

https://sourceb.in/FG5qutEuIV the attack result negative like -3 with strength 2 any solution?

Console return Damage:-3.32739987373352264.0, Normal Damage: -3.3273998737335226

red sedge
#

well you need to make a potioneffect

#

new PotionEffect()

#

yeah cuz thasts not a thying

#

you need to do new PotionEffect()

#

PotionEffectType.INCREASE_DAMAGE

mighty pier
#

how do i check if a player is in a 125 125 -125 | 100 100 100 block region?

#

give

#

cringe

#

ty

#

force player to use a texture pack

#

and edit this in the texture pack

#

remove achievement

#

add achievement

#

idk

#

just search it up

echo basalt
#

You can send toast notifications

#

Without a resource pack

#

Oddly specific but it requires you to create an advancement, send it and remove it

#

Or use CrazyAdvancementsAPI

warm light
#

Which is better to store itemstack? ArrayList or Collection?

echo basalt
#

Collection is a very broad term

#

that can define any type of collection

#

From lists, to sets

#

etc

#

ehh arrows aren't really visible if you zoom

#

grr

#

here's a white-background version

earnest forum
#

Hello,
for some reason i am getting NoClassDefFoundError in this code for net/minecraft/world/entity/player/Player, but I am not using this class anywhere in my code. The player class below is org.bukkit.entity.Player

public class NpcCommand extends YCommand{

    @Override
    public void run(CommandSender sender, String[] args) {
        if (sender instanceof Player p){
            NPC npc = new NPC(p.getLocation(), "Test");
            npc.sendPacket(p);
        }
    }
}
echo basalt
#

your npc class imports that class

earnest forum
#

it doesn't

echo basalt
#

either that or you accidentally left it on your imports

earnest forum
#

nope

#

checked both

#

nothing

echo basalt
#

ehh paper's api has more stuff

#

I'd just use the fancy api at this point

#

Either this or you start messing with nms

#

yeah you're running java 8

#

CrazyAdvancementAPI is made for a newer version

#

java 17

charred blaze
#

BungeeCord.getInstance().getPlayer(playername);
Can I get offline & online player with this?

tardy delta
#

whats return type?

charred blaze
tardy delta
#

?tryit

#

smh

charred blaze
#

?tryitandsee

echo basalt
#

?tas

undone axleBOT
echo basalt
#

ProxiedPlayer is an online player afaict

#

just use mojang's api or something

#

mans probably just doing name<->uuid

charred blaze
#

what

fluid river
#

woke up

#

where are noobs

#

show me

#

Which is better to store my stuff? case or crate

tardy delta
#

im noob

echo basalt
#

im noob

fluid river
#

freejavalessons

#

?learnjava

undone axleBOT
echo basalt
#

how can I make plugin that synchronizes guis via redis pls i need help

#

using static

fluid river
#

actually throw your inventory to List of Players check it's lore and pass via redis to mysql

tardy delta
#

my first plugin didnt even compile 💀

#

hmm im glad college uses jetbrains tools

crimson terrace
fluid river
#

my first plugin compiled with JavaScript compiler

tardy delta
#

ah yyes

fluid river
#

I used Skript to turn it back to Java

river oracle
#

My first plugin was sold to some idiot

echo basalt
#

I mean in theory I can

#

but I would rather not

fluid river
#

Well then pass to nosql batadase

tardy delta
#

i just went to library to get a book of c++ but they hadnt one and i took c instead lmfao

fluid river
#

i'm sure gonna optimize ur pc to the point you don't need to throw it out of the window

echo basalt
fluid river
tardy delta
#

too shy to show full hand

fluid river
#

too shy to show middle finger

#

pointed at camera

tardy delta
#

too shy to show bed

fluid river
#

too shy to show

tardy delta
#

show feed pics pls

river oracle
fluid river
#

yes

echo basalt
#

I got mf mosquito bite in my wrist

fluid river
#

then u publish it to the server where you have 2 players

tardy delta
#

i made my database impl work in first try

fluid river
#

or 2+

#

and it stops working

echo basalt
#

only took 6 hours to get influxdb working

#

first try

fluid river
#

i made my own transistor in first try

#

Actually invented own electricity cables

#

and discovered own electricity theory

echo basalt
#

y'all mfs gonna end up like a friend of mine

#

mans posted a whatsapp status celebrating 3 months relationship with his vodka bottle

fluid river
#

mine can have friends

tardy delta
#

lmfao

echo basalt
#

full of mf hello kitty stickers

fluid river
#

I have a bunch of itemstacks in my pocket now

echo basalt
#

I got a creeper in my desk

fluid river
#

sadly they do rotate

#

and they don't stack

#

cuz my pocket is on bukkit

echo basalt
fluid river
#

i'm too shy to show what i have in my pocket

#

basically just lazy to get up from the bed

tardy delta
#

thats alot of dirty friends

echo basalt
#

Busta Rhymes

tardy delta
#

dang we got full hand now

fluid river
#

i'm a full-itemstack developer

echo basalt
#

are they client-sided

fluid river
#

i made plugin to have star-platinum from jojo flying behind you

#

actually

echo basalt
#

weak

fluid river
#

stopped on making it attack nearby hostiles

#

and making it go back to player after call

echo basalt
#

one thing that annoys the shit out of me

fluid river
#

and flying back to owner when distance is too big

echo basalt
#

and idk how to fix

#

is that my graphs in grafana just like to delete themselves

#

nvm found it

quaint mantle
echo basalt
#

you might not be static abusing but damn doesn't that code look hideous

quaint mantle
#

Fax

kindred valley
quaint mantle
#

I redid most of it, so it looks nicer

#

Im not static abusing 💀

#

Mans on something

echo basalt
#

mans about to tattoo code on his forehead

quaint mantle
#

I aint static abusing

kindred valley
#

?learnjava

undone axleBOT
echo basalt
#

NullPointerException: returned value is null;

kindred valley
#

@quaint mantle ?learnjava

echo basalt
#

your statement returned false

quaint mantle
#

I ain't static abusing

#

And many people have said i haven't been

echo basalt
#

let limpeex troll

open siren
tardy delta
#

your is null cuz girlsThatLikeMeList.isEmpty() == true

floral drum
#

owo

echo basalt
floral drum
#

ah

echo basalt
#

so, thousandths of a milli

#

if I spam click for a bit it eventually settles down

floral drum
#

👀

#

pop off king!

sterile token
echo basalt
floral drum
#

yeah it's because java caches the execution I think

#

or smtn like that?

echo basalt
#

could be

floral drum
#

it's like when you run code in a for loop, it runs faster the more it's executed

#

until a certain point

echo basalt
#

this is a weird while loop with tons of trig

floral drum
#

ah

echo basalt
#

bit big

floral drum
#

ah so you just increase by about 0.1 or so until you find one

echo basalt
#

no

floral drum
#

oh?

echo basalt
#

I use method 3

#

on my own custom maps lib

floral drum
#

ohh

echo basalt
#

Basically you do up to 6 iterations

#

1 for each block

#

and if you have a frame on the block you're going through

sterile token
#

Please ?learn java

echo basalt
#

then you make another iteration where the distance is between currentLocation and frameHitboxLocation

#

with some math to counter what I see as "lens distortion"

#

but even that isn't really necessary

#

let me see if I can optimize this even further

#

as I'm doing a "getFrameAtPixel" call that might not be necessary as I already calculate the pixel

tardy delta
#

im sorry for the 600fps

sterile token
#

Please I recommend learning java

#

?learn java

tardy delta
#

?

sterile token
tardy delta
#

?

plain yoke
#

hi guys can someone help me?

tardy delta
#

?ask

undone axleBOT
#

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

plain yoke
#

help

       if(plugin.getConfig().getBoolean("anvil." + pl + ".true")) {```
tardy delta
#

i dont think you want to check for Player::toString in the path

#

as thats what + does essentially

#

probably wanna use players uuid

plain yoke
#

its like

  gagsabg: false```
#

but it didnt see boolean

#

idk why

tardy delta
#

ah wait