#help-development

1 messages Β· Page 2245 of 1

eternal oxide
#

ok, go with toString

#

No its an JsonObject

#

getAsString is a Json method not String

manic furnace
#

It has the same problem and no pretty printing

worldly ingot
#

Yeah, toString() won't pretty print

#

Gson will if you configure it to do so

eternal oxide
#

You don;t want pretty printing yet. solve yoru encoding issue

worldly ingot
#

I mean yeah if you're writing data, you won't want to pretty print ;p

#

Whitespace is additional unnecessary data

eternal oxide
#

however you shoudl not be getting a stack trace from toString(). getAsString() should also be fine on a single JsonObject

worldly ingot
#

No. Because it's not a primitive

#

Holy fuck my typing is off today

eternal oxide
#

Better than mine on a good day πŸ™‚

worldly ingot
#

and JsonObject doesn't override this

#

Only JsonPrimitive does

eternal oxide
#

ah

#
        for (GuildPlayerObject guildPlayer:Main.getPlayerCache().values()){
            JsonObject jsonObject = new JsonObject();
            jsonObject.addProperty("name" , guildPlayer.getName());
            jsonObject.addProperty("uuid",guildPlayer.getUniqueId().toString());

            compressedData.write((jsonObject.toString() + ",\n").getBytes(StandardCharsets.UTF_8));
        }```This shoudl not error
#

a simple toString()

#

@manic furnace Does that work ^

sterile token
#

How would you do a fill menu system?

#

So for example if the menus has 3 rows it fill all around leaving the middle row with nothing

eternal oxide
#

if it does you can java JSONSerializer json = new JSONSerializer(); json.prettyPrint(true); compressedData.write((json.deepSerialize(jsonObject) + ",\n").getBytes(StandardCharsets.UTF_8));

#

or something close

glossy venture
#

what

#

oops

#

bruh its accident

#

i wswear

sterile token
#

haha dont worry

#

Im just being troll

glossy venture
#

yeah ik but for mods watchin glmao

#
// load package C
final String pkgCloc = "./C-1.0.jar";

try {
    final URL pkgCUrl = new File(pkgCloc).toURL();
    ClassLoader loader = new URLClassLoader(
        new URL[] { pkgCUrl }, Object.class.getClassLoader()
    );

    loader.loadClass("c.pkg.PackageC")
            .getMethod("loadPackage")
            .invoke(null);
} catch (Exception e) {
    e.printStackTrace();
}
``` any idea why this code may be crashing with a `ClassNotFoundException` (https://paste.md-5.net/bukafepeqa.md)
glossy venture
#

LoaderPlugin:23 is

loader.loadClass("c.pkg.PackageC")
fallen lily
#

Make sure you’re using the same classloader which defined the class to load the class

glossy venture
#

i am

#

i think

fallen lily
#

Object.class.getClassLoader()

#

Doesn’t seem right

glossy venture
#

or should i try Class.forName("name", loader)

fallen lily
#

Launch players? In the air?

glossy venture
#

ill try this.getClass().getClassLoader()

fallen lily
#

Change their Y velocity

glossy venture
#

still doesnt work

sterile token
#

For launching players you can modify his velocity
You can multiply it for example

sterile token
glossy venture
#

k thanks

sterile token
#

Try that maybe works

glossy venture
#

ill also try toURI.toURL

#

instead of toURl

sterile token
#

When i use SystemClassloader for loading i scan the jar using a JarEntry object and them i load each class if matches to x name/package

glossy venture
#

but i did this before

#

rce

sterile token
#

backdoor

#

Oh no lmao

glossy venture
#

for fun didnt use it

#

dw

sterile token
#

that its totally ilegal

#

LMAO

glossy venture
#

nevermind then

sterile token
#

Hahaha

#

Do you know how to fill menus?

glossy venture
#

?

#

inventory?

sterile token
#

Yeah

#

Im trying to fill only menus borders

glossy venture
#

just loop over size and set item

#

oh

sterile token
#

Yeah not as simple

#

Can you give a small snipet?

glossy venture
#

loop x+ y
loop x y+
loop x+w y+
loop x+ y+h

#

where w is widht of inventory

#

and h height

sterile token
#

Hmn

#

The problem is that i only track item slots

#

πŸ˜‚

glossy venture
#

then use int idx = y * w + x to get the thing

glossy venture
sterile token
#

Hmn

#

Is lot if i ask for the for?

glossy venture
#

just switch hardcode sizes

sterile token
#
for (a = 0; a < menu.getRows(), a++) {

}```
glossy venture
#

dont think theres a way to only fill borders if u dont know widht & height

humble tulip
#

@glossy venture you sorted ur problem?

glossy venture
#

nah

humble tulip
#
try { String filePath = config.getConfig().getString("jarfile"); String mainClass = config.getConfig().getString("class"); if (filePath == null || mainClass == null) { PluginLogger.getInstance().severe("Your file path or main class is not specified in prices.yml"); Bukkit.getPluginManager().disablePlugin(plugin); return; } File file = new File(plugin.getDataFolder(), filePath); if (!file.exists()) { PluginLogger.getInstance().severe("The jarfile specified in prices.yml does not exist"); Bukkit.getPluginManager().disablePlugin(plugin); return; } URLClassLoader classLoader = new URLClassLoader(new URL[]{file.toURI().toURL()}, getClass().getClassLoader()); Class<?> clazz = Class.forName(mainClass, true, classLoader); if (!PriceProvider.class.isAssignableFrom(clazz)) { PluginLogger.getInstance().severe(mainClass + " does not extend PriceProvider"); Bukkit.getPluginManager().disablePlugin(plugin); classLoader.close(); return; } this.priceProvider = (PriceProvider) clazz.getConstructor().newInstance(); } catch (Exception e) { e.printStackTrace(); PluginLogger.getInstance().severe("There was a problem loading your price provider"); Bukkit.getPluginManager().disablePlugin(plugin); }
sterile token
glossy venture
#

what the fuck

humble tulip
#

Ops

#

I'm on phone

#

Copied from my git repo

#

Put in intellij and reformat

glossy venture
#

and then use my mehtod

sterile token
#

can you do full eample?

#

Im really dumb for math

glossy venture
#

this is exactly what im doing

glossy venture
# sterile token Im really dumb for math
    public void drawItem(int x, int y, ItemStack stack) {
        inventory.setItem(y * width + x, stack);
    }

    public void drawRect(int x, int y, int x2, int y2, ItemStack stack) {
        for (int xi = x; xi < x2; xi++)
            drawItem(xi, y, stack);
        for (int xi = x; xi < x2; xi++)
            drawItem(xi, y2, stack);
        y++;
        y2--;
        for (int yi = y; yi < y2; yi++)
            drawItem(x, yi, stack);
        for (int yi = y; yi < y2; yi++)
            drawItem(x2, yi, stack);
    }
#

i was doing gui too

#

idk if it works

#

but thats how i owuld do it

sterile token
#

I dont have InventoryDisplay thing

glossy venture
#

now just pass x = 0, y = 0, x2 = w - 1, y2 = h - 1

glossy venture
#

thats my class

fallen lily
glossy venture
#

drawItem just gets an item from a function and draws it at x y

sterile token
#

Hmn

#

Let me send full menu class

glossy venture
#

no wait

sterile token
#
public class Menu {

    @Getter private final String name;
    @Getter private final int rows;
    private final Map<Integer, MenuButton> buttons = Maps.newHashMap();
    @Getter private Inventory inventory;

    public Menu(String name, int rows) {
        this.name = name;
        this.rows = rows;
    }

    public Menu setButton(int slot, MenuButton button) {
        this.buttons.put(slot, button);
        return this;
    }

    public Menu unsetButton(int slot) {
        this.buttons.remove(slot);
        return this;
    }

    public Menu build() {
        this.inventory = Bukkit.createInventory(null, this.rows * 9, Chat.style(this.name));
        this.buttons.forEach((slot, button) -> this.inventory.setItem(slot, button.getItem()));
        return this;
    }

    public void update() {
        this.inventory.clear();
        this.buttons.forEach((slot, button) -> this.inventory.setItem(slot, button.getItem()));
    }

    public void open(Player player) { player.openInventory(this.inventory); }

    public void close(Player player) { player.closeInventory(); }

    public MenuButton getButton(int slot) { return this.buttons.get(slot); }
}
#

That my menu thing

glossy venture
#

i added everything u need

ornate patio
#

how do i get the bukkit LivingEntity from an NMS LivingEntity

glossy venture
#
    public void drawItem(int x, int y, ItemStack stack) {
        inventory.setItem(y * width + x, stack);
    }

    public void drawRect(int x, int y, int x2, int y2, ItemStack stack) {
        for (int xi = x; xi < x2; xi++)
            drawItem(xi, y, stack);
        for (int xi = x; xi < x2; xi++)
            drawItem(xi, y2, stack);
        y++;
        y2--;
        for (int yi = y; yi < y2; yi++)
            drawItem(x, yi, stack);
        for (int yi = y; yi < y2; yi++)
            drawItem(x2, yi, stack);
    }
glossy venture
#

or .bukkitEntity

#

@sterile token

ornate patio
#

thanks

forest edge
#

Anybody know off the top of their head if the BlockDispenseEvent is called even if the dispenser is blocked?

sterile token
severe turret
#

?paste

undone axleBOT
glossy venture
#
int width = size / rows;
#

put that somewhere in your class

sterile token
#

he

#

I dont kno size var

severe turret
sterile token
#

πŸ€”

undone axleBOT
sterile token
#

Oh lmao the command used to display a gift

humble tulip
severe turret
#

well that was helpful thanks!

glossy venture
#

well thats exactly what im doing

#

still doesnt work

#

i created a very normal program for very normal things once and it worked fine

#

and then later i load a class and invoke a method

ornate patio
#

am i just bad at minecraft or was breeding horses removed-

#

wait i think my plugin is messing with something

glossy venture
sterile token
glossy venture
#

well no fucking shit

#

it doesnt work

#

the mf jar file doesnt exist

#

it does

ornate patio
glossy venture
#

but it doesnt think it does

#

oh im tupid

#

so stupid

#

holy fcukcing shit

sterile token
#

hat happen orby?

opal juniper
#

he probs put it in the wrong place

severe turret
#

so it works

#

but is there a better way to do this?

summer sapphire
#

hello!

#

can i ask plugin questions here?

#

if so,
i tried to create a plugin in intellij and build it but i got the following error:

   symbol:   class JavaPlugin
   location: package org.bukkit.plugin.java```
fallen lily
#

Did you include spigot as a dependency?

agile anvil
severe turret
#

sadge

#

how would I go about that

sterile token
#

Explosion event name please?

#

I cannot find it

severe turret
#

I assume I need the reactive driver

#

?

agile anvil
#

Well there are bunch of tuts about that. I advise you to check about CompletableFuture at some points.
What's your database ?

#

Mongo?

severe turret
#

ye

summer sapphire
summer sapphire
sterile token
fallen lily
#

did you re-sync maven

summer sapphire
severe turret
#

dont use maven

#

save yourself headache

summer sapphire
#

alright

severe turret
#

join the gradle gang

sterile token
summer sapphire
#

give me a minute to switch to gradle

chrome beacon
#

Honestly Gradle has given me more problems than maven

severe turret
#

every time i see maven

#

my blood boils

sterile token
#

Also gradle doesnt allow to program/code your own repo system

chrome beacon
#

?

#

It does

severe turret
#

@summer sapphireyou shuld use the minecraft dev plugin to create projects though

agile anvil
chrome beacon
#

Everything Maven can do Gradle can

chrome beacon
#

It's just about preference in the end

sterile token
#

You can either use CompletableFuture or Bukkit async tasks

#

what the nameof explosion event

#

i cannot find on jd

agile anvil
severe turret
#

oh well

#

my brain just overheated

#

guess i leae it for tomorrow

agile anvil
dusk flicker
#

Async is very simple lol

agile anvil
summer sapphire
dusk flicker
#

Just the 'non simple' part of it, is hitting async catchers or using stuff that cant be used async

summer sapphire
#

BUT

#

im trying to make it into kotlin lmao

agile anvil
severe turret
#

I've watched so many videos on lambdas and shit but i never seem to get it

#

guess the best time to learn is now

dusk flicker
#

if you really only use async for the bare minimum that its needed, it wont be an issue

summer sapphire
#

can anyone here help me set up the project with kotlin?

maiden cape
#

How can I detect every time armour is put onto an user with all the edge cases like right-clicking it on etc?

severe turret
#

check javadocs for events i guess

#

or maybe like right-click event player inventory slot

maiden cape
#

so PlayerInteractEvent + InventoryClickEvent

severe turret
#

@agile anvil should I use the synchronous driver and CompletableFuture

#

or get the async mongodb driver

agile anvil
#

Oh yeah I forgot mongo was strange with it's driver

summer sapphire
#

i successfully built my kotlin plugin on gradle!

#

thank you very much for your assistance!

agile anvil
#

I never heard about the async driver, hence I do not really use mongo

dusk flicker
#

for mongo I only run pulling stuff out and putting stuff into the db

severe turret
#

would you recommend using a different db for Minecraft plugin

dusk flicker
#

*run async

crimson terrace
#

I want to have a projectile be fired with a set delay between shots and I was wondering what the best way to do that would be.
I thought of scheduling all the tasks for firing the projectiles in a for loop, but didnt wanna have all those tasks flying around.
The other solution ive thought of is to make a task timer and cancel it after a certain amount of runs, I am unsure of how to properly cancel it tho.

eternal night
#

the second option for sure is the preferred one

agile anvil
#

Take the db you prefer

smoky oak
#

if i spawn a ender dragon in the overworld using spigot, does it have ai or no?

agile anvil
#

I guess so, never actually tried

#

If he doesn't, you can still add it

brittle lily
#

Hey Guys! I wanna make custom gui. I know how Can I do that But How can I do that with a number that is not a multiple of 9.

humble tulip
#

U can't

#

Unless you use hopper inv

summer sapphire
humble tulip
#

Or something similar

#

You didn't code anything?

brittle lily
humble tulip
#

They're probably using custom resource packs

summer sapphire
eternal night
summer sapphire
summer sapphire
eternal night
#

if you like kotlin I'd suggest at least also using the kotlin gradle DSL

humble tulip
summer sapphire
#

im very new to JVM languages

brittle lily
brittle lily
#

oh wow I wasn't know about InventoryTypes

#

thanks

summer sapphire
#

if i do it manually the jar built just fine though

digital rain
#

devs whats the neatest and nicest way to do the following: you have two inputs, location, int offset, and the function creates a new location but being randomly offset in each direction based on the offset inputed

eternal night
#

so you have a location and an offset and want to pick a random location on the circle with radius offset around that location ?

severe turret
#

wat do

lost matrix
digital rain
#

Yes

#

I wanted to hear some special methods that would make it easier

lost matrix
#

Thats like 1 + 1 = 2 type of complexity

lost matrix
tender shard
#

?jd-bc

digital rain
#

Thats basically what i had written πŸ₯΄, nvm my question i just always envision something out of bounds of possibilities

lost matrix
severe turret
#

ok

#

this is what i came up with

lost matrix
severe turret
#

I have no fucking idea

lost matrix
#

Its action have no correlation to its name

severe turret
#

yeah

#

because

#

i remade it like

#

100000000 times

lost matrix
#

This method is so weird. What is it supposed to do?

#

Why is it counting documents?

severe turret
#

ok so

#

i want to create a document with playername on my db

#

when a playerjoins

#

its counting documents to check if the document with the playername already exists

#

so it doesnt create two files for the same person

lost matrix
severe turret
#

XD

lost matrix
#

Also the mongo collection should not be in the same class as your listener

#

You need a separate class that only handles your mongodb playe stuff

#

Let me write you an example

severe turret
#

oki

#

OKAY BUT THE METHOD AND SHIT

#

IT WORKS

#

IM A GOD

lost matrix
severe turret
#

idk man

#

im just happy it works

#

i dont understand what i wrote

#

but it works

shy shadow
#

Hey guys ! I'm looking to know where to find out the names of the player's statistics on a server :

} else if (statValue == 2) {
          if (statType != null) {
            if (statType.name().equalsIgnoreCase("SHEEP")) {
              p.sendMessage("sheep test");
            }
          }
        }```

Here, when the player kills 2 sheeps, it sends the message. 
Now I'm trying to get when the player die, tried deaths, death etc... but it won't work, is there a website where I can find that ? Didn't find any, and the values on the world -> stats -> uuid file doesn't work as well πŸ€”
#

(I'm listening to the event PlayerStatisticIncrementEvent)

severe turret
#

if your statValue is 2

#

how can it even be null

#

πŸ€”

#

weird naming

shy shadow
#

Yea don't worry about it lmaoo, forgot to remove this line when testing

severe turret
#

like mine

#

wait I'm going to get scolded

lost matrix
# severe turret idk man

Your data class

@Data
public class PlayerData {

  public static PlayerData fromDocument(Document document) {
    PlayerData playerData = new PlayerData();
    playerData.setLastSeenName(document.getString("lastSeenName"));
    return playerData;
  }

  private String lastSeenName;

  public Document toDocument() {
    Document document = new Document();
    document.put("lastSeenName", lastSeenName);
    return document;
  }
}

The MongoDB class for this data class:

public class PlayerMongoPersistence {
  // TODO: Init this collection in your constructor
  private MongoCollection<Document> playerCollection;

  public void savePlayerData(UUID playerId, PlayerData playerData) {
    Document document = playerData.toDocument();
    UpdateOptions options = new UpdateOptions().upsert(true);
    playerCollection.updateOne(Filters.eq(playerId), document, options);
  }

  public CompletableFuture<Void> savePlayerDataAsync(UUID playerId, PlayerData playerData) {
    return CompletableFuture.runAsync(() -> this.savePlayerData(playerId, playerData));
  }

  public PlayerData loadPlayerData(UUID playerId) {
    Document document = playerCollection.find(Filters.eq(playerId)).first();
    if(document == null) {
      return new PlayerData();
    } else {
      return PlayerData.fromDocument(document);
    }
  }

  public CompletableFuture<PlayerData> loadPlayerDataAsync(UUID playerId) {
    return CompletableFuture.supplyAsync(() -> this.loadPlayerData(playerId));
  }
}
severe turret
#

monkaS

sterile token
#

FileHandler.getConfigurationSection(java.lang.String)" is null

MNS

#

Its the same

#

😑

severe turret
#

I'm glad you wrote that up for me

summer sapphire
severe turret
#

but i have no idea what any of it does

long ocean
#

Can someone point me in the right direction. How do you clear the inventory of a Container when it is in the form of an ItemStack? I tried (Conainer)ItemStack.getInventory().clear(); which didn't work.

humble tulip
#

7smile7

lost matrix
sterile token
long ocean
last swift
#

I'm attempting to create a hollow cube of some material, but when using the following code the walls for the x don't appear. I tried copying the code for z, but it didn't change anything.
https://sourceb.in/C8nt3IT5on

dusky plaza
#

Hey, keep getting a Could not pass event PlayerInteractEvent to ChromePlugin v1.0-SNAPSHOT org.bukkit.event.EventException: null with this listener (kotlin):

class InteractListener : Listener {
    @EventHandler
    fun onPlayerInteract(event : PlayerInteractEvent) {
        val block : Block = event.clickedBlock ?: return
        if(event.action != Action.RIGHT_CLICK_BLOCK) return
        if(block.type == Material.STONE_PRESSURE_PLATE) {
            if(block.location.block == Location(block.world, 0.0, 100.0, 0.0).block) {
                Bukkit.getServer().broadcastMessage("test")
            }
        }
    }
}```
I'm just trying to send a message if a player right clicks a specific pressure plate in the world.
quaint mantle
#

kotlin spigot πŸ’€

summer sapphire
summer sapphire
humble tulip
#

I have a Database interface with methods to get stuff from database. However, I don't want people to access the database since database data may be outdated. I have a datafinder interface with methods to getdata from database if not loaded or to get it from the cache. Should the implementation of datafinder store cached data?

lost matrix
# long ocean Yes.

The Inventory is store in the ItemMeta. Specifically the BlockStateMeta
It represents a whole BlockState. In your case the BlockState is ShulkerBox or more abstract BlockInventoryHolder

quaint mantle
humble tulip
#

Or should there be a datacache of sorts

summer sapphire
quaint mantle
#

send your build

#

gradle

severe turret
#

the build made with the plugin

shy shadow
severe turret
#

already includes the plugin.yml

#

like when you go in a server

#

and you can type your command

#

it's there

summer sapphire
#

i manually added the plugin.yml into the resulting jar then it ran fine though

#

so everything else seems to be building fine

severe turret
quaint mantle
#
plugins {
    id 'java'
    id 'org.jetbrains.kotlin.jvm' version '1.7.0'
}

group = 'me.miguelcr'
version = '1.0-SNAPSHOT'

repositories {
    mavenCentral()
    maven {
        name = 'spigotmc-repo'
        url = 'https://hub.spigotmc.org/nexus/content/repositories/snapshots/'
    }
    maven {
        name = 'sonatype'
        url = 'https://oss.sonatype.org/content/groups/public/'
    }
}

dependencies {
    compileOnly 'org.spigotmc:spigot-api:1.18.2-R0.1-SNAPSHOT'
    implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8"
}

def targetJavaVersion = 17

@summer sapphire try this

vital ridge
#

I'm including lombok in my maven dependency and it is also installed as a plugin. I'm using intellij idea. For some reason when I try to import it, it won't resolve.

severe turret
#

avoid maven like fire

severe turret
#

gradle is life

summer sapphire
severe turret
#

bro

#

what are you even doing

#

anyway

#

@lost matrix how do I understand any of this

#

I'm lost

quaint mantle
smoky oak
summer sapphire
quaint mantle
#

?verify

#

bruh

#

verify your account

#

#verify

river oracle
#

!verify

lost matrix
undone axleBOT
#

Usage: !verify <forums username>

vital ridge
#

when trying to build the project.

summer sapphire
#

on it

quaint mantle
vital ridge
quaint mantle
#

then try to reimport them with ALT + ENTER

lost matrix
vital ridge
#

it cannot find the lombok

#

as if i never even added it as the dependency

quaint mantle
#

did you reload the maven project

#

should be a maven button at the top right

summer sapphire
vital ridge
#

Reload button or whatever

#

I pressed on the maven thingy in the right

#

I only have lifecycles etc

#

I don't really think thats the case tho, I think something is fcked in my settings.

#

Or idk.

quaint mantle
#

possibly

vital ridge
#

It's weird, never had this problem b4.

#

I mean what could be possibly fcked

#

how tf i can add a dependency and not import it

#

what the fuck

quaint mantle
#

okay remove the lombok dependency

#

then click on one of your @Getter annotation usages

#

like wherever you've used it

#

then ALT+ENTER

#

and there should be "add lombok to classpath"

#

try that

tender shard
#

File -> Invalidate Caches could also help when intellij is weird

vital ridge
#

Thanks bro

#

Not getting any compile errors at least

#

havent tried to build yet.

quaint mantle
#

so it was a

#

sorry

#

its a .idea/ folder issue

#

workspace.xml iirc

vital ridge
#

Gotchu, it's most likely cuz I'm editing a src of another old plugin

#

And its on my desktop

#

The src folder

#

project folder*

lost matrix
vital ridge
#

And i didnt copy paste the .idea folder

#

I kept it.

#

So the original plugin had a different one

#

just remembered.

quaint mantle
#

security vulnerabilities be like

summer sapphire
#

hmmmmmmmmmmmmm

severe turret
#

I think i'm getting the gist of it slowly

#

wait

#

oh yeah

#

if i have a method like the saveplayerdata for example

#

i just create completablefuture of its type with the same params and return runAsync

#

to make it async

#

honestly that looks easier than i thought

#

what i dont understand is

#

how do i get PlayerData

#

from the event

lost matrix
#

Yeah. You just create a method

public T doSomethingSync() {

}

And to "make it" async you just wrap it

public CompletableFuture<T> doSomethingAsync() {
  CompletableFuture.supplyAsync(() -> doSomethingSync());
}
severe turret
#
    public void onPlayerJoin(PlayerJoinEvent event) {
        String playerName = event.getPlayer().getName();
        event.setJoinMessage(ChatColor.GREEN + playerName + " has joined the server!");

        PlayerMongoPersistence playerMongoPersistence = new PlayerMongoPersistence(collection);
        playerMongoPersistence.savePlayerData(event.getPlayer().getUniqueId(), );
    }```
#

so i have this

#

but there i dont know how to get the PlayerData

humble tulip
#

let me show u the interfaces i have thus far

#
public interface AltDatabase {

    void connect();

    void close();

    void initialize();

    AltPlayer getAltPlayerFromUUID(UUID uuid);

    AltPlayer getOrCreateAltPlayer(UUID uuid, String name);

    AltPlayer getAltPlayerFromName(String name);

    Set<AltPlayer> getPlayersFromIP(String ip);

    void insertIPData(PlayerIP playerIP);

}
#
public interface AltFinder {

    /**
     * Gets the alts of a player.
     *
     * @param ip The IP of the player.
     * @return A future of a set of alts on a thread suitable based on SingleThreadExecutor.
     */
    CompletableFuture<Set<AltPlayer>> getAlts(String ip);

    /**
     *
     * @param altPlayer The alt player to get alts for.
     * @return A future of a set of alts on a thread suitable based on SingleThreadExecutor.
     */
    CompletableFuture<Set<AltPlayer>> getAlts(AltPlayer altPlayer);

    /**
     * Gets the alts of a player.
     *
     * @param name The name of the player.
     * @return A future of an alt on a thread suitable based on SingleThreadExecutor.
     */
    CompletableFuture<AltPlayer> getAltPlayer(String name);

    /**
     * Gets the alt player of a player.
     *
     * @param uuid The UUID of the player.
     * @return A future of an alt on a thread suitable based on SingleThreadExecutor.
     */
    CompletableFuture<AltPlayer> getAltPlayer(UUID uuid);

}

summer sapphire
lost matrix
# severe turret but there i dont know how to get the PlayerData

You would not use the PlayerMongoPersistence class like that.
You still need a class to store you player data in while the Player is online.
The data has a scope.
Player joins -> load data from mongodb into map
Player quits -> save data from map into mongodb

lost matrix
# severe turret ```@EventHandler public void onPlayerJoin(PlayerJoinEvent event) { S...
@RequiredArgsConstructor
public class PlayerDataManager {

  private final Map<UUID, PlayerData> playerDataMap = new ConcurrentHashMap<>();
  private final PlayerPersistenceHandler playerPersistenceHandler;

  public void loadPlayerData(UUID playerId) {
    PlayerData loadedData = playerPersistenceHandler.loadDataAsync(playerId).join();
    playerDataMap.put(playerId, loadedData);
  }

  public void unloadPlayerData(UUID playerId) {
    PlayerData liveData = playerDataMap.remove(playerId);
    if (liveData == null) {
      return;
    }
    playerPersistenceHandler.saveDataAsync(playerId, liveData);
  }

  public PlayerData getPlayerData(UUID playerId) {
    return playerDataMap.get(playerId);
  }

}
severe turret
#

despair

humble tulip
severe turret
#

so what I was trying to do is just simple when a player joins for the first time

worldly ingot
#

Yeah, cache outside of that

humble tulip
severe turret
#

add his name into a file on db

worldly ingot
#

Eh, no, you can cache in the AltFinder. My bad

#

Yeah that's fine. I misread your code

severe turret
#

this is getting too complex for my brain

humble tulip
lost matrix
worldly ingot
#

Yeah, no that makes sense. You can cache in the AltFinder implementation

summer sapphire
#

you know what

#

i might just be building this wrong

#

ok i think its working rn

#
./gradlew jar``` did something good
severe turret
#

anyway i guess tomorrow I'll pull it together somehow

#

ty for the files though

#

I'll understand it eventually when i read it over and over

#

and with clear mind

sterile token
#

java.lang.LinkageError: loading constraint violation when resolving method "com/mongodb/MongoClient.getDefaultCodecRegistry()Lorg/bson/codecs/configuration/CodecRegistry;" : loader "org/bukkit/plugin/java/PluginClassLoader@f1d354c5" of class "dev/nasgar/net/manager/StorageManager" and loader "java/net/URLClassLoader@4a177471" of class "com/mongodb/MongoClient" have different types for the method signature

#

its caused because im using spigot library loader?

vocal cloud
#

Lol

proud bridge
#

hi im new to spigot and i got a question regarding the event "event.GetAction". I want to code something that is similar to an Ignition of a lightsaber. If you hold shift and rightclick then it should ignite. I was trying to find something online and i found the event "event.GetAction" but it wont work, does anyone know why?

ornate patio
#

for some reason my horses can't go into love mode when being fed breeding items

#

only when my plugin is loaded

#

I've tried disabling every PlayerInteractEntity listener

#

still the same issue

#

in fact i just disabled all listeners

humble tulip
ornate patio
#

yeah but i havent overriden any breeding features

hasty prawn
#

What did you change about them

ornate patio
#

nothing much

#

heres the whole thing

hasty prawn
#

Is that just the default one

ornate patio
#

a custom goal im working on

#

its not

#

i already tried putting the default instead

hasty prawn
#

So you have changed breeding Hmmge

buoyant viper
hasty prawn
#

What'd you change in that class

ornate patio
#

the right clicking to enter love mode never worked in the first place

ornate patio
#

its still a work in progress

hasty prawn
#

If you replace yours with the default one and change Horse.class to AbstractHorse.class does it work?

ornate patio
#

nope

#

tried that already

hasty prawn
#

Do you even get the hearts/does it consume the food

#

If it doesn't even consume the food then I imagine there's some event cancelling it

ornate patio
ornate patio
hasty prawn
#

Maybe your horses are aromantic then

humble tulip
#

Asexual horses 😳

hasty prawn
#

Do any other mobs work for breeding

ornate patio
hasty prawn
#

I honestly have no clue then

ornate patio
#

the event definitely isn't being cancelled...

@EventHandler(priority = EventPriority.MONITOR)
public void eee(PlayerInteractEntityEvent event) {
    System.out.println(event.isCancelled());
}
false
false
false
false
#

bruh

#

it turns out one of my listeners is causing issues

#

idk what it is yet

#

but i did not know that you can't breed untamed horses

summer sapphire
daring egret
#

Can someone help me transfer a Player variable from one class to another. I've tried so much but nothing seems to work!

lost matrix
daring egret
#

oh no

#

there was a command?!?!?!

vocal cloud
#

?

#

learn

vocal cloud
daring egret
#

lol ok

#

wait

lost matrix
#
 // Your code goes here
daring egret
#

that is tiny

#

hold on

#
 private PunishGuiListener guiListener = new PunishGuiListener();
guiListener.recieveTarget(target);
``` Other class
#
Player target2 = null;
public void recieveTarget(Player target) {
    target2 = target;
}
``` Class2
#

if what I did makes no sense don't bully me

lost matrix
#

The naming alone...

daring egret
#

SHH

#

i was at wits end last night trying to find a solution

lost matrix
#

Thats not enough code

daring egret
#

alright

#

well

#

i can't really show more because i deleted it last night

#

if you want I can explain what i'm trying to do

quaint mantle
daring egret
#

I have a /punish command with an argument for the player you want to punish. I'm trying to get that player into a gui click listener in another class

#

and idk how to

quaint mantle
#
public boolean isRelevant() {
    return this.playerRef.get() != null;
}
lost matrix
quaint mantle
#

i dont think it would make a huge difference, maybe just a small amount of unneeded complexity

lost matrix
daring egret
#

okay...

#

but the player data is being created when the command is run, so how would I put that into a data manager

lost matrix
#

The data manager is created once when the server starts. And after that no other instance of that class is created.
This makes the class a singleton.

ornate patio
#

i may have accidently made two male horses breed

lost matrix
#

Tha fk are all those colors?

ornate patio
#

Β―_(ツ)_/Β―

#

@lost matrix sorry i keep bothering you πŸ˜”

ornate patio
#

I'm not really sure what to do here

lost matrix
#

If you found a Block then you need to return SUCCESS

ornate patio
#

yeah but like- i can't really find where the algorithm finds the block

river oracle
#

What are you doing StepResult 😳

lost matrix
ornate patio
#

πŸ€¦β€β™‚οΈ

ornate patio
#

and I'm assuming found contains all the blocks that are navigable to?

lost matrix
# ornate patio oh

The whole algorithm is still a bit clunky. Ill change some stuff tomorrow.

ornate patio
#

alright

#

thanks so much, sorry to keep bothering you on this

lost matrix
ornate patio
#

mmm

#

this is mildly horrifying

vernal abyss
#

Hi there, I am running the following code:

Object handle = player.getClass().getMethod("getHandle").invoke(player);
Object connection = handle.getClass().getDeclaredField("playerConnection").get(handle);

But I am getting a NoSuchFieldException for the second line. After researching, I found out that the field name "playerConnection" is in reality the de-obfuscated one, and I need to find the obfuscated one. How do I do this?

river oracle
#

my bad

#

lol wrong section

worldly ingot
#

Should ask what it is you're trying to do with packets first before shoving you on your way. There may be API for what you're doing

vernal abyss
river oracle
#

you can search for it using different formats

river oracle
#

and don't use reflection for that lol

#

just import the Craft classes

worldly ingot
#

what [is it] you're trying to do with packets?

river oracle
#

must dodge question must continue the grind that is the sigma mindset

worldly ingot
#

There are a lot of things people try to do with packets that have had API for like... ever. And there are newer API additions that people just don't know about. Like the client-sided world borders I mentioned earlier today that were added in 1.18.2

vernal abyss
#

I am trying to open a sign GUI

river oracle
#

The world border thing is amazing

river oracle
#

dayummmmm who woulda guessed

vernal abyss
#

but i dont want the sign to be placed

river oracle
vernal abyss
river oracle
#

its packaged with teh server code from the remapped jar

worldly ingot
#

What packet do you usually send to open a sign window? (I could look myself but I can't be bothered atm lol)

river oracle
vernal abyss
#

look I am sorry but I don't get it

#

I don't know why I can't access the craftbukkit classes

#

I imported spigot from gradle

humble tulip
vernal abyss
#

no

#

i used gradle

humble tulip
#

i haven't used gradle but in maven, you need to change spigot-api to spigot

#

i'm not sure how it works with gradle

quaint mantle
#

in either case you need to run buildtools

winged anvil
#

?paste

undone axleBOT
winged anvil
humble tulip
#

i'll just ask

#

how does ur plugin store data?

winged anvil
#

one sec

#

categories is an enum, which just specifies the category for the cluter

#

since its a map, this should be the fastest way to grab it right?

worldly ingot
#
String[] lines = new String[] { "What's your name?", null, "^^^^^^^", null };
player.openSign(lines, result -> {
    player.sendMessage(result[1] + " is a cool name.");
});```
#

This make sense?

ornate patio
#

so I'm creating a custom persistent data type

#

where the primitive is PersistentDataContainer

worldly ingot
#

Ideally I'd use a CompletableFuture instead, but I'm not sure that's an option because I need to return a boolean for whether or not it succeeded

ornate patio
#

and the complex is my own class

#

the thing is

#

On line 21

#

what do I put

ornate patio
humble tulip
#

?

winged anvil
#

no

#

ServerGame

humble tulip
#

Does your server store data?

#

Plugin sore data*

#

Not in a map

#

I mean in files or a db

#

Etc

winged anvil
#

the player profiles are cached from mongo and stored in a map

#

no config

#

each individual challenge however is stored in an enum, with each requirement and other info

humble tulip
#

So plugin.getProfile returns a cached value

#

And doesnt is load from db?

winged anvil
#

correct

#

the profiles get saved when the player leaves or when the autosave does

humble tulip
#

U should see how long the code u think is causing lag takes to run using system.currenttimeinmillis

#

If u can, try to run it 1000times

#

Then divide by 1000 to get the avg runtime for a method

#

Idk what the trylevelupmethod does

ornate patio
ornate heart
#

Is there a way to see if a mob is spawned by a specific plugin?

eternal oxide
#

no

tranquil viper
tranquil viper
#

But other than that I don't think so

worldly ingot
#

BLOCK_NOTE_BLOCK_PLING

quaint mantle
#

hypixel noise

#

@worldly ingot why are you only online at night

worldly ingot
#

I'm online all the time I'm just usually busy during the day lol

maiden thicket
#

what would be the best way to create a jetpack's functionality?

quaint mantle
#

Playerinteractevent, check if the player is interacting with a jetpack

#

add to the player's Y velocity

#

or keep it stable

ornate patio
eternal oxide
ornate patio
#

yeah i know

#

it was just psuedocode

eternal oxide
#

PersistentDataContainer persistentDataContainer = context.newPersistentDataContainer();

ornate patio
#

oh

#

thanks

tranquil viper
buoyant viper
#

it sounds like at least 2 notes at once

worldly ingot
#

Probably much lower than default

buoyant viper
#

could just be my ears

worldly ingot
#

But it's just pling afaict

rancid snow
tranquil viper
#

I know but I'm using chatcontrolred thats why I asked in #help-server for further help xD

#

It doesn't seem to change when I change it

ornate patio
#

if I wanted to create a custom persistent data type generic for enums, would this be proper?

public class PersistentDataType_ENUM implements PersistentDataType<String, Enum<?>> {
    @Override
    public Class<String> getPrimitiveType() {
        return String.class;
    }
    
    @Override
    @SuppressWarnings("unchecked")
    public Class<Enum<?>> getComplexType() {
        return (Class<Enum<?>>) new TypeToken<Enum<?>>(){}.getRawType();
    }
#

for example I want to use it by doing new PersistentDataType_ENUM<Trait>() where Trait is an enum

spiral jewel
#

I'm trying to convert a Forge ItemStack to a Spigot one. As in, serialize a Forge ItemStack, and deserialize in Spigot. Anyone know how to bridge the gap?

worldly ingot
#

Which version?

spiral jewel
#

1.19

worldly ingot
#

Else you may have to resort to some server internals

spiral jewel
#

I was thinking of trying something like that. Fantastic that there's already a perfect method for it. Thank you. :)

worldly ingot
#

If that doesn't work, server internal method you may want is net.minecraft.world.item.ItemStack.of(NBTTagCompound)

#

Then wrapping that in CraftItemStack.asCraftMirror()

spiral jewel
#

πŸ‘

iron glade
worldly ingot
#

One of those fun leaking websites with zero relevance

iron glade
#

this just got me for a second before I realised it's not the original site

ornate patio
#

can i get a code review on my enum persistent data type

#

I'm not sure what I'm doing for getComplexType()

worldly ingot
#

Yeah, would avoid putting any credentials into that website at all costs

iron glade
#

hell yea

worldly ingot
#

Should be able to just return enumClass; there, okay

ornate patio
#

oh

#

ur right

worldly ingot
#

You already have a Class<E>, silly

#

;p

ornate patio
#

lmao

#

thanks

earnest forum
#

u cant

#

the player object is always given to you

#

u never call the constructor

#

the server creates a craft player object

#

which is casted to player and thats given to you

summer sapphire
#

im such a noob

tender shard
#

good morning everyone πŸ™‚
hopes that choco is still online
Can someone explain to me how to setup the pom and module structure so that I can use the maven-assembly-plugin to create a combined .jar out of my multi module project?

#

I already have a working multi module setup that uses a dist module that has all my other modules as dependency but I feel like that's not the best solution and that the assembly plugin is what I'm actually looking for

desert tinsel
#

how to add a dependency in pom.xml by a jar file?

vocal cloud
#

You mean you want to add a local jar file to your project as a maven dependency?

desert tinsel
#

yes

#

but I don't know their group id, artifac id etc.

vocal cloud
#

Well it's just a glorified zip file you can open it

tender shard
#

TL;DR: You install it to your local repo and you can make up a group id, artifact id, etc. just check the link I just sent

vocal cloud
#

or you can look at it's juicy contents and add it that way uwu

neat meadow
#

Does anyone know a good script parsing lib that can evaluate conditions within a string?

tender shard
#

nashorn

iron glade
#

Anyone knows why I'm getting this ultimateAdvancementAPI.exceptions.APINotInstantiatedException: null

tender shard
tender shard
#

?paste your pom.xml

undone axleBOT
tender shard
#

oh wait, they want you to shade it? that's very... uncommon

vocal cloud
#

πŸ‘€

tender shard
#

show your main class' code pls

iron glade
#

There's not really much to it

tender shard
iron glade
tender shard
#

what's Main line 92?

iron glade
neat meadow
tender shard
iron glade
#

I have no idea

tender shard
eternal oxide
#

My guess is you are using the wrong UltimateAdvancementAPI

summer sapphire
#

Hello!

#

i'm having trouble building my plugin jar

eternal oxide
#

If you shade it AND have the plugin you will have two of this

summer sapphire
tender shard
tender shard
#

then I can't help lol

summer sapphire
#

appreciated!

tender shard
#

do you mean that it doesnt include the kotlin lib?

tender shard
#

gradle is pretty stupid and cannot "shade" stuff on its own. IIRC you need the shadow plugin

tender shard
#

there however is no official one, everyone seems to be using a shadow plugin by some random github dude

eternal oxide
#

or use java and not kotlin

tender shard
#

alternatively, there are plugins on spigot that do nothing except to provide the kotlin stdlib

summer sapphire
tender shard
#

yeah well in maven it's way easier, you can just use the official maven-shade-plugin there πŸ˜„

eternal oxide
#

you could probably add kotlin to the libraries section of your plugin.yml

tender shard
summer sapphire
tender shard
#

oh yeah then you can add the following to your plugin.yml:

#
libraries:
- org.jetbrains.kotlin:kotlin-stdlib:<kotlinVersion>
summer sapphire
#

ill try it out!!

#

thank you very much

tender shard
#

but no idea if that actually works lol

smoky oak
#

is checking player PDC a 'lightweight' check?

tender shard
#

yes, it's in memory anyway

vocal cloud
#

Depends what you mean by lightweight? In the grand scheme of things yes.

smoky oak
#

'PlayerMoveEvent - only use lightweight checks here'

humble tulip
#

Just incase

summer sapphire
#

btw

humble tulip
#

A dude had the same problem and posted his gradle file

vocal cloud
#

It's more what you do with the data then checking the PDC

eternal oxide
tender shard
#

the PDC of a loaded entity is just a Map<String,Tag>

summer sapphire
#

btw

#

how do i build a jar artifact from cli

smoky oak
#

well yes. The PDC's supposed to contain a boolean if it needs to run

summer sapphire
smoky oak
#

so if not PDC.get(BOOLEAN) return

humble tulip
#

./gradlew

#

Well nvm

#

Was gonna say jar

eternal oxide
#

ie, if you are checking for when a player enters a certain area, you only need to test when they actually change the Block location, so you text x,y,z for a full block change and exit if not

tender shard
eternal oxide
#

What are you intending to do in the PlayerMoveEvent?

tender shard
#

you could although of course just cache the boolean yourself. e.g. on join, add the PDC's boolean to a Map<UUID, Boolean>. then the PDC data doesn't have to be unwrapped every time

glossy venture
summer sapphire
#

i mean in general

#

like

#

a normal spigot java plugin

#

from the minecraft-dev plugin in intellij

glossy venture
#

./gradlew build

#

id guess

#

its in the /build/libs/ folder

#

the resulting jar

smoky oak
vocal cloud
#

release version 17 is not supported uwu

summer sapphire
#

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':compileJava'.
> error: release version 17 not supported

* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 359ms
1 actionable task: 1 executed
summer sapphire
#

java 17?

vocal cloud
#

As in release version 17 is not supported

summer sapphire
#

java 17?

tender shard
#

yes

summer sapphire
#

odd

vocal cloud
#

Have you tried googling it?

tender shard
#

what version of the shadow plugin are you using?

tender shard
iron glade
summer sapphire
glossy venture
#

you need to use gradle 7.1

vocal cloud
glossy venture
#

go to your /gradle/wrapper/gradle-wrapper.properties

summer sapphire
glossy venture
#

and replace the version in the url with 7.1

#

that does support java 17

summer sapphire
#

7.3.3?

glossy venture
#

ah then its not the java

#

or it might be java 18

summer sapphire
#

its all being weird tbh

glossy venture
#

try changing it to 7.1

vocal cloud
#

What version is in the project settings

#

that's not the solution lol

glossy venture
#

always works for me

vocal cloud
glossy venture
#

well we want java 17

vocal cloud
#

You shouldn't need to downgrade to get things to work

glossy venture
#

but we need to have a gradle version that supports that

#

and 7.1 does

summer sapphire
#

i think my IDE is being stupid af

#

actually

vocal cloud
#

How does 7.1 support it but 7.3 doesn't

glossy venture
#

maybe 7.3 is for 18 idfk

tender shard
vocal cloud
#

It should be backwards compat

glossy venture
#

or thats not the error at all

summer sapphire
glossy venture
#

ah

vocal cloud
#

I once had an issue that was fixed by setting the java version gradle uses to 17

tender shard
tender shard
#

your project settings only apply to e.g. when you use intellij to invoke gradle

summer sapphire
#

inconsistent with pycharm's behavior which im more used to

#

rip

#

lmao

tender shard
#

you should have a gradle tab on the upper right. if you click on "compileJava" there, then it should use your defined jdk πŸ™‚

summer sapphire
#

i want to know how to do it from CLI for github actions

#

ig ik now

tender shard
#

it would be funny if github wouldn't be pronounced "git-hub" but rather "gi-thub" like with the "th" as in "thanks" lol

subtle folio
#

i’m doing that from now on

summer sapphire
subtle folio
#

yup

summer sapphire
#

ok

#

so

#

im back where i started

#

just gotta add shadowing

#

i think

#

man

#

i miss cargo

quaint mantle
#

OMG

#

Rust enjoyer?

summer sapphire
tender shard
#

gradle is so much more complicated than maven while adding so little benefits

quaint mantle
#

cargo

#

is the best

#

dependency manager to ever be created

vocal cloud
#

Oh no here we go again kek

summer sapphire
#

i <3 cargo

quaint mantle
#
[dependencies]
ivm-common = { path = "../ivm-common" }
constant_pool_macro = { git = "https://github.com/Redempt/constant_pool" }

summer sapphire
#

ive spent

#

so muchtime

#

just

#

setting up

#

the build system

#

ahhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh

quaint mantle
humble tulip
#

@summer sapphire ban check

#

Oh he still here

quaint mantle
#

kick one of your friends and say "mb it was a misclick" as the reason

tender shard
#

lmao

#

reminds me of this one the office episode

#

"i didnt get both of your messages"

crisp steeple
#

t

humble tulip
#

u

smoky oak
#

'remove(); - mark the entity for removal'
How fast does that remove stuff?

chrome beacon
#

Probably next tick

smoky oak
#

is there a non nms way to find out which dragon part a ComplexEntityPart is? GetType returns UNKNOWN, getName returns EnderDragon, and getCustomName returns null, for every part in the set

humble tulip
smoky oak
#

janky workaround it is

#

i grab the bounding box of each part on spawn tick, and make a list of parts and spawn locations. comparing the bounding box with the spawn location should give me the parts

#

no proper variable names i have to use a hash map

#

but thats a small price to pay for not using nms

humble tulip
smoky oak
#

oh that might just work

#

i know what you mean but i dont know how

#

my experience with enums consist of getType==Material.TYPE

humble tulip
#

Call it EnderDragonPartType

#

And let it have an int in tje constructor

#

Which is the partid

#

and store a map of parts to part type ofc

#

Instead of mapping part to int

smoky oak
#

i've found a different way, but it just gives me more questions

#

mainly

#

how the fuck does boundingbox calculate volume

humble tulip
#

LBW

earnest forum
#

x*y*z

humble tulip
#

Length x breadth x height

smoky oak
#

welllllll no

humble tulip
#

Wdym?

smoky oak
#

see this box as the mouth

#

that has a volume of one

#

apparantly

earnest forum
#

yes because 1x1x1 is 1

humble tulip
#

Well yeah

smoky oak
#

so apparantly i never realized how big the dragon is lol

humble tulip
#

πŸ‘€

smoky oak
#

in that case...

head:27
body:75
wings:32
tailsegment:8```
#

need to figure out how to separate the wings but other than that

#

wait

#

non initialized variables arent null?

#

why?

humble tulip
#

Huh?

#

They are

smoky oak
humble tulip
#

Ohhh

#

Just initialize as null

#

That haooens sometimes and I'm not smart enf to know why

#

Or just replace second winga woth nl

#

Null

twilit roost
#

canI set player head skin to higher resolution than 16x16?

smoky oak
#

okay it gets more confusing. wingB says it has to be initialized, too? Why? The first action i take with it is initializing it

smoky oak
#

default is all you get

#

unless you use resource packs

twilit roost
#

oh I forgot that skulls also have custom model dat

#

a

smoky oak
#

uuuuuuuuuuuuurgh

#

so

#

APPARANTLY

#

a ? b : c is not the same goddamm thing as if(a){b;}else{c;}

#

can ANYONE tell me why

twilit roost
#

eeeh it should be same ?
huh

smoky oak
#

its not

twilit roost
#

how did u test it?

#

btw does anyone have texture editor that allows editing higher resolution skulls?

smoky oak
#

can compile #1 but not #2

#

ergo

#

something got screwed up

tender shard
#

that's not how it works

twilit roost
#

try using ( before and after conditions

tender shard
#

you can't replace your if with the ? thing

smoky oak
#

the three element operator was made specifically for this kind of stuff, for quickly writing checks for which of two values to assign to a variable, or am i completely wrong here

twilit roost
#

what error does intellij provide u?

tender shard
#
int myVar = something ? 1 : 2;
// is the same as
int myVar;
if(something) {
  myVar = 1;
} else {
  myVar = 2;
}
#

notice that in both cases, it's myVar that is assigned, and not two different vars

smoky oak
#

ah that makes sense

smoky oak
tender shard
#

another common use case is for example sth like this

player.sendMessage("Something has been " + (isEnabled ? "enabled" : "disabled"));
smoky oak
#

ah i see

#

different topic why do i need to initialize a variable to null check it

#

isnt stuff null by default

agile anvil
#

I guess it depends the type

tender shard
#

local variables do not have any default value, unlike fields. Why this is the case, I have no idea lol

smoky oak
#

weird