#help-development

1 messages · Page 785 of 1

molten hearth
#

this is what it produced

#

why do i have the feeling that main is from the api

#

actually yeah it seems to have done the opposite

#

now my project is api with a side of root project

dry hazel
#

looking at the correct thing? api should produce artifacts in api/build/libs and the root project should produce them in build/libs

#

and make sure to choose the jar with the -all classifier (shaded)

molten hearth
#

uh

#

hold up

#

now it says my gradle is being used in another process

#

D:

#

yeah okay

molten hearth
#

im not trying to build api

#

im trying to build the root project shadign api into it

dry hazel
#

it needs to be built to consume it?

molten hearth
#

it does/

#

?

#

i thought it could just yoink the files

#

but yes i do have a built version in libs

#

which actually just becomes the root project and the root project becomes a subfolder of it whenever i build the root project

#

so im not sure why its not namespacing it under api

#

oh i see

#

i had them both under like

#

abc.def

#

i guess i shouldve put api under abc.def.api

#

i did a bit of tomfoolery and relocation and got it thanks

pine sandal
molten hearth
#

do blocks not have their own pdcs

inner mulch
#
    public void onTest (PlayerSwapHandItemsEvent event) {
        Player player = event.getPlayer();
        Block block = event.getPlayer().getTargetBlockExact(5);
        if(player.getInventory().getItemInOffHand().getType().equals(Material.AIR)) {
            player.getInventory().setItemInOffHand(new ItemStack(block.getType()));
        }
    }```
why are the items that im getting ghost items?
pine sandal
chrome beacon
#

so you set it and then the event will proceed and overwrite your item

inner mulch
#

ok so i should cancel it?

chrome beacon
#

Try it and see

#

it was just a guess

inner mulch
#

it worked ;)

#

thanks

quaint mantle
#

Is there a reason commands and even things typed in console are outputted twice?

molten hearth
#

is there like, some sort of instrument change event for noteblocks for when something breaks below them

molten hearth
#

great

onyx fjord
#

which jdk distribution contains javafx?

#

i probably need some special version right?

#

nvm got it

pine sandal
#

This might be dumb but how do I get the server to actually log out messages that I send using a logging level such as FINE or FINER. Want to add some debugging statements but I want to make sure I can actually see them Since I have heard its hard to change the logging level.

remote swallow
#

log messages to console

wet breach
#

or change the accepted levels of the default handler

pine sandal
#

So no way that someone could just enable a finer logging level on their server. I would have to implement it.

wet breach
#

as far as I know, typically what most people do is just print their own debug messages

pine sandal
#

Spigot should probably fix that... makes the logging levels sort of useless

wet breach
#

the fine finer and info typically just don't need to be logged as they are not warnings or severe messages therefore why log them?

#

but I do believe these should still pop up in the console

pine sandal
#

Console only logs info and higher.

hollow lagoon
#

Hello, I have a problem with a plugin I made when I create a world via the WorldCreator, here is the error, I know there is a mark do not report but I do not understand how to solve it because it crashes my server https://pastebin.com/haQSBsKM

#
WorldCreator worldCreator = new WorldCreator("rushrace_" + getGameName());
worldCreator.type(WorldType.FLAT);
worldCreator.generatorSettings("2;0;1;");
world = worldCreator.createWorld();
pseudo hazel
#

can you show code?

#

hmm

#

from the message it sounds like a while loop or something

hollow lagoon
#

it's impossible to loop, I'm sure.

young knoll
#

Could be something janky with generator settings

#

Otherwise idk

hollow lagoon
#

Neither do I.

#

i check

#

i try with that (i send code)

#
WorldCreator worldCreator = new WorldCreator("rushrace_" + this.getGameName());
worldCreator.generator(new VoidChunckGenerator());
this.world = worldCreator.createWorld();
this.world.setGameRule(GameRule.DO_MOB_SPAWNING, false);
#
public class VoidChunckGenerator extends ChunkGenerator{
        @Override
        public @NotNull ChunkData generateChunkData(World world, Random random, int chunkX, int chunkZ, BiomeGrid biome) {
            return createChunkData(world);
        }
}
young knoll
#

If you want a void chunk generator in modern versions

#

All you need is an empty generator class

hollow lagoon
#

i try

hollow lagoon
hollow lagoon
#

i try with spigot and paper and it's same

wet breach
#

I suppose it would depend at what point you are trying to generate the world, or if you registered your plugin as a generator

hollow lagoon
#

I didn't register my plugin as a generator because I generate the world after executing a command.

young knoll
#

Yeah you don’t need anything in Bukkit.yml if you are generating the world yourself

hollow lagoon
#

yes

young knoll
#

Try setting a fixed spawn in your generator

hollow lagoon
#

how

young knoll
#

I believe it’s just getFixedSpawn

#

That you override

hollow lagoon
#

in worldCreator ?

young knoll
#

In ChunkGenerator

hollow lagoon
#

it's function ?

#

no crash

#

I'm going to sleep now I'm dead but I'll be back tomorrow if you're still hot to help me but thanks for tonight

hollow lagoon
#

no sry my server have crash

#
@Override
        public @NotNull ChunkData generateChunkData(World world, Random random, int chunkX, int chunkZ, BiomeGrid biome) {
            getFixedSpawnLocation(world, random);
            return createChunkData(world);
        }
young knoll
#

That’s not overriding it

hollow lagoon
#

?

young knoll
#
public class VoidGenerator extends ChunkGenerator {

    @Override
    public Location getFixedSpawnLocation(World world, Random random) {
        return new Location(world, 0, 100, 0);
    }
}```
#

That’s all you need for a void generator

valid burrow
#

opinions on how to make this more appealing

remote swallow
#

@worldly ingot should i be making potion effect type or potion effect translateable

#

or both

worldly ingot
#

type

sterile token
#

If you are making a minigame your best friend is SlimeWordManager, in most cases it takes up you the overloading for loading and/or unloading worlds. Also the worlds loaded by SWM are client side in a sense, meaning the blocks and those things are only seen by the client

remote swallow
# worldly ingot type

enchantment and potion effect type both have translation stuff, what other stuff needs translations

shadow zinc
#

How can I make builder a future and append everything to it?

package com.neomechanical.neoperformance.performance.smart.smartNotifier.report;

import com.neomechanical.neoconfig.neoutils.NeoUtils;
import com.neomechanical.neoconfig.neoutils.kyori.adventure.text.Component;
import com.neomechanical.neoconfig.neoutils.kyori.adventure.text.TextComponent;
import com.neomechanical.neoconfig.neoutils.messages.MessageUtil;
import com.neomechanical.neoperformance.performance.smart.smartNotifier.managers.LagData;
import com.neomechanical.neoperformance.utils.messages.Messages;
import org.bukkit.entity.Player;

import java.util.List;
import java.util.concurrent.CompletableFuture;

public class LagReportBuilder {
    final TextComponent.Builder builder = Component.text();

    public void addData(List<CompletableFuture<LagData>> dataListFuture) {
        dataListFuture.forEach(dataFuture -> dataFuture.thenAccept(data -> {
            // Null means there is no data to report
            if (data == null) {
                return;
            }
            NeoUtils.getNeoUtilities().getFancyLogger().info(data.getDataName());
            TextComponent.Builder dataComponent = data.getMessageData();
            builder.append(Component.text("  ")).append(Component.text("[")).append(Component.text(data.getDataName()))
                    .append(Component.text("]"))
                    .append(Component.newline());
            builder.append(dataComponent);
            builder.append(Component.newline());
        }));
    }

    public void sendReport(Player player) {
        TextComponent message = builder.build();
        if (!message.children().isEmpty()) {
            MessageUtil.send(player, Messages.MAIN_LAG_REPORT_PREFIX);
            MessageUtil.sendMM(player, message);
            MessageUtil.send(player, Messages.MAIN_SUFFIX);
        }
    }
}
#

obviously this method is flawed as there is no guarantee the data will be appended to the builder

worldly ingot
remote swallow
worldly ingot
#

lol no. You probably did somethin' weird but I wouldn't worry too much about it rn

young knoll
#

I’m in your walls too

worldly ingot
#

idk man

#

I can help you clean up the commits after lol

remote swallow
#

thanks

#

ill open the pr now to start getting feedback\

opal juniper
#

(it’s bad)

quaint mantle
#

who's coming chat?

torn shuttle
#

man my model animator is so close and yet not quite there

shadow zinc
#

How can I improve this code (or make it work):

public class LagReportBuilder {
    CompletableFuture<TextComponent.Builder> builderCompletableFuture = new CompletableFuture<>();

    public void addData(List<CompletableFuture<LagData>> dataListFuture) {
        dataListFuture.forEach(dataFuture -> dataFuture.thenAccept(data -> {
            // Null means there is no data to report
            if (data == null) {
                return;
            }
            NeoUtils.getNeoUtilities().getFancyLogger().info(data.getDataName());
            TextComponent.Builder dataComponent = data.getMessageData();
            builderCompletableFuture = builderCompletableFuture.thenCompose(builder -> {
                builder.append(Component.text("  ")).append(Component.text("[")).append(Component.text(data.getDataName()))
                        .append(Component.text("]"))
                        .append(Component.newline());
                builder.append(dataComponent);
                builder.append(Component.newline());
                return CompletableFuture.completedFuture(builder);
            });
        }));
    }

    public void sendReport(Player player) {
        builderCompletableFuture.thenApply(builder -> {
            TextComponent message = builder.build();
            if (!message.children().isEmpty()) {
                MessageUtil.send(player, Messages.MAIN_LAG_REPORT_PREFIX);
                MessageUtil.sendMM(player, message);
                MessageUtil.send(player, Messages.MAIN_SUFFIX);
            }
            return null;
        });
    }
}
#

its meant to go through each data retriever future and append it to a message builder, then send the message

#

I'm not sure how to do it properly though

valid burrow
#

"how can i improve this code"

#

thats the kind of question youd ask gpr

remote swallow
#

no not really

#

chatgpt doesnt really always give the best code

echo basalt
#

I doubt TextComponent.Builder is thread safe

#

if you want to maintain the order in the list you allOf and thenRun, loop and build

valid burrow
shadow zinc
vast raven
#

Does player always send packet when pressing hand switch button? Even if the hands are empty?

upper hazel
#

Is it really possible to create a texture on a placed block (1.16.5)?

#

ItemsAdder somehow did this

vast raven
#

It isn't possible actually

#

I mean, you can't using custommodeldata

#

ItemsAdder uses a barrier block with an invisible stand

#

The stands has the item with the custommodeldata

upper hazel
#

but in the plugin wiki there are written types of blocks that can be created (REAL_POST, REAL)

#

and these 2 types are real blocks

vast raven
#

There is not a way to create blocks textures without changing the texture of that block

#

But you can't using custommodeldata

upper hazel
#

hm

#

so this just entity?

vast raven
#

Yep

#

You can figure it out just when you try to break that block

upper hazel
#

Is it possible to somehow simulate a block as if the player is breaking it (with his own strength)

vast raven
#

That's why ia sit can't make you interact cause you actually click on the stand

upper hazel
#

yes

vast raven
#

Packets

upper hazel
#

...

#

demm

#

looks like it's more difficult than it seemed

vast raven
#

It's not that difficult, it's just a packet

upper hazel
#

Is it possible to speed up the animation?

#

or reduce

#

i mean this just packet

upper hazel
rotund ravine
#

What

sacred prairie
#

if this is what you ment

upper hazel
#

lol

ocean hollow
#

please help, for some reason when I create a display block, it is empty, even though I installed a block there

#

if you look through /data, then they have this block registered and the size is not equal to 0

sacred prairie
#

are creaperheads displayable 🤔 well try displaying them with a command

#

also i suggest using enhanced switch statements, they look way better

novel mauve
#

yo guys

#

how do i check if a player is right clicking the air

ocean hollow
#

events

novel mauve
#

just returns null for some reason when i do player interact event

rotund ravine
#

?interactevent

undone axleBOT
#

The PlayerInteractEvent may be called once per hand. If you only want code to be executed once, you can check the result of https://hub.spigotmc.org/javadocs/spigot/org/bukkit/event/player/PlayerInteractEvent.html#getHand(), then decide functionality.

For example, only executing code if the main hand was used:

@EventHandler
public void onPlayerInteract(PlayerInteractEvent event) {
    if (event.getHand() != EquipmentSlot.HAND) { // * if the hand used is NOT the main hand:
        return; // do not progress past this point  |
    }
    // provide functionality
}
novel mauve
#

but when i do e.getClickedBlock.getType it just returns null

#

should it not be Material.AIR

ocean hollow
rotund ravine
#

Null and air er interchangeable mostly

shadow night
#

Isn't the whole air and null thing really inconsistent

novel mauve
#

okay

rotund ravine
shadow night
#

Like sometimes it says are, sometimes it says null

tender shard
#

obviously air is not considered a block for the interact event, otherwise this would not exist

novel mauve
#

i think i realised what im doing wrong

#

action.rightclickair is working its just one of my other conditions are wrong

#

thx guys

ocean hollow
#

Can I replace the player's head texture with mine? Or does this head need to be on the mojang servers?

eternal oxide
#

all textures come from Mojang

ocean hollow
#

So I can't take a texture, edit it, and then load it onto the player's head?

eternal oxide
#

no

ocean hollow
#

so how they did it, with out shaders

#

I think it takes the player's texture and changes it

eternal oxide
#

reflection or a 3rd party API which uploads to Mojang

sacred prairie
#

isnt the value of you head saved on mojangs servers when you change your skin? so you could change your skin, get a player head from you and copy the value which is stored in the nbt. could be wrong tho

chrome beacon
#

You can also do some cool stuff with vanilla shaders

rotund ravine
eternal oxide
#

yep, all the server does is send a texture link to the client. The client then downloads teh Texture from Mojang

lost matrix
sacred prairie
#

or after the head got signed you could just use the texture string and use that for reproduction

rotund ravine
# eternal oxide yep, all the server does is send a texture link to the client. The client then d...

Newer versions will do: [15:08:41 WARN]: Found inconsistent skull meta, this should normally not happen and is not a Bukkit / Spigot issue, but one from a plugin you are using. Bukkit will attempt to fix it this time for you, but may not be able to do this every time. If you see this message after typing a command from a plugin, please report this to the plugin developer, they should use the api instead of relying on reflection (and doing it the wrong way).

tender shard
rotund ravine
#

If u mess around

lost matrix
tender shard
#

I am not little D:

sacred prairie
#

is simple then adding another plugin to the server which will annoy the end user

lost matrix
tender shard
#

my ID says I'm 185cm but it's wrong

rotund ravine
#

So ur smaller?

#

My id is also less than i actually am lol

tender shard
#

no I'm a bit taller. they just copied over the value from when I was 15 all the time when I got a new ID

#

"are you still 185cm?" "idk" "ok then I'll just copy it over"

#

like that

lost matrix
#

My id says 180 but im actually a 2m

rotund ravine
#

The height is pretty useless anyway

novel mauve
#

how do i check if someones holding nothing

rotund ravine
#

No one checks 💪🏻

rotund ravine
lost matrix
novel mauve
#

is it just item in use with material type Material.AIR?

lost matrix
#

Player -> PlayerInventory -> getItemInMainHand() / getItemInOffHand()

novel mauve
#

thanks

tender shard
lost matrix
tender shard
#

at least on EntityEquipment - maybe it's different on PlayerInventory or sth

lost matrix
#

yap

tender shard
#

I always just check it like this

    /**
     * Checks if an ItemStack is null or empty (empty = amount of 0 or if the type is air)
     */
    public static boolean isNullOrEmpty(@Nullable final ItemStack itemStack) {
        return itemStack == null || itemStack.getType().isAir() || itemStack.getAmount() == 0;
    }
sacred prairie
#
int m = 0;
        IBlockData[] materials = new IBlockData[]{Blocks.fJ.getBlockData(), Blocks.jR.getBlockData(), Blocks.jY.getBlockData()};

        private IBlockData nextMaterial() {
            m++;
            if (m == materials.length) m = 0;
            return materials[m];
        }

        private void placeBlocks(Block first, Set<FallingBlock> set, boolean b) {
            set.clear();
            for (int i = 0; i < 7; i++)
                for (int j = 0; j < 7; j++) {
                    b = !b;
                    if (b) return;
                    Location l = Tools.getAsLocation(first).subtract(0, 0.1, 0).add(i, 0 , j);
                    Main.debug.debug(l);
                    EntityFallingBlock fallingBlock = new EntityFallingBlock(((CraftWorld) first.getWorld()).getHandle(), l.getX(), l.getY(), l.getZ(), nextMaterial());
                    ((CraftWorld) first.getWorld()).getHandle().addEntity(fallingBlock);
                    for (Player player : Bukkit.getOnlinePlayers()) ((CraftPlayer) player).getHandle().b.sendPacket(fallingBlock.getPacket());
                    FallingBlock fB = (FallingBlock) fallingBlock.getBukkitEntity();
                    fB.setHurtEntities(false);
                    fB.setDropItem(false);
                    set.add(fB);
                }
        }

So i try spawning a falling block using this, the location where it spawns is correct but i never see it

rotund ravine
#

Why do you need nms for this

tender shard
#

^

#

World#spawnFallingBlock or whatever

sacred prairie
sacred prairie
#

hmm ill try

#

works tysm

novel mauve
#

the 2fa is so broken

#

im tryna update something but 😭

rotund ravine
#

?

shadow zinc
#

I've tried everything and I keep getting this error:
[21:28:02 WARN]: [NeoPerformance] Error loading configuration into class: Can't construct a java object for tag:yaml.org,2002:com.neomechanical.neoperformance.config.PerformanceConfig; exception=Class not found: com.neomechanical.neoperformance.config.PerformanceConfig in 'reader', line 4, column 1: performance_tweak_settings: ^

#

this is the function that loads the yaml file into the class ```java
public <T> T loadConfigIntoClass(Class<T> targetClass) {
try (InputStream inputStream = plugin.getResource(configFilePath)) {
if (inputStream == null) {
NeoUtils.getNeoUtilities().getFancyLogger().warn("YAML file not found: " + configFilePath);
return null;
}

        Yaml yaml = new Yaml();
        T configObject = yaml.loadAs(inputStream, targetClass);

        if (configObject != null) {
            return configObject;
        } else {
            NeoUtils.getNeoUtilities().getFancyLogger().warn("YAML file does not represent the expected class: " + configFilePath);
            return null;
        }
    } catch (Exception e) {
        NeoUtils.getNeoUtilities().getFancyLogger().warn("Error loading configuration into class: " + e.getMessage());
        return null;
    }
}```
#

I've tried including the class stated into the build, even checked it it was there with archieve, and it was

rotund ravine
#

Why don’t you just extract it with the supplied methods

lost matrix
shadow zinc
#

It was getting messy, I wanted a nice clean class to store all my configuration data

lost matrix
#

You can do that with spigots api. Just let it implement ConfigurationSerializable and you can throw the entire class into your config file

shadow zinc
#

Oh?

#

I wasn't aware of this

rotund ravine
#

?serializable

#

?serialize

lost matrix
rotund ravine
#

Huh

shadow zinc
#

well im assuming you mean 'throw the entire yaml file into the class'

wet breach
#

if for some reason you want to go the route you were trying, you would want to use something like java.util.Properties

#

just fyi

#

no reason to do it the way you were trying to and will lead to a lot of issues lol

#
public final class Config {

    private static final Properties properties = new Properties();

    static {
        try {
            ClassLoader loader = Thread.currentThread().getContextClassLoader();
            properties.load(loader.getResourceAsStream("com/example/config.properties"));
        } catch (IOException e) {
            throw new ExceptionInInitializerError(e);
        }
    }

    public static String getSetting(String key) {
        return properties.getProperty(key);
    }

    // ...
}
shadow zinc
wet breach
#

you need a map otherwise how you suppose to read the stuff?

#

my example above with the old fashion way even puts it in a map as well

lost matrix
shadow zinc
#

4.4. Nested Objects and Collections

#

thats pretty much what I want

#

And what I'm doing

tender shard
#

all of that is builtin to spigot if you just use ConfigurationSerializable

shadow zinc
#

I can't find what you are talking about

#

All I'm seeing is reading it into a map

#

which I already have, but don't currently require

#

Yaml contents->Class

tender shard
#

MyCustomObject myObject = plugin.getConfig().getSerializable("my-object", MyCustomObject.class);

lost matrix
# shadow zinc This is for loading it into a map, I want to throw it directly into a class
public class BaseConfiguration implements ConfigurationSerializable {

  private int someInt;
  private String someString;
  private boolean someBoolean;

  @Override
  public Map<String, Object> serialize() {
    Map<String, Object> mapping = new HashMap<>();

    mapping.put("this.is.some.int", this.someInt);
    mapping.put("this.is.some.string", this.someString);
    mapping.put("this.is.some.boolean", this.someBoolean);

    return mapping;
  }
  
  public static BaseConfiguration deserialize(Map<String, Object> mapping) {
    BaseConfiguration config = new BaseConfiguration();

    config.someInt = (int) mapping.get("this.is.some.int");
    config.someString = (String) mapping.get("this.is.some.string");
    config.someBoolean = (boolean) mapping.get("this.is.some.boolean");

    return config;
  }
  
}

If you want to be fancy then you could use reflections for serializing everything and just using the field names as keys.

wet breach
#

there is significant differencees between snakeyaml 1 and 2

shadow zinc
#

so thats not an issue

rotund ravine
#

@tender shard Why do you not have a config blog

shadow zinc
#

well it is, but it isn't

wet breach
#

then there is going to be stuff missing I assume in terms of the api for configuration stuff that is being shown

#

just don't know which stuff will be missing lol

lost matrix
tender shard
rotund ravine
#

Apparently not lol

shadow zinc
#

oh just saw your other message

#

mb

#

actually its still a bit unclear

#

there seems to be more effort in this approach

lost matrix
#

More effort compared to what?

shadow zinc
#

simply using snake to loadAs the config into a class

#

okay, maybe we could step back and just discuss whats wrong about my current approach

#

because I can't actually see anything that will help from spigots api

lost matrix
#
  1. You are hiding important information with your try-catch because the stack trace is thrown away
  2. The config file probably contains !!com.neomechanical.neoperformance.config.PerformanceConfig at the beginning, which is a class that was not found on the classpath
shadow zinc
#

I was under the impression that loadAs made the !! portion of the config file not neccessary

#

I have experimented with both, it doesn't really do anything

#

And for 2, unless I'm mistaken, it being present in the jar file means it is included in the classpath?

lost matrix
#

Depends on the classloader being used

shadow zinc
#

Well i did specify to include it like this:

    <plugins>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-jar-plugin</artifactId>
            <version>3.1.1</version>

            <configuration>
                <includes>
                    <include>com/neomechanical/neoperformance/config/**</include>
                </includes>
            </configuration>
        </plugin>
    </plugins>
</build>
#

where the class is in config

#

and the error still continued

lost matrix
shadow zinc
#

I'm guessing the knowledge I'm lacking on what a classpath actually is might be starting to cause confusion for both of us

#

I thought it just meant the class is in the jar file

#

if its not there, then error, class not found

#

so surely including it would have fixed that, but it didn't

lost matrix
#

Im currently doing some reasearch on snakeyaml and it might be a problem with spigots classloader
give me a few

lost matrix
shadow zinc
#

Thats obvious

#

I just don't understand how it has the gaul to say class not found when its clearly included

lost matrix
# shadow zinc

Add a

    try {
      Class.forName("com.neomechanical.neoperformance.config.PerformanceConfig");
      // log message here
    } catch (ClassNotFoundException e) {
      throw new RuntimeException(e);
    }

Right before you load the config. Im pretty sure that it will be found.

shadow zinc
# lost matrix Add a ```java try { Class.forName("com.neomechanical.neoperformance.c...

[21:59:07 INFO]: [NeoPerformance] Class found [21:59:07 WARN]: [NeoPerformance] Error loading configuration into class: Can't construct a java object for tag:yaml.org,2002:com.neomechanical.neoperformance.config.PerformanceConfig; exception=Class not found: com.neomechanical.neoperformance.config.PerformanceConfig in 'reader', line 4, column 1: performance_tweak_settings: ^

#

hmmmm

#

I'm getting mixed signals here

lost matrix
#

Alright, remove your weird logging and send the entire stack trace then pls

#

Sounds to me like snakeyaml attaches to a different classloader. But we will see.

shadow zinc
#

Oh, well it is running in my library

#

that might be it then?

lost matrix
#

Do you use the maven shade plugin in your pom?

shadow zinc
#

wait no, I copied code from the library and put into my main plugin and it performed the same, so no

shadow zinc
shadow zinc
#

ignore me

#

yes I use shade

rotund ravine
#

👀

lost matrix
#

Alright delete the maven-jar plugin then.
And show your entire pom

#

And tell me exactly the steps you use to compile while you are at it

shadow zinc
#

alright

#

?paste

undone axleBOT
shadow zinc
shadow night
#

how would I track when the player enters the end portal from inside the end?

shadow zinc
#

So i run clean package for the parent module

tender shard
shadow zinc
tender shard
#

what

shadow zinc
#

idk

#

i think much about it

#

I needed the library

tender shard
#

Many people who are using the maven-shade-plugin commonly set to false for reasons beyond my grasp. This is generally a bad idea, as it can lead to problems if you’re writing a library, and has absolutely no advantages. Here’s a rule of thumbs: If your project shades dependencies, it should create a dependency-reduced-pom.xml. The...

#

doesnt have anything to do with your issue though

shadow zinc
#

Okay I'll delete that

lost matrix
shadow zinc
#

I did at one point, but currently I do not

tame coral
#

check the dimension they're coming from with event.getFrom()

shadow zinc
#

also working on the stacktrace still

lost matrix
shadow zinc
#

compiling my library

shadow zinc
#

I also heard there can be conflicts

#

from an anvil gui library

#

haven't had any issues with it

lost matrix
#

Isnt that a path in your own project?

shadow zinc
#

no

#

its a separate project

#

from nexus

#

wait

#

that shouldn't be a problem right?

lost matrix
#

That could very well be a problem

shadow zinc
lost matrix
#

But regardless its a very weird approach to relocate your own path inside a sub-module instead of simply renaming the path

shadow zinc
#

the stacktrace doesn't really help much

#

something about a constructor

#

do i need to add a constructor maybe?

lost matrix
#

Remove the relocation of your own path and try again.
Im kind of confused on your paths names btw.
You now have
com.neomechanical.neoperformance.config
and
com.neomechanical.neoperformance.neoconfig
Is this wanted?

lost matrix
shadow zinc
#

I'll remove the relocation and test it

wet breach
rotund ravine
#

Omg paper banned

shadow zinc
#

1.8 up

wet breach
#

if that is the case, why are you testing it on 1.20

shadow zinc
rotund ravine
#

Ahaha

#

We can if we’re too lazy to help

wet breach
#

you need to first start with 1.8, also I already stated that the modern versions use snakeyaml 2.2 which there is a significant difference from snakeyaml 1.21

echo basalt
wet breach
#

so, you need to first start with 1.8, then work your way up to where snakeyaml versions change

#

and then you will need some submodules to handle that difference

shadow zinc
#

okay ill test 1.8, let me boot up the toilet server

rotund ravine
#

Is it cooled by toilet water?

echo basalt
#

yooo

#

I wonder if that's a legit option or not

shadow zinc
#

water cooled, nah I just took the side panel off and put a big fan there

rotund ravine
wet breach
echo basalt
#

what if we did like a hvac system

#

but for your pc

#

I think the power draw might be a bit higher than the pc's draw though

wet breach
#

I have put a freezer compressor in a computer case before and cooled it with freon 🙂

echo basalt
#

yeah I can picture my dad doing that shit

#

goofy ass

wet breach
#

the best compressors to use are the ones from those old deep freezers

wet breach
echo basalt
#

idk dude fixes AC units for a living he might have something beefy

wet breach
#

otherwise the condensation will just kill the cpu XD

rotund ravine
#

Too messy for me tbh

wet breach
#

I forget what I used, but it doesn't make a mess

rotund ravine
#

I don’t need those extra 0.3 ghz

#

Or whatever

wet breach
#

with using freon

#

you can overclock up to about 6ghz

rotund ravine
#

On some cpus

shadow zinc
#

1.8 has the same error

#

that was a waste of time

wet breach
#

not really, my point was to code against 1.8 and the version that 1.8 to I think 1.14 use the same snake yaml versions

shadow zinc
#

well it wasn't a waste of time since now we know that

#

but still

#

it feels pointless even if it isn't

wet breach
#

well I tried telling you this a while back XD

echo basalt
#

hear me out

#

what if you parsed stuff manually instead of using ConfigurationSerializable and avoided obscure issues

wet breach
#

or they could go with the method that works in Java

#

for this thing

shadow zinc
#

that was the original implementation

#

I didn't like the way it looked

echo basalt
#

tbh I just got out of bed and have no context other than config bad

#

and something something classloader .properties file

shadow zinc
#

I think we ruled out classloader

#

maybe

#

idk

#

7 kinda dipped

wet breach
#

I gave them an example of using Java properties

echo basalt
#

yikes what the fuck

shadow zinc
#

i might just do what i was doing before

echo basalt
#

lately I've been doing something similar to bungee's config system where it's just a Map<String, Object> wrapper with multiple loaders

shadow zinc
#

something about getting the config keys with strings feels icky

tender shard
lost matrix
#

Im back. Idk, just pipe int into Gson. It serializes you everything.
Translation from json to yml should be easy afterwards

wet breach
#

but I think this just might be a case of over complicating something that doesn't need to be overcomplicated

echo basalt
#

so you can load json, yml, toml etc and use the same logic

shadow zinc
#

is it just me or is it a bit tacky to do use get by string for config values?

#

the class just felt better

wet breach
#

most everyone just uses the api to get the values they want

#

there is like no difference performance wise lmao

shadow zinc
#

I understand that

#

it just feels wrong

echo basalt
#

what if you just made a class that represents your config file and you just read the objects and had a bunch of getters 🙄

shadow zinc
#

no

#

just no

#

its a simple enough idea

#

shouldn't be 3 hours of my life

echo basalt
wet breach
#

the other two methods you would have been done with it by now 😛

shadow zinc
#

maybe you can settle with the measly config.getString, but I want something different

lost matrix
echo basalt
#

just use sponge configurate

#

or some fucked config enum like I've seen some plugins do

wet breach
#

lol

shadow zinc
#

ffs, the pain of doing this is more than just using getString

#

im going to just do that

echo basalt
#

gotta love intellij's recent projects tab having alzheimer's

shadow zinc
#

sorry for wasting your time with this lol

novel mauve
shadow zinc
#

but thank you

novel mauve
#

any reason why this is being spammed

shadow zinc
#

your welcome

echo basalt
wet breach
#

also, when it comes to config properties file stuff, relocating tends to sometimes break them

#

if that is of any consolation since I noticed somewhere above you were relocating one of your own modules

shadow zinc
#

its also a plugin

lost matrix
shadow zinc
#

which i have installed

wet breach
#

pretty much the feeling I have when I am point out the outdated snakeyaml version they have to target, and again lets not forget that somewhere in the versions the snakeyaml version changes where everything is almost completely different

shadow zinc
echo basalt
shadow zinc
#

you did mention that before

wet breach
lost matrix
shadow zinc
#

use Gson for what? can't I simply dump it into a map and call it a day?

echo basalt
#

that's what gson does

#

well

#

Kinda

#

It converts to a jsonobject which is a glorified LinkedHashMap

#

type deal

shadow zinc
#

hmm

lost matrix
# shadow zinc use Gson for what? can't I simply dump it into a map and call it a day?

Gson lets you do this right out of the box.

    Gson gson = new GsonBuilder().disableHtmlEscaping().setPrettyPrinting().create();
    File file = new File(...);

    // Write to file
    BaseConfiguration config = new BaseConfiguration();
    String toJson = gson.toJson(config);
    Files.writeString(file.toPath(), toJson);
    
    // Read from file
    String json = Files.readString(file.toPath());
    BaseConfiguration loadedConfig = gson.fromJson(json, BaseConfiguration.class);

Without you needing to implement anything.

shadow zinc
#

so gson.fromJson is gsons answer to loadAs?

upper hazel
#

I think for this reason it’s better to just get everything through the constructor

lost matrix
echo basalt
#

one of us idiots should implement a yml gson thing

#

I'd name it ymlson but it doesn't make sense

wet breach
#

ymlG

lost matrix
#

...

echo basalt
#

why G

#

if it's not made by google

#

and the code is not gangsta

#

how about BYML

#

Because it's bukkit and bad

lost matrix
#

whyml

echo basalt
#

sure

#

I'm thinking of having completely overengineered parts

#

and completely missing the basics

wet breach
lost matrix
upper hazel
#

file.bukkit

echo basalt
#

stuff like number rounding strategy

#

so I can tell if reading an int from 1.6 rounds it, floors it, ceils it or just throws an error

wet breach
#

lol

echo basalt
#

but completely miss out the basics on like

#

comments

wet breach
#

who needs comments anyways

echo basalt
#

self-commenting code bro StareZany

lost matrix
#

Convert it to a String with legacy chat coloring §5 1.5999999
and throw an UnsupportedLookAndFeelException

wet breach
#

lol

echo basalt
#

let me note this down

undone yarrow
#

How do I check whether a certain player sent a command? I want to check if the player with the name "testingplayer" ran it.

    public void Clear(CommandSender sender){
        if(chests.size() == 0){
            sender.sendMessage("There are no blocks selected.");
            return;
        }
        if(sender.getName().equals("testingplayer")){
            sender.sendMessage("Only testingplayer may use this command.");
            return;
        }``` Would something like this work? I can't test it right now but it seems to make the most sense
echo basalt
#

what if

#

we crashed the jvm

#

every time we saw a §

wet breach
wet breach
#

unless you wanted to check for any command in which case there is an event

undone yarrow
#

not any player

undone yarrow
wet breach
#

if(sender instanceof Player) {
    Player player = (Player)sender;
    if (player.getName().equalsIgnoreCase("Player name"){
        //do something
    }
}
rotund ravine
#

Go with uuid instead

wet breach
echo basalt
#

ah yes let me hardcode some uuids

#

one idea I had the other day

rotund ravine
#

💪🏻

wet breach
#

but ideally you would pull the name from UUID ahead of time though yes

echo basalt
#

and had like a huge email server just logging all the data

undone yarrow
rotund ravine
wet breach
echo basalt
#

email I shall receive

#

log if for like a year or two

undone yarrow
#

Yeah but the "sender instanceof Player" isn't necessary for the part I'm doing it, because I already checked if it's a player somewhere else, right?

#

Before running this I already checked if it was a player or commandblock

#

or smth else

#

only players are allowed to run it

rotund ravine
#

Depends on how you checked

wet breach
#

idk, I put it there so you know you should check to make sure sender is indeed a player

#

and not assume because console could have executed the command

#

and console isn't a player

echo basalt
#

there was something about a non-console non-player command sender

#

something something remote

wet breach
#

entities can execute commands and so can command blocks

echo basalt
#

don't command blocks just act as the console

shadow night
shadow night
#

With the command block, it actually has coordinates and stuff

echo basalt
#

oh fun

#

can't wait for that 1 plugin that casts to ConsoleCommandSender to break

#

Might need to actually add this functionality to my skyblock core

wet breach
echo basalt
#

the amount of platform-agnostic stuff I'm doing basically means I'm rewriting bukkit lmao

wet breach
#

look at all them subinterfaces of commandsender

#

XD

echo basalt
#

LeashHitch

wet breach
#

ironically BlockDisplay is in there, didn't think it would be something sending commands

echo basalt
#

oddly specific

wet breach
#

yeah lol

shadow night
#

Can /execute execute stuff as entities

undone yarrow
#

Whats the difference between compiling and packaging the plugin?

shadow night
#

Doesn't compile only make class files and package a jar? Or something like that

wet breach
#

correct

echo basalt
#

install is package + maven install

#

which is fun

shadow night
#

clean is rm -rf target

wet breach
#

compiling doesn't mean a jar is created, just that the classes are made in the structure you see in IDE

#

package, puts that stuff into a nice jar

undone yarrow
#

Ah alright

#

thanks

wet breach
#

also, it isn't necessary if using maven, to call compile and package

#

you can just call package, as it will include compiling as that is a lifecycle lower then it

shadow night
#

Should I mvn clean before packaging 🤔

wet breach
#

depends on what you are doing

#

most times no

#

as that prevents maven from being able to use cache

shadow night
#

Can cache be bad

wet breach
#

however, some unique project setups require clean building though

wet breach
#

my HoloAPI project can only be built using clean builds

#

can't use cache for it

shadow night
#

Why is that so

wet breach
#

because it does post processing stuff that if there was a cache it gets in the way and grabs the wrong stuff

shadow night
#

Makes sense

shadow zinc
#

I'm so stuck on what to do now lol, he was talking processing with gson, but i thought snake had a map option too

#
    public Map<String, Object> getConfigAsMap() {
        try (InputStream inputStream = plugin.getResource(configFilePath)) {
            if (inputStream != null) {
                Yaml yaml = new Yaml();
                Object object = yaml.load(inputStream);

                // Check if the result is a map, and cast it accordingly
                if (object instanceof Map) {
                    //noinspection unchecked
                    return (Map<String, Object>) object;
                } else {
                    NeoUtils.getNeoUtilities().getFancyLogger().warn("YAML file does not represent a map: " + configFilePath);
                    return new HashMap<>();
                }
            } else {
                NeoUtils.getNeoUtilities().getFancyLogger().warn("YAML file not found: " + configFilePath);
                return new HashMap<>();
            }
        } catch (Exception e) {
            NeoUtils.getNeoUtilities().getFancyLogger().warn("Error loading YAML file: " + e.getMessage());
            return new HashMap<>();
        }
    }```
undone yarrow
#

Changing a plugin to use CustomModelData?

shadow zinc
#

Just to clarify, there is nothing wrong with using FileConfiguration.getWhater throughout my project?

#

is it perfectly acceptable, no loading it into a class or setting a bunch of variables in another class needed?

echo basalt
#

Well

#

Ideally

#

You maintain single responsibility and do your config stuff on your config class

#

An easy example is to just

#
public class MyConfiguration extends MyAbstractConfiguration {

  private final int interval; // something random
  private final String name;

  public MyConfiguration(JavaPlugin plugin) {
    super(plugin);
    
    FileConfiguration config = super.getConfiguration();

    this.interval = config.getInt("interval", 123);
    this.name = config.getString("name", "joe");
  }

  public int getInterval() {
    return this.interval;
  }

  public String getName() {
    return this.name;
  }
}
#

type deal

shadow zinc
echo basalt
#

So you can later

int interval = myConfiguration.getInterval();
#

For data objects, I'd say it's reasonable to have a constructor with a ConfigurationSection

#
public class MyPersonClass {

  private final String name;
  private final int age;
  private final int phone;

  public MyPersonClass(ConfigurationSection section) {
    this.name = section.getString("name");
    this.age = section.getInt("age");
    this.phone = section.getInt("phone");
  }

  get...
}
#

So you can then load objects and such

#

More advanced config work may involve a bunch of interfaces

quaint mantle
#

I’m getting this error in my console can someone help
11.11 11:52:51 [Server] WARN You specified a resource pack without providing a sha1 hash. Pack will be updated on the client only if you change the name of the pack. could someone explain this

echo basalt
#

When you set a resourcepack you should hash it with the sha-1 algorithm

#

So that when you send the resourcepack (and its name and hash) the client can compare the hash for changes

quaint mantle
#

can you explain that tho

#

what is that

echo basalt
#

Rather than just checking the name

shadow zinc
echo basalt
#

Sha-1 is one of many hashing algorithms

shadow zinc
#

okay now we are talking

lost matrix
#

You indicated a resource pack but did not include a sha1 hash. The pack will only be updated on the client if the pack's name is changed.

quaint mantle
#

oh so how do i add a hash

#

and is it just this #

echo basalt
quaint mantle
#

wait i’m lost

lost matrix
quaint mantle
#

my resource pack isn’t a file it’s a link

lost matrix
#

a sha-1 hash

echo basalt
#

Are you aware of the concept of a hash

quaint mantle
#

nope

#

just want to setup my resource pack 😂

echo basalt
#

Alright so basically a hash is just a (usually one-way) short numerical representation of data

#

It can be lossy and have collisions (two inputs produce the same output)

#

The idea is that if any of the contents change, the hash is not the same

#

So you can send the hash for both files and see if you have the "same" files by just seeing if the hashes are the same

#

You should hash your resourcepack and toss the hash in your config or whatever

#

With code you just

public byte[] createSha1(File file) throws Exception  {
    MessageDigest digest = MessageDigest.getInstance("SHA-1");
    try(InputStream fis = new FileInputStream(file)) {
      int n = 0;
      byte[] buffer = new byte[8192];
      while (n != -1) {
          n = fis.read(buffer);
          if (n > 0) {
              digest.update(buffer, 0, n);
          }
      }
    }

    return digest.digest();
}
#

wait who's the idiot that's not closing fis

quaint mantle
#

i’m so lost right

shadow night
#

digest.digest()

echo basalt
#

there we go

quaint mantle
#

i go into my servers config files

#

and i’m looking at resource pack and it’s got a link in it

shadow night
#

A link to a file

echo basalt
#

Pretty sure mcpacks provides hash

deft thistle
lost matrix
echo basalt
#

Yeah I was getting that vibe

deft thistle
#

resourcepack*

#

mb

quaint mantle
#

so in my resourcepack config i just have this in it https://www.dropbox.com/s/6oflxpd8rxi6wfq/novaprisons.zip?dl=1

#

so whats wrong with it

shadow night
#

Nothing

quaint mantle
#

so why doesnt it work

#

anymore

deft thistle
quaint mantle
#

it worked for like 2 weeks now it deosnt and im getting that error

#

in console

echo basalt
#

your hash is ec9881e790ce6ab6d9178deaa0b36e4456289ae5 btw

quaint mantle
#

okay so what do i do with it

shadow night
quaint mantle
#

but its not working anymore so it must be breaking it

echo basalt
#

toss it on your config or something

quaint mantle
#

when i log in i say yes to the resource pack but now nothing actualy shows

#

toss it where

ivory sleet
#

@quaint mantle as smile said, this channel is not the right one, go to #help-server

quaint mantle
#

oh can i not just finish this convo here

ivory sleet
#

no

quaint mantle
#

we mid way through a convo

#

imillusion can u go to help server?

shadow night
ivory sleet
#

it doesn't matter, you went to the wrong channel in the first place...

echo basalt
undone yarrow
quaint mantle
#

oh

#

please

ivory sleet
#

dude

#

patience

shadow night
#

Nobody here is paid to give support

quaint mantle
#

i never stated that did i

#

he was helping me

#

then conclube said wrong channel now man is gone

ivory sleet
#

just drop it

shadow zinc
echo basalt
#

I'd rather load it on the constructor tbh

shadow zinc
#

why

wet breach
#

I have way too many points on steam

#

and this is not general, all well

echo basalt
#

bros dming me sigh

#

need to learn to not help ppl

novel mauve
#

whats wrong w that

#

bro just wants help

echo basalt
#

If you need help ask for it on the appropriate channel

#

Rather than coming on the wrong channel, asking for stuff, fighting the unpaid staff and dm'ing the one guy that gave you a pointer

novel mauve
#

ohh fairs

quaint mantle
#

does anyone know how I could remove the player death animation?

#

if there's a way without packets that would be preferable

chrome beacon
#

What version?

quaint mantle
#

1.19.4

undone yarrow
#

Why the heck is this giving an error?

        Material material = Material.matchMaterial(matcher.group(1));
        int model = (groupCount == 1 ? 0 : Integer.parseInt(matcher.group(2)));
        if (material != null) {
            ItemStack item = new ItemStack(material);
            ItemMeta meta = item.getItemMeta().setCustomModelData(model);```
All I want to do is set the custommodeldata of 'item' to 'model'
chrome beacon
#

item meta can be null if material is air

#

set custom model data returns void

chrome beacon
undone yarrow
#

wdym

#

oh

#

But then how do I fix it

chrome beacon
#

You can't assign ItemMeta to void

undone yarrow
#

So I just remove the ItemMeta meta = part?

#
        if (material != null) {
            ItemStack item = new ItemStack(material);
            item.getItemMeta().setCustomModelData(model);```
chrome beacon
#

getItemMeta returns a copy

#

You need to set it back for changes to take effect

undone yarrow
#

yeah but how

#

You just told me it returns void

#

And that I can't set it to that

chrome beacon
#

Yeah

#

so don't

undone yarrow
#

...

chrome beacon
#

I'm intentionally not spoonfeeding the answer here

#

I'll let you think about the problem

shadow night
#

Makes semse

undone yarrow
#

I get why you're not spoonfeeding me, but now you're saying I can't set something to void, so I should set it to void, and then I shouldnt just do anything at all

chrome beacon
#

Pretty much

#

(with that method)

#

just call it

hazy parrot
#

Get copy of item meta -> set model -> set meta back to itemstack

undone yarrow
#

There we go
ItemStack item = new ItemStack(material);
ItemMeta meta = item.getItemMeta();
meta.setCustomModelData(model);
item.setItemMeta(meta);

chrome beacon
#

Yeah like that

shadow night
#

Can we just clap

#

👏

undone yarrow
#

Why does some of my *perfect * code get highlighted?

hazy parrot
#

item will never be null

#

As you make new instance of it

undone yarrow
#

hmm

undone yarrow
hazy parrot
#

Yeah exactly why it's highlited

#

new Itemstack(null) will throw exception

undone yarrow
#

yeah

hazy parrot
#

You have to check parseItem for null, not item

#

If you do Something something = new..., it will never be null

#

Just fyi

undone yarrow
#

Can I do this?
ItemStack item = new ItemStack(Objects.requireNonNull(parseItem(args[3])));

shadow night
#

Wouldn't that still give an exception

undone yarrow
#

I feel like that will just cause more problems

undone yarrow
hazy parrot
#
Material m = parseItem(...)
if (m==null) return false;
Itemstack item = new Itemstack(m);
undone yarrow
#

Yeah I just got that too, but I'm not sure if I can just return false

hazy parrot
#

Well depends of context, but I just refactored your code a little

#

Depends of what u want to do

undone yarrow
#

Well, the function this code is in is in onCommand
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {.... the code Im showing you ....}

#
    public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
       .... code

        switch (args[0]) {
            case "add" -> {
                if (args.length == 4) {
                    // convert args[1] to particle
                    Particle particle = validParticles.contains(args[1].toUpperCase()) ? Particle.valueOf(args[1].toUpperCase()) : Particle.ASH;
                    // convert args[2] to int
                    int cooldown = Integer.parseInt(args[2]);

                    // convert args[3] to List<ItemStack>
                    List<ItemStack> items = new ArrayList<>();
                    String[] itemStrings = args[3].split(",");

                    for (String itemString : itemStrings) {
                        var m = parseItem(args[3]);
                        if(m==null) return false;                   // Can I return false here? -------------
                        ItemStack item = new ItemStack(m); 
                        items.add(item);
                        }

                    ChestObject chest = new ChestObject(false, blockLoc, particle, cooldown, items);
                    pHandler.AddLoc(chest, sender);
                    return true;
                }
                sender.sendMessage(ChatColor.RED + "Incorrect usage! Correct usage: /sc add [PARTICLE] [cooldown] [items].");
                return true;
              }
           .... more code

            }
#

I feel like I should just break instead of return false

#

A break in a for loop just goes to the next argument right?

#

or does the break react to the switch?

orchid trout
#

return true stops the execution, return false does the same thing and sends the usage

#

break executes the code after the switch statement

#

if that makjes sense

#

do what you need

#

ig yeah break reacts to the switch statement

undone yarrow
#

I need to go to the next argument in this for loop, if m == null

                    for (String itemString : itemStrings) {
                        var m = parseItem(args[3]);
                        if(m==null) return false; //????
                        ItemStack item = new ItemStack(m); 
                        items.add(item);
                        }
orchid trout
#

continue;

#

if (m == null) continue;

undone yarrow
#

Ill give it a try, thanks!

#

Now, one tiny last thing, why is setCustomModelData highlighted?

#

I mean, 'model' can't be null

#

and meta also can't be null right? Because the meta is from the material itemstack, which isn't null

glad prawn
#

can

hazy parrot
#

I think meta can only be null on Air or something like that

glossy venture
#

how do i hash a string to a UUID

#

bruh

undone yarrow
worldly ingot
#

Sure but I'd advise a null check in case you parse an item that happens to be air

undone yarrow
#

yeah no that can never happen

#

I'll leave it

worldly ingot
#

You think it can never happen

#

If this is pulling from a config or just some arbitrary string, you can't ever guarantee that it won't happen

#

There's no harm in throwing this in for the sake of being safe:

if (meta == null) {
    return item;
}```
undone yarrow
#

Unless an admin tries fucking with my plugin, aka says one of the player rewards is air, it can never happen

inner mulch
#

Which event is detecing a Player riding on a horse?

wet breach
#

according to the javadocs it is nullable

#

therefore not guaranteed to not be null at some point lol

shadow night
#

It can be null when air, cave air or void air

young knoll
#

Not sure the other air can ever be an ItemStack

#

But yeah

shadow night
#

Iirc any item will get a meta created if it isn't there, besides air. Or some stuff like that

young knoll
#

yes

wet breach
shadow night
#

It will be created

wet breach
#

but that technically means there is a period in where its possible for it to be null right?

undone yarrow
shadow night
wet breach
#

one day I will have some kind of setup where I can just randomly test these kinds of things

undone yarrow
wet breach
shadow night
wet breach
#

HoloAPI relied on a bug in where a horses age was set to negative

#

it made the horse flip upside down and turn invisible but the name tag was left visible

shadow night
#

Lol what

undone yarrow
#

Is there a way to simplify this? I feel like I'm overdoing it

glad prawn
#

lol arrow

shadow night
#

&& me like

wet breach
#

then out of nowhere mojang decided they wanted to patch this in 1.8 and many people got upset. So that is how we got armorstands that could turn invisible so that holograms could continue existing. And now we got Display Entities and Text

undone yarrow
#

Im stupid

#

lol

#

wait no

tall dragon
undone yarrow
#

that doesnt work

tall dragon
#

instead of doing it 3 times possibly more

#

because its more readable?

shadow night
undone yarrow
#

Alright, but it doesnt solve my initial question

wet breach
# shadow night Lol what

now you know where Holograms came from or how it was invented. And it was some person who found the bug randomly messing with minecraft data. Me and 2 other devs just took this and turned it into a plugin

undone yarrow
#

is there a way to compact it?

#

referring to my question

tall dragon
#

exactly what i said

#

lol

#

that is compacting it

undone yarrow
#

by putting it in a seperate method?

#

then you're just moving it

shadow night
#

You don't need 3 times else with the same thing

glad prawn
shadow night
#

Yes

undone yarrow
#

hmm

#

oh

#

I thought something would happen that didnt happen

#

well thanks ig lol

shadow night
#

Can I fuck with cb

wooden hearth
#

I have a question is /mute <add/remove> <player> if add <duration> <reason> or /mute <player> <duration> <reason> and /unmute <player>

wet breach
wooden hearth
glad prawn
#

😭

shadow night
#

Save it to a variable

undone yarrow
wet breach
#

thus removing the whole item.getItemMeta()

#
ItemMeta meta = item.getItemMeta();
if((meta != null) && (meta.hasDisplayName()) && (!meta.hasCustomModelData())) {
    p.sendMessage("You found " + meta.getDisplayName());
} else {
    p.sendMessage(LootMessage[r.nextInt(LootMessages.length)]);
}
shadow night
#

Why are all the things in the if block surrounded by brackets

wet breach
#

to use multiple && or || it is necessary so that java isn't trying to compare them to each other

shadow night
#

Wtf

#

Never put extra brackets, always worked

wet breach
#

idk, I have always done it that way, never had issues. Always had issues when I never did it that way lmao

#

I guess they might have fixed that in java or changed it so maybe now its just preference?

#

not entirely sure

shadow night
#

Weird stuff

#

I'll have to try that stuff later

wet breach
#

lol

#

anyways I think its pretty compact now though

#

my one free spoon until whenever I decide to be kind enough to give another free spoon

shadow night
#

What you could do is turn it all into 2 lines, in theory

glad prawn
#

true && (false && true) || (true && false) xd

wet breach
#

yeah I am not doing lambda's

shadow night
#

p.sendMessage(statement1 && statement2 ? "You found blabla" : LootMessage[...]) this kinda stuff

#

Doesn't look very good, but very compact

wet breach
#

oh right, that ternary operator

#

I forget that exists

shadow night
#

I love those things, they made my life was better when I figured out they were a thing

wet breach
#

lol

glad prawn
shadow night
#

You can always indent

wet breach
glad prawn
#

yes but for me, i won't do it

shadow night
#

I would do that 100%

exotic obsidian
#

guys if i want to save stats on database it's better to save it on hashmap first then transfer to database?

young knoll
#

Yes, having a cache is good

rotund ravine
#

What kind of stats

exotic obsidian
#

like kills, rank name

young knoll
#

Although if the stats don't change super often you can also just send them to the database

rotund ravine
#

What is rankname? Is it based on kills?

exotic obsidian
#

the stats will change on every kill

exotic obsidian
#

i think i have problem here

#

right?

rotund ravine
#

Then why do you save it? Just saving kills should be fine

exotic obsidian
#

ohh

#

wait

#

but i don't want to transfer directly to database

#

first save on hashmap then if player leave from the server transfer to database

#

is that right?

rotund ravine
#

Sure

twin venture
undone yarrow
#

For something like this, should I use a List in a dictionary, or an array in a dictionary, or something completely else?

CUSTOMITEMSDATA{
item : {custommodeldata, displayname, description},
item2 : {custommodeldata, displayname, description},
...
}```
#

I saved all that data somewhere else, and want to know the displayname and description in a different part, where I already know the item and custommodeldata

#

Technically item and item2 can both be white_dye, but have a different custommodeldata.

young knoll
#

Make a holder class that contains all the data for a given entry

#

And use that as the value in your map

undone yarrow
#

Also, Ill be using a seperate file that contains this data, seeing as it's much better for what I'm doing

young knoll
#

A map is the java version of a dictionary

#

A holder class is just a class the holds data in various fields

undone yarrow
#

hmm

wet breach
#

do note I don't advocate the usage of Dictionary as it is obsolete, it was more or less to confirm what Coll is saying is true as it says it right in the Java API Docs 🙂

young knoll
#

Huh

#

Never knew java had that

wet breach
#

there is all kinds of stuff in the API that many people just don't know about

dry hazel
#

I found pushbackinputstream a few days ago, always something to discover

wet breach
#

for those who might want a better way to invoke command line tools

sweet flax
#

?mappings

#

?mappings

undone axleBOT
hollow lagoon
#

and i try that and my server crash agaiin

spare hazel
#

can anyone take a look at this and tell me why im not recieving any message when holding a sword?

rotund ravine
#

?paste

undone axleBOT
spare hazel
rotund ravine
#

They’re a pain in the ass to view on phone

spare hazel
#

just quick

rotund ravine
#

Why are you running it in a try catch

#

Also

#

When are you calling that method

spare hazel
#

when the player joins

#

and each second

rotund ravine
#

Any stacktraces?

spare hazel
#

lemme un-try catch it

#

yes an error releated to deserializing an object

rotund ravine
#

There you go

spare hazel
#

whenever i hold the sword, theres no eerror

rotund ravine
#

That’s good

spare hazel
#

and i didnt get a catch(Exception e){Bukkit.getPlayer(uuid).sendMessage("FUCCKKKK");}

#

but there was no error when deserializing

rotund ravine
#

Seriously the way ur debugging sucks ass

#

Just use sysout or smth

undone yarrow
#

I'm running this every time I need to give an item a previously saved itemmeta. I feel like it's far from optimized though (I wrote it a while ago). The highlighted area shows the file being loaded every time I run this function right? Is there a way to still do the same without having to keep reopening the file, or is this still efficient?

spare hazel
#

heres the updated version

#

oh fuck

undone yarrow
#

might be easier to put that in hastebin

spare hazel
#

?paste

undone axleBOT
spare hazel
#

here

#

just quick

#

please

#

i have homework to do

#

im loosing milions of players

remote swallow
#

ever heard of a for loop

spare hazel
#

cmon

#

help me with my problem

#

cmonnn

#

:((((((((9

#

im going crazy

remote swallow
#

what even is the issue

spare hazel
#

i tried everything

#

it does not modify the stats

remote swallow
#

debug it then

spare hazel
#

i did

remote swallow
#

sysout the value after you modify it

spare hazel
#

i did

remote swallow
#

this is not a sys out after its modified

spare hazel
#

theres no difference

glad prawn
#

System.out.println(...)
Bukkit.getConsoleSender().sendMessage(...)

spare hazel
#

it does not calculate anything

remote swallow
#

sys out the value of getNumber then and see if it returns 0 or not

spare hazel
#

whats a breakpoint?

#

please answer quick

remote swallow
#

allows you to add a pause point to use the debugger

#

pauses the server to see the values of stuff or whats happening where without debug statements

spare hazel
#

let me use it and try again

remote swallow
#

cant use breakpoints if you dont have a debug configuration setup

spare hazel
#

i tried everyting

remote swallow
#

add sysouts then

spare hazel
glad prawn
#

pls pastebin

remote swallow
#

my eyes hurt

spare hazel
remote swallow
#

the code hurts my eyes

spare hazel
pseudo hazel
#

I cant read message.txt

remote swallow
#

here you call get number

spare hazel
#

i know

remote swallow
#

add a System.out.println(getNumber(helmet, NSKeys.ITEM_DAMAGE_KEY)

#

its insanely hard to debug this, will take years to figure out whats happening

spare hazel
#

reference to println is ambiguous

#

whatttttttttttttt

pseudo hazel
#

just write something to console

worldly ingot
#

This is totally unrelated to the issue at hand, but

HypixelSkillCore written by amirparsab90 for the minecraft server iransky
If you're writing software for a server, I would suggest maybe not branding it towards another server 😅

remote swallow
#

wait

#

you should be panicing now that choco is here

worldly ingot
#

Nah I'd have suggested the same as a Hypixel dev or not KEKW

remote swallow
#

would you though

worldly ingot
#

ye