#help-development

1 messages · Page 588 of 1

fluid river
#

I

torn shuttle
#

I'm pretty sure I've read dates in chinese before that I could understand

fluid river
#

there is one which means month/moon

hushed spindle
#

2021.1.3 seems to work slightly better and allows higher language level 👍

fluid river
#

on both chinese and japanese

#

on chinese it's yue

#

i don't know how to write tones in discord

torn shuttle
#

#

right

fluid river
#

yeah

#

this one

torn shuttle
#

yeah same

#

kanji is fun like that

fluid river
#

japanese and china invaded each other like 99 times

#

long ago

#

so they have a lot of similar characters

torn shuttle
#

just yoink what they want, give it their own spin and then add two more alphabets into the mix because things that make sense are for cowards

fluid river
#

the man for example

#

looks like lambda

#

in both languages

torn shuttle
#

I mean sort of like lambda sure

fluid river
#

well, china has just on alphabet

fluid river
#

consists of 2 lines

#

/ and \

torn shuttle
#

japanese and chinese have to change

#

it's ridiculous

#

though tbf chinese does have simplified chinese now

fluid river
#

they have a pinyin tho

#

both of them

torn shuttle
#

yeah and it sucks

fluid river
#

you can write stuff using default letters

#

but with tones

#

i only remember one use of them

#

english me is chinese wo

#

where above o there is a v sign

#

torn shuttle
#

the pinyin sucks

fluid river
#

which means yo go down and then up again

#

pronouncing this word

#

W-lowO-higherO

#

More like a woah

torn shuttle
#

like Chongqing does not sound at all like what it's spelled out to be

fluid river
#

well, chinese doesn't have r

#

that's the only difference ig

torn shuttle
#

there's no r in Chongqing

#

it's still completely off

fluid river
#

i mean they write letter r

#

but it has zh sound

#

for some reason

torn shuttle
#

then just write zh

fluid river
#

yeah true

#

their country is named zhong guo

#

middle state

#

oh i know why

torn shuttle
#

everything about china is mid

fluid river
#

cuz o after zh is pronounced like u

#

dzhoong guo

torn shuttle
#

middle kingdom

fluid river
#

french is Fa guo

#

germany is de guo

#

but hell why the fuck is russia

#

Eluosi

#

why

#

explain

torn shuttle
#

because it has a land border with it

#

this is fairly common

fluid river
#

korea is Han Guo

#

hehe japan is a Ri Ben

#

Sunny something

torn shuttle
#

japanese also breaks the usual nomenclature for the name they have for china

fluid river
#

hello, im eluosi'an

#

russi`an

#

why

barren oak
#

how can i make inventory instance to be associated with block?

#

like metadata

hard socket
#

Where does PlayerMoveEvent get called?

fluid river
#

?

#

PDC ig

fluid river
hard socket
#

what class it gets called in the nms source code

fluid river
fluid river
#

it just works

hard socket
fluid river
#

?stash

undone axleBOT
fluid river
#

?packets

barren oak
fluid river
#

You can store a PDC on a chunk

#

and if player clicks on the block in that chunk

#

check if the block location is stored in the chunk PDC

#

And open the inv

#

Tho it won't store items, just a link to the block

#

Unless you create a saving system

barren oak
#

mmm

#

you know rust?

fluid river
#

no

barren oak
#

okay, then

fluid river
#

you can add 2 entires to pdc

#

one is gonna be location

#

and second itemstack[]

#

and keys to those entries should have some connection

#

so by knowing key to the location you would be able to open associated inventory

barren oak
#

look, i'm trying to do like the chest, but without the actual chest

fluid river
#

?blockpdc

undone axleBOT
fluid river
#

you can also try this

#

it has the same chunk thing under the hood i guess

#

but provides you an easy API to store ItemStack[] in a block data

barren oak
#

ye, thanks for help anyways

fluid river
#

Tho you would need to use Bukkit.createInventory() anyways

#

and fill it with items from data

#

and then save the data back when inventory is closed

barren oak
#

i dont sure if it will work okay for all players who looks into right now

fluid river
#

well, you can make an instance check

spare hazel
#

what is a BarStyle?

fluid river
#

So when first player opens the inv, he gets the first instance

#

And others get the same instance, not a new inventory

barren oak
#

oh i got it

#

ye

fluid river
#

idk if it will work tho

chrome beacon
barren oak
#

oh, no

fluid river
undone axleBOT
chrome beacon
#

For example it can be one solid bar or split in to smaller sections

barren oak
#

i will have many of these blocks

fluid river
barren oak
#

i know servers who already did it perfect

fluid river
#

there will be one inventory instance per block

spare hazel
#

an what is a BarFlag?

barren oak
#

i will look into it, but i think there can be simplier solution

fluid river
#

and all of them would be null unless there would be at least one player currently viewing it

barren oak
#

thanks anyways

vital sandal
#

still in need

fluid river
#

bruh

#

learn to use javadocs

#

these are barflags

vital sandal
fluid river
#

and these are barsyles

fluid river
spare hazel
#

okay thanks

#

is having multiple bukkitRunnables (10+) gonna make the server performance worse? the only thing they do is hide a bossbar from a player

ivory sleet
#

Na not rly

spare hazel
#

i dont have a lot of money around so performance is my number 1 priority

fluid river
#

are there 10 runnables per player

shadow night
#

It's bad if there is like 200 that do stuff every tick

hushed scaffold
#

when using the player.attack() method is it possible to buff the damage of that? like for example doubling its damage? the method uses the players mainhand item to calculate the damage

young knoll
#

Listen for the resulting EntityDamageByEntityEvent

fluid river
#

does it call any event

spare hazel
fluid river
#

if it does, then just check for it

#

and that the damager is the player you are messing with

hard socket
#

@fluid river when I am cancelling the event it teleports me back

#

I dont want it to move at all

#

I guess I need to remove it with packets

eternal oxide
#

packets will still teleport you back

#

due to client prediction

hard socket
eternal oxide
#

probably sending location packets fast

young knoll
#

Wait what are we doing

eternal oxide
#

cancelling every move event is about as good as you can do it, but you may see a TINY movement each time on the client

fluid river
#

you can try setting to to the from

young knoll
#

Set their walk speed to 0

fluid river
#

e.setTo(e.getFrom())

young knoll
#

Also give them negative jump boost

eternal oxide
#

The only way you could improve that (by a few ms) is to spam location updates to teh cloient

fluid river
#

idk what's gonna happen

#

also yeah

#

flyspeed and movespeed to 0

#

but it won't change head rotation mechanics

eternal oxide
#

that would help too

somber scarab
#

?paste

undone axleBOT
spare hazel
#
for (HypixelPlayer player: array) {
                    player.setTrueStats();
                    player.getSkillBossBar().setVisible(true);
                    if(player.getSkillBossBar().getPlayers().size() != 0) {
                        player.getSkillBossBar().removePlayer(getServer().getPlayer(player.getUuid()));
                    }
                }

is this gonna lag the server? its in onEnable()

somber scarab
eternal oxide
#

onEnable will have no players unless it's a reload

chrome beacon
hard socket
#

will try that thx

somber scarab
fluid river
#

you can also try teleporting player to his original location each tick xD

chrome beacon
#

You should know your code?

fluid river
#

with a runnable

spare hazel
# eternal oxide onEnable will have no players unless it's a reload
new BukkitRunnable(){
            @Override
            public void run(){
                ArrayList<HypixelPlayer> array = new ArrayList<>(uuidToPlayerMap.values());
                for (HypixelPlayer player: array) {
                    player.setTrueStats();
                    player.getSkillBossBar().setVisible(true);
                    if(player.getSkillBossBar().getPlayers().size() != 0) {
                        player.getSkillBossBar().removePlayer(getServer().getPlayer(player.getUuid()));
                    }
                }
            }
        }.runTaskTimer(this, 1L, 80L);

full code

somber scarab
#

We're both working on it

dire marsh
#

you didn't shade acf correctly (or at all) it seems like

#

go check their docs

spare hazel
dire marsh
#

noone can answer that

spare hazel
#

why?

dire marsh
#

who knows what setTrueStats does for example

#

doesn't seem very intensive though

astral laurel
#

I need help with the new version of itemsadder

dire marsh
orchid trout
#

how do i format a long like 2.628e+9 to a yyyy/mm/dd/hh/ss format?

spare hazel
#

code:
getServer().getPluginManager().registerEvents(new com.amirparsa.hypixelskillcore.Listeners.PlayerAttack(), this);

error :Cannot resolve symbol 'PlayerAttack'

im 100% sure it exists. why is it telling me that it doesnt exist

eternal oxide
#

DateTimeFormatter with Instant

orchid trout
#

dateformatter gives me a date like 1970

#

it works with hh/mm/ss

#

but when i do yyyy/mm/dd/hh/ss

chrome beacon
undone axleBOT
#

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

orchid trout
#

it gives me 1970

queen niche
#

f

spare hazel
orchid trout
#

ohhh i did simpledateformat

#

nvm

chrome beacon
spare hazel
#

it is

tender shard
#

and is the class public too?

spare hazel
#

even maven doesnt have a problem when building

queen niche
#

anyone knows what im doing wrong?

Error:

16:38:00 [SEVERE] Could not pass event PLAYER_CHAT to MineCraftBetaTest
java.lang.NullPointerException
    at nl.timtendo12.listeners.BetaPlayerListener.onPlayerChat(BetaPlayerListener.java:30)
    at org.bukkit.plugin.java.JavaPluginLoader$6.execute(JavaPluginLoader.java:279)
    at org.bukkit.plugin.RegisteredListener.callEvent(RegisteredListener.java:58)
    at org.bukkit.plugin.SimplePluginManager.callEvent(SimplePluginManager.java:338)
    at net.minecraft.server.NetServerHandler.chat(NetServerHandler.java:706)
    at net.minecraft.server.NetServerHandler.a(NetServerHandler.java:694)
    at net.minecraft.server.Packet3Chat.a(Packet3Chat.java:33)
    at net.minecraft.server.NetworkManager.b(NetworkManager.java:226)
    at net.minecraft.server.NetServerHandler.a(NetServerHandler.java:89)
    at net.minecraft.server.NetworkListenThread.a(SourceFile:105)
    at net.minecraft.server.MinecraftServer.h(MinecraftServer.java:453)
    at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:363)
    at net.minecraft.server.ThreadServerApplication.run(SourceFile:422)

code:
https://hastebin.com/share/fazofololo.typescript

tender shard
tender shard
#

I guess it's settings.getConfigString? If so, "settings" is null

dire marsh
#

if only there was a newer java version that told you the problem

queen niche
tender shard
#

"settings" is null

queen niche
#

I dont understand how Settings is null as I imported it

tender shard
#

show your main class

queen niche
#

1 sec

tender shard
# queen niche 1 sec

btw PlayerChatEvent is deprecated, you should be using AsyncPlayerChatEvent (but that's not the issue right now)

dire marsh
#

i think they're on a very old version...

worn night
#

Does anyone know how to use the blissmp plugin

queen niche
#

here is my main

hazy parrot
spare hazel
worn night
queen niche
chrome beacon
hushed spindle
worn night
#

okay

dire marsh
#

you initialised settings after creating the listener instance

tender shard
#

therefor, getSettings() returns null

queen niche
#

ah I see, Thanks I'll check it out!

tender shard
#

to fix this, move "settings = new BetaSettings(...)" to the top of your onEnable, and then AFTER that, create your BetaPlayerListener object. Or even better, instead of using plugin.getSettings() in the listener, just directly pass the settings object into the listener's constructor

quaint mantle
#

why is that difficult to make a plugin xd

tender shard
sharp bough
hushed spindle
#

i am not

sharp bough
#

maybe thats the issue

#

im not sure

tender shard
quaint mantle
spare hazel
#

is there any good tutorials out there on userdata saving and loading?

spare hazel
#

for java ofc

tender shard
spare hazel
quaint mantle
#

but i already know the basics of that, the thing it to make builder and that staff, no idea

quaint mantle
ivory sleet
#

That’s a named design pattern

#

Just google it and, if you have the basics down, then it ought to be reasonably easy to understand

spare hazel
ivory sleet
#

Yea sure

chrome beacon
ivory sleet
#

I’d try to read about it in effective java also to understand its applications @quaint mantle

chrome beacon
#

How else would you save and read your data

quaint mantle
spare hazel
chrome beacon
#

Then you still have keys

#

no?

spare hazel
#

yes but i thought a key would be just a string

#

idea: save a map in the PDC and only have one namespaceKey

tender shard
undone axleBOT
chrome beacon
#

?morepdc

undone axleBOT
chrome beacon
#

It's probably more work though

quaint mantle
spare hazel
#

so i should add implements ConfigurationSerializable to my HypixelPlayer class and its done

?

tender shard
#

?morepdc

undone axleBOT
spare hazel
tender shard
echo basalt
#

ahh gotta love people tryna recreate hypixel with zero knowledge

tender shard
#

basically, your class must have a method

public Map<String,Object> serialize()

that returns a Map<String,Object> of all your data.

And then there must be a static deserialize method that turns your map back into your object

public static MyClass deserialize(Map<String,Object> serialized)
flint coyote
#

it can also have a constructor that accepts a map

tender shard
#

yeah or a valueOf method

vital sandal
flint coyote
#

I prefer the constructor to keep it as close as possible to normal classes when using it myself

river oracle
echo basalt
#

Don't ask to ask, just ask

vital sandal
#

Still that problem:l

tender shard
# spare hazel i know about morepdc and what should i put in those two methods?

example

public class Person implements ConfigurationSerializable {
    
    private String name;
    private int age;
    
    public Map<String,Object> serialize() {
        Map<String,Object> map = new HashMap<>();
        map.put("name",name);
        map.put("age",age);
        return map;
    }
    
    public static Person deserialize(Map<String,Object> map) {
        Person person = new Person();
        person.name = (String) map.get("name");
        person.age = (int) map.get("age");
        return person;
    }
}
#

be sure to read the javadocs of ConfigurationSerializable

echo basalt
#

ugh 1.12 has no mappings

flint coyote
tender shard
flint coyote
#

because you were so quick with it

tender shard
#

no, that is a COnfigurationSerializable example

spare hazel
tender shard
#

do you guys even know what serialization is?

spare hazel
tender shard
#

I mean the example is pretty self-explanatory

#

because you might wanna store it in json, or yaml, or whatever?

#

or you might wanna turn it into a byte[]using a BukkitObjectOutputStream

echo basalt
#
public class Person implements ConfigurationSerializable {

  private final String name;
  private final int age;

  public Person(String name, int age) {
    this.name = name;
    this.age = age;
  }

  public Person(Map<String, Object> map) {
    this.name = (String) map.get("name");
    this.age = (int) map.get("age");
  }

  public Map<String, Object> serialize() {
    return Map.of(
      "name", name,
      "age", age
    );
  }
}
vital sandal
tender shard
#

where's the difference?

spare hazel
#

yeah o know im making myself look so dumb

tender shard
ivory sleet
#

More like, let’s say you have a complex type which to some extent might be a configurable value in ur config for the server owners, then maybe

vital sandal
echo basalt
#

way too much reflection for such a basic thing

tender shard
#

yeah but there is really no point in telling someone "yo we could do that using reflection" if they haven't understood at all what serialization is in the first place

spare hazel
flint coyote
#

configurationserializable saves you a lot of boilerplate

ivory sleet
#

Yeah, well I prefer configurate either way but bukkit’s api is one way

vital sandal
echo basalt
#

Just deal with it and fuck off, no need to write a fancy system that serializes your object with reflection and only takes 20 seconds to parse

echo basalt
#

Everything in java extends Object

#

But you can just cast back

spare hazel
echo basalt
#

other than primitives, yeah

vital sandal
spare hazel
#

alright leme setup the methods

ivory sleet
#

@spare hazel well when you get to higher ordered types, then you’ll find that Object is just a type in terms of being covariant and contravariant

tender shard
spare hazel
echo basalt
#

That's the constructor

tender shard
#

have you not read the javadocs?

spare hazel
#

i did

ivory sleet
tender shard
#

one of these three things can be the deserializing thing

ivory sleet
#

Use a static deserialize or valueOf if possible

tender shard
#

doesn't matter which one you choose

flint coyote
ivory sleet
#

Because there’s much more freedom if you favor the static factory method

#

For one you can yield an instance that maybe was allocated long before

flint coyote
#

I like the constructor since it feels the most natural when creating the object yourself

tender shard
#

i always use deserialize() because it just makes sense - one method is called "serialize()" so the other is called "deserialize()" lol

ivory sleet
#

If possible decoupling creation and instantiation is almost always nicer to work with long term

spare hazel
#

my brain is exploding leme tale a break

shadow night
flint coyote
ivory sleet
#

Huh?

spare hazel
#

oh the deserialize method takes the map that was created by serializing and then assigns each variable of the class from the map?

ivory sleet
#

Using the constructor directly enforces you to allocate a new instance every time

#

Which is bad

#

Because it couples creation and instantiation

#

Its objectively worse

#

Less flexibility

flint coyote
#

How do you wanna reuse your instance if you only have a map param for the static method?

ivory sleet
#

You might have a repository singleton that you invoke in the function, grabbing a cached object and then just sinking the values from the map

spare hazel
#

...

flint coyote
#

if that's the case then wouldn't constructor DI also be bad?

ivory sleet
#

static deserialize(Map<String,Object> map){
var id = map.get("id");
var transfer = Repository.instance().byId(id);
transfer.name((String)map.get("name"));
return transfer
}

#

As an example

#

Not saying its the best practice

#

But this way if needed, let’s say you work with identity values (not value based in other means)

flint coyote
#

I do get it, yes.
But saying creation and instantiation shall be split apart would mean that constructor DI is a nono

ivory sleet
#

no lol it doesn’t mean that at all

#

instantiation refers to when you explicitly call new

flint coyote
#

what would creation be then

#

well constructor DI does set values during instantiation then

ivory sleet
#

Creation means just creating an object to yield that obeys the contract of whatever function or premise you have

#

the object does not have to be created explicitly on invocation

#

Moreover if you have a static factory method you can also return subclass instances

#

Or null

spare hazel
#

return Map.of(

    );

error : Usage of API documented as @since 9+

ivory sleet
#

(Atho that’s not particularly nice; null)

flint coyote
#

yeah a factory that returns null would be weird

spare hazel
#

looks like im so dumb that people are ignoring me

flint coyote
#

but then again you could always split it. And never have a public constructor. Instead have a static function that creates an instance from the private constructor. I just can't agree with the statement that splitting it whereever possible is better

ivory sleet
#

Factory pattern in general means you decouple instantiation from creation

spare hazel
#

or maybe a bi tch discord employee is messing around with me and preventing my messages to be sent

ivory sleet
#

factory pattern in general is nice because you have more control over the instances you yield, you can return null (altho avoid if possible unless you write against shitty api, but even then adapter pattern maybe?), you have more meaningful names and they can also do more than just initializing the instance you’re going to yield (by that I mean more than “setting values”)

dire marsh
ivory sleet
#

tho only issue is that it does happen that they’re harder to orient around and find

spare hazel
dire marsh
#

check your intellij settings

chrome beacon
tender shard
#

in pom.xml set target and source to 17 in the maven-compiler plugin (or in the properties, if you declared it there)

sterile breach
#

Hello, I would like to know,

I would like to redefine the commands of tabcompletions which are proposed by default when you do tab and you have entered no argument I can't find how to do it

spare hazel
#
<properties>
        <java.version>20</java.version>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    </properties>
#

didnt change anything

ivory sleet
#

And like thing is, if I were to code against some api, I wanna preserve flexibility if possible, which I mean has been proven extremely useful as your project scales, now often when you develop a 5k line spigot plugin that doesn’t matter because you barely get to experience the “scaling”

#

Yeah sure

#

I mean do you wanna see just the factory pattern or static factory method?

tender shard
# sterile breach Hello, I would like to know, I would like to redefine the commands of tabcomple...

create a tabcompleter (can be a separate class, or the same as your COmmandExecutor, or an anonymous class) and return the list of completions.

bad example using an anon class:

        getCommand("myCommand").setTabCompleter(new TabCompleter() {
            @Nullable
            @Override
            public List<String> onTabComplete(@NotNull CommandSender commandSender, @NotNull Command command, @NotNull String s, @NotNull String[] strings) {
                return List.of("option1", "option2");
            }
        });
ivory sleet
#

I prefer static factory methods

#

Unless I have common dependencies that all instances from the class will need

#

Let’s say my class User has the constructor signature User(UUID id, Plugin plugin);

sterile breach
ivory sleet
#

Then I might create a factory with the signature UserFactory(Plugin plugin) just to abstract away the need to pass the plugin instance everytime I create a user

#

UserFactory(Plugin){
User create(UUID){
return new User(id,plugin);
}
}

spare hazel
tender shard
tender shard
ivory sleet
#

Anyway the choice between factory class vs static factory method can be hard, but its like… the factory class is better at abstracting away common dependencies, however it becomes a dependency itself at the cost of it

sterile breach
spare hazel
tender shard
tender shard
spare hazel
#

oh intellij did it for me

ivory sleet
#

These common dependencies can be other classes, a map to pool the instances perhaps, or cached values even

#

Oh yeah looks like they used it pretty inside the box, canonically in other means

#

Yeah

#

But that looks like it could be reduced to a static factory method

#

I would like to say that if possible, go with static factory method, unless you start to compromise design (that is reusability, testability and flexibility) too much

#

yeah

#

If it can fit in a static factory method, neat, you’re bing chilling

astral laurel
# chrome beacon ?ask

with the new version of the plugin, I can no longer add content, it is not recognized

shy forge
#

Best practices for invalid param

astral laurel
#

ok, but you can help me ?

shell robin
#

Which event contains setting an item name

tender shard
#
    // Commands available to all players
    private static final List<String> COMMANDS = List.of("spawn", "tpa", "msg");
    
    // Commands available to OPs
    private static final List<String> OP_COMMANDS = List.of("ban", "kick", "op", "deop");

    @EventHandler
    public void onSendCommandList(PlayerCommandSendEvent event) {
        // Remove all commands
        event.getCommands().clear();
        
        // Only add commands we want the player to see
        event.getCommands().addAll(COMMANDS);
        
        // Add OP commands for OPs
        if(event.getPlayer().isOp()) {
            event.getCommands().addAll(OP_COMMANDS);
        }
    }
sterile breach
#

thanks, PlayerCommandSendEvent is the event (on tab completion request?)

young knoll
#

It's called when the list of commands is synced to the player

#

Which is mostly when they join

sterile breach
#

ah when the tab completion list is send to the player (join)

chrome beacon
#

get the equipment

#

and set the chestplate

chrome beacon
#

ice isn't a chestplate so it won't render

#

Also use the spawn method that takes a consumer

#

You can't

#

it won't render

#

You could use another armor stand and put the ice on the head

#

and then place head at chestplate level

#

or just use a display entity

shadow night
#

can I update a furnace inventory and cooking time while the player is in it or will the player not receive any updates?

#

until he reopens it obviously

chrome beacon
shadow night
#

hmm, okay

frigid rock
#

Why are x and z always the same? java Random random = new Random(); int x = random.nextInt(1000); int y = 150; int z = random.nextInt(1000);

ivory sleet
#

Shouldn’t be the case

frigid rock
#

exactly i don't know why its is returning same numbers each time i generate them

ivory sleet
#

You sure its those values that you end up using?

chrome beacon
#

Show the exact code

ivory sleet
#

^

chrome beacon
#

?paste

undone axleBOT
frigid rock
#

i'm trying to create random locations this is the function: ```java
public Location createRandomLocation(Player p) {

    Random random = new Random();

    int x = random.nextInt(1000);
    int y = 150;
    int z = random.nextInt(1000);

    Location randomLocation = new Location(p.getWorld(), x, y, z);
    y = randomLocation.getWorld().getHighestBlockYAt(randomLocation);
    randomLocation.setY(y);

    while(!isLocationSafe(randomLocation)) {
        randomLocation = createRandomLocation(p);
    }

    return randomLocation;
}```
#

this is the isLocationSafe function: ```java
public boolean isLocationSafe(Location loc) {

    int x = loc.getBlockX();
    int y = loc.getBlockY();
    int z = loc.getBlockZ();

    Block block = loc.getWorld().getBlockAt(x, y, z);
    Block below = loc.getWorld().getBlockAt(x, y - 1, z);
    Block above = loc.getWorld().getBlockAt(x, y + 1, z);

    return (!badBlocks.contains(below.getType()) || block.getType().isSolid() || above.getType().isSolid());
}```
#

(badBlocks contains lava, fire, water materials)

#

this are the coords that are generated, as you can see x and z are the same

fluid river
#

you probably aslo need to check block + 2 tho

eternal oxide
#

show us teh actual code you are using to get that output

fluid river
#

block and 2 blocks above

#

oh i see

#

you teleport to it's floor

frigid rock
#

i will try doing that but idk if it will change smth

fluid river
#

no need for that

spare hazel
#

the random is created once

frigid rock
#

i tried creating 2 randoms

#

still the same

eternal oxide
#

its impossible for random to be returning the same value for both x and z every time

fluid river
#

show the code where you use createRandomLocation method

chrome beacon
spare hazel
chrome beacon
eternal oxide
#

?paste the actual code with the debugs you are using

undone axleBOT
fluid river
#

Isn't it better to use ThreadLocalRandom.current()

#

tho

ivory sleet
#

Depends

#

You lose reproducability with thread local random

fluid river
#

Micro-optimisation

eternal oxide
#

get his code workgin before worrying about that

ivory sleet
#

Hence you often don’t wanna use it

spare hazel
#
public Map<String, Object> serialize(){
        return Map.of(
            "uuid",uuid,
            "skill_woodcutting",woodcutting,
            "skill_mining",mining,
            "skill_farming",farming,
            "skill_combat",combat,
            "stats_heath",health,
            "stats_damage",damage,
            "stats_defense",defense,
            "bossbar_skill",skillBossBar
            );
    }

    public void deserialize(Map<String, Object> m){
        uuid = (UUID) m.get("uuid");
        woodcutting = (Woodcutting) m.get("skill_woodcutting");
        mining = (Mining) m.get("skill_mining");
        farming = (Farming) m.get("skill_farming");
        combat = (Combat) m.get("skill_combat")
        health = (Double) m.get("stats_health");
        damage = (Double) m.get("stats_damage");
        defense = (Double) m.get("stats_defense");
        skillBossBar = (BossBar) m.get("bossbar_skill");
    }

serialization and deserialization methods done. now what?

#

for saving player data

#

on PDC

frigid rock
fluid river
#

what the hell are you codin

chrome beacon
frigid rock
ivory sleet
#

You print X Y X

#

You didnt print X Y Z

frigid rock
#

omg im so dumb bruhhh

spare hazel
frigid rock
chrome beacon
spare hazel
fluid river
#

wha

#

ya know serialization is done by java itself, not by intellij

spare hazel
#

ye

#

but

#

the methods

#

take to long to write

fluid river
#

Object doesn't have serialize() method by default

spare hazel
#

i know

fluid river
#

you need your class to extend Serializable to actually have some methods

spare hazel
#

extend?!

shadow night
#

serializing stuff is such a pain in the ass

fluid river
#

implement

#

mb

spare hazel
#

i thought it was implemenst ConfigurationSerializable

fluid river
eternal oxide
#

it is for Bukkit

ivory sleet
#

It is if you wanna use it with bukkit Configuration api

spare hazel
fluid river
#

alex?

ivory sleet
#

lol what now

spare hazel
#

idk but he wrote the MorePDC article in spigot

ivory sleet
#

That’s mfnalex

#

Dk if he appreciates being called that tho

pseudo hazel
#

I usually use configurationserializable for my plugin data

fluid river
#

imagine everybody call you "gay discord bosster" instead of your nickname every time 💀

hushed scaffold
#

how do i make it so the player has the powdered snow vision effect? like when you walk into powdered snow theres like a icy/snowy effect on your screen. How do i make the player have that ?

eternal oxide
#

Why even bring sex into it. Not teh place for it

frigid rock
#

lol guys chill

hushed scaffold
#

oh ty

#

would that damage the player?

spare hazel
#

he litteraly had the LGBTQ+ flag on his pfp

fluid river
hushed scaffold
#

ok thank youu

shadow night
eternal oxide
ivory sleet
spare hazel
#

anyways

#

?morePDC

#

?morepdc

undone axleBOT
fluid river
#

i'm a brony discord java teacher

#

that's my pronoun

pseudo hazel
#

if you want to serialize your type for config purposes, just use configurationserializable

fluid river
#

you will refer to me by jree fava lessons or by brony discord java teacher

pseudo hazel
#

thats not a pronoun

#

thats a whole ass title

fluid river
#

true

pseudo hazel
#

oh to pdc

#

i didnt read again 💀

fluid river
#

you will refer to me only by my title

tender shard
fluid river
#

you have brown hair i'm sure

eternal oxide
#

only my ass hair is dyed blue

fluid river
#

at least you had

spare hazel
#

news:i have no idea how to load userdata when the player joins the server and save when the player leaves the server

#

using MorePDC

tender shard
fluid river
#

bruh you were older on your previous pfp

fluid river
echo basalt
#

no1 certified crackhead

hasty prawn
#

PFP is pink and IRL is blue idk what to believe anymore

tender shard
# spare hazel using MorePDC
PersistentDataType<?, YourSeriazableClass> dataType = new ConfigurationSerializableDataType<>(YourSerializableClass.class);
tender shard
fluid river
hasty prawn
#

You should open it in Paint and fill tool it to blue KEKW

shadow night
tender shard
#

epic's underwear

fluid river
#

java versions

shadow night
#

nice answers

fluid river
#

it's 50% mean, 50% omg i can't stop laughing

tender shard
#

i dont know how often epic changes his underwear but I know him for a year or so now and he never mentioned that he changed underwear during that whole time

#

sooo

#

figure it out yourself

shadow night
#

._.

fluid river
#

professional photoshoper(i used paint fill tool)

spare hazel
#
if(HypixelSkillCore.getInstance().getPlayer(e.getPlayer().getUniqueId()) == null){
            HypixelSkillCore.getInstance().createPlayer(e.getPlayer().getUniqueId());
            e.getPlayer().sendMessage(ChatColor.GREEN + "Welcome To servername! Your SkyblockSkills Account Has Been Created");
        }else{
            //TODO : god please help me
        }
fluid river
#

i changed my underwear

#

so everybody know

shadow night
echo basalt
#

Yeah I don't think that's how hypixel did it

fluid river
#
> God: ?learnj...```
tender shard
#
UUID playerUuid = event.getPlayer().getUniqueId();
MyPlayer player = myPlugin.getPlayer(playerUuid);
if(myPlayer == null) {
  player = myPlugin.createPlayer(playerUuid);
} else {
  // Already have a MyPlayer object
}
echo basalt
#

playerId**

#

looks cleaner

spare hazel
shadow night
#

what event is fired when somebody puts something in a slot of an inventory?

echo basalt
#

But honestly there could be a getOrCreatePlayer because it isn't the listener's responsibility to do it

frigid rock
#

does anybody know how to remove the little white stripe in the chat when sending a message?

fluid river
spare hazel
fluid river
#

so you know for sure

shadow night
fluid river
shadow night
#

I've not closed my IDE and not open minecraft in two days

fluid river
#

which stripe

frigid rock
#

wait

fluid river
#

am i dumb or smth

frigid rock
#

the lil stripe before the second message

fluid river
#

isn't that cuz of new chat event

frigid rock
#

yeah i think so but idk how to remove t, and if it is possible to

spare hazel
fluid river
#

i was joking tho

#

called your plugin LoTriangle

echo basalt
#

yeah more than a year lmao

fluid river
#

like the negative HyPixel

spare hazel
shadow night
#

hypixel is literally one of the biggest servers online right now

spare hazel
fluid river
#

Cuz you are coding for the 3d day

spare hazel
fluid river
#

shit it's not funny after you explain 😭

shadow night
fluid river
#

bad side of jokes

spare hazel
shadow night
#

the is a difference between a server and a server network, right?

undone axleBOT
spare hazel
#

lemme just check what is a namespacekey

shadow night
#

ohhh, that's the website I've had open for the past two years, right?

#

next to some forum post

fluid river
#

nobody closes it

#

i do, cuz i code from memory and compile in my head

#

But it doesn't count

quaint mantle
#
Bukkit.broadcastMessage(hologramText.joinToString("\n"))
        val entity = TextDisplay(EntityType.TEXT_DISPLAY, (location.world as CraftWorld).handle).apply {
            text = CraftChatMessage.fromStringOrNull(hologramText.joinToString("\n"))
            this.billboardConstraints = Display.BillboardConstraints.CENTER
            this.backgroundColor = 0
        }

Is there a reason it doesn't display on the hologram?

flint coyote
#

Anyone got an idea how to let a player interact with entities while there's another one on the head of the player (passenger)?
I just keep clicking the passenger. I tried setting a dummy passenger that is hidden by hideEntity but then when setting a passenger to this dummy entity, you don't get an update

quaint mantle
shadow night
#

in furnaces, the arrow that shows the progress, is that a float from 0 to 1 or does it work in some different way?

fluid river
#

probably a float

chrome beacon
#

Do you still need help with this?

shadow night
#

hmm, BurnTime is the fuel burning time and the cook time is the arrow, right?

fluid river
#

no info on javadocs?

shadow night
#

thank god it's not some game, if it was I would probably be playing WoT or something the last 30 hours instead of trying to think

spare hazel
#

so where should i create the namespaced key and what should i do for loading the playerdata using the namespacedkey that i created

sterile breach
#

Hello, questions

getConfig()

and related functions only work for config.yml

if I want to recover the info of a config2.yml file how to do?

eternal oxide
#

?configs

undone axleBOT
spare hazel
#

?pdc

fluid river
#

copy contents of saveDefaultConfig(), saveConfig(), reloadConfig() and getConfig()

#

paste it to your project

eternal oxide
shadow night
#

why did I decide that it's a good idea to try coding this random bs

fluid river
#

and inside them use "config2.yml"

#

instead of "config.yml"

smoky anchor
#

Hi hello everyone.
I have seen some people mention that you should never store a bukkit Entity object, but should instead use UUID?
Say, I have a custom block that uses an entity for displaying stuff (let's say text for example)
And I want this text to be updated every tick.
I believe it would be less performant to get the entity by uuid every tick than just storing the entity directly.
I'd like to know:
What are the reasons to not store the entity object ?
Are there any better ways other than UUID ?

vivid cave
fluid river
#

and you'd better get it everytime

ivory sleet
#

Never is the wrong word

spare hazel
#

if i use this code in main class and player join class, will they both be the same?
NamespacedKey key = new NamespacedKey(pluginInstance, "our-custom-key");
im using it for PDC

ivory sleet
#

Most of the times is a better word (or term)

shadow night
vivid cave
#

Conclube weren't you Conclure in the past 🤣

fluid river
#

he was

vivid cave
#

nice

spare hazel
#

alright thanks

shadow night
smoky anchor
shadow night
#

chill

#

it was just a joke

fluid river
#

he means that entity is mutable and so on

#

can die or get unloaded

ivory sleet
#

Steve you usually have 2 options

#

UUID, or WeakReference<Entity>

smoky anchor
#

Anyways I have seen someone mention some WeakReference or whatever.
Would that solve the possible memory leak.

smoky anchor
ivory sleet
#

Yes

#

I mean up to you really

smoky anchor
#

Alright, I shall now learn what the frick WeakReference is and how to use it correctly.
Thank you.

hazy parrot
#

It just doesn't keep reference to object, so it can be collected by gc If spigot invalidate it

ivory sleet
#

^

smoky anchor
#

I suppose I have to check if the object is not invalidated so I can work with it ?
Does it use optional or something ?

ivory sleet
#

Na not really

vivid cave
ivory sleet
#

Just that this class is specially treated

#

Do you know what a strong reference is to begin with?

vivid cave
#

not sure no

ivory sleet
#

class A {
Object x = new Object()
}

#

x is a strong reference by definition

#

Meaning, x prevents its value from being garbage collectable

#

class B {
WeakReference<Object> y = new WeakReference<>(new Object());
}

#

y is a weak reference by definition

#

Meaning, y does not prevent its value from being garbage collectable

glossy venture
#

in his bio

dire marsh
#

it's just rgb

#

they're updating the scoreboard title

#

it's an rgb gradient though

echo basalt
#

ugh

#

It's a gradient made of multiple parts

#

Basically interpolation

#

Think of it as just making a big gradient of white -> orange -> white that's larger than the text

dire marsh
#

adventure has TextColor.lerp, otherwise idk

echo basalt
#

basically think of how a camera works in a game like super mario

spare hazel
#

setting up ConfiguratinSerializable done. how do i save the class that i use for custom player data onto PDC using DataType.CONFIGURATION_SERIALIZABLE from MorePDC

#

@tender shard

#

nvm how do i use .yml files to do that :(((((((((((((((((((((((((((( i want it so it loads all the players on server start and then save all of them on server stop

tender shard
#
PersistentDataType<?, MyClass> type = new ConfigurationSeriazableDataType<>(MyClass.class);

// ...

somePdc.set(someKey, type, myObject);
spare hazel
#

but i already added morepdc as a depend so

tender shard
#

loading all players on startup is a bad idea if you have a large number of of players btw

#

I'd rather use the PDC or have one file per player or use a database like mysql and only load player data when they join

spare hazel
tender shard
#

? means "can be anything"

spare hazel
#

okay

#

and what should i replace myclass with?

tender shard
#

PersistentDataType<P,C> where P refers to the primitive type (what it actually gets saved as) and C is the complex type, your class

#

you don't care about the primitive type so you can use ?

#

for configurationserializable, it'll be byte[] btw

#

because it uses a BukkitObjectOutputStream

spare hazel
#

yes i totally understad what a BukkitObjectOutputStream is

tender shard
#

you mean to make text gradients?

#

hm idk, never did that. probably just some math to shift the colors somehow, idk lol

tender shard
spare hazel
#

Cannot resolve symbol 'ConfigurationSeriazableDataType'

tender shard
spare hazel
#

oh got it

tender shard
spare hazel
#

Diamond operator is not applicable for non-parameterized types

tender shard
#

show your code

spare hazel
#

ializable<>(HypixelPlayer error is occured here

tender shard
#

it definitely is a parameterized type

#

``java

#
ConfigurationSeriazableDataType<HypixelPlayer> type = new ConfigurationSeriazableDataType<>(HypixelPlayer.class);
#

Serializable*

#

i hate this word

cinder abyss
#

Hello, did anyone made a EntityMoveEvent ?

tender shard
cinder abyss
spare hazel
#

Cannot resolve symbol 'ConfigurationSerializableDataType'

tender shard
# cinder abyss splash particles when entering in water/lava

you could keep a Set<UUID> with all players. Loop over all entities every tick. if they are in water but are not in the set, they just entered water. Add them to the set.

If they are not in water but are in the set, they just left water. remove them from the set

tender shard
spare hazel
#

<dependency>
<groupId>com.jeff_media</groupId>
<artifactId>MorePersistentDataTypes</artifactId>
<version>2.3.1</version>
<scope>compile</scope>
</dependency>

tender shard
#

did you reload maven after adding it?

spare hazel
#

wdym?

spare hazel
#

done

#

oh why didnt you tell me earlier

#

i abandoned learning worldguard api bcz of that

tender shard
#

it's definitely included in MorePersistentDataTypes 2.3.1

spare hazel
#

its fixed

tender shard
#

yeah but old URL redirects to the new one

spare hazel
#

now when the player joins and he doesnt have a account, we save it in his PDC

tender shard
#

even the old old link redirects lol

#

oh yeah maybe it only works for downloads, not uploads, i dont know

#

uploading is http PUT request iirc

spare hazel
#

e.getPlayer().getPersistentDataContainer().set(new NamespacedKey(HypixelSkillCore.getInstance(), e.getPlayer().getUniqueId().toString()), HypixelSkillCore.getInstance().getType(), HypixelSkillCore.getInstance().getPlayer(e.getPlayer().getUniqueId()));

#

too long

#

what should i do then

#

can i NOT save it in a variable and just use new NamespacedKey()

#

okay ill do that

smoky anchor
#

Hi hello, I do not believe I know the way to spawn entity with passengers.
Is it even possible in this way ?
Or do I have to spawn all the entities first and then set them as a passengers of the root.

spare hazel
#

private NamespacedKey key = new NamespacedKey(plugin, "key");

#

like this?

#

and create a getter?

#

player.getPersistentDataContainer().set(plugin.getKey() , plugin.getType(), plugin.getPlayer(player.getUniqueId()));
much better

#

and when i use getPersistantDa...().get() it will give me the HypixelPlayer class that i saved using morepdc?

#

i already made the method

#

public void deserialize(Map<String, Object> m){
uuid = (UUID) m.get("uuid");
woodcutting = (Woodcutting) m.get("skill_woodcutting");
mining = (Mining) m.get("skill_mining");
farming = (Farming) m.get("skill_farming");
combat = (Combat) m.get("skill_combat");
health = (Double) m.get("stats_health");
damage = (Double) m.get("stats_damage");
defense = (Double) m.get("stats_defense");
skillBossBar = (BossBar) m.get("bossbar_skill");
}

and yes i made all the other classes serializable

smoky anchor
#

Yes, but I wasn't sure if I can do this from within the lambda thingie
Which I just tested and I can
Kinda surprised tho

terse bough
spare hazel
#

private ConfigurationSerializableDataType<HypixelPlayer> type = new ConfigurationSerializableDataType<>(HypixelPlayer.class);

tender shard
#

i thought you wanted to do an "animation" out of that?

#

non-moving gradients are easy

chrome beacon
#

Yeah interpolation is what you want uwu

#

You give it a value from 0 to 1

#

and it will move

drowsy pawn
#

hello can help with on 1.19.4
((CraftWorld)b.getWorld()).getHandle().playBlockAction(new BlockPosition(b.getX(), b.getY(), b.getZ()), CraftMagicNumbers.getBlock(b), 1, this.open ? 0 : 1);

undone axleBOT
#

"Does not working" is a useless statement. Please describe what exactly is not working, what you expect it to do, and what actually happens. If you get any console errors, also ?paste the entire stacktrace.

chrome beacon
#

No

#

Mojang still uses strings for scoreboard names iirc

brazen violet
#

is there an event for a firstjoin?

#

spigot / paper

#

thanks

chrome beacon
#

Well why would it move?

#

It's a chat message

young knoll
#

yes

drowsy pawn
buoyant viper
#

yes

drowsy pawn
chrome beacon
#

?notworking

undone axleBOT
#

"Does not working" is a useless statement. Please describe what exactly is not working, what you expect it to do, and what actually happens. If you get any console errors, also ?paste the entire stacktrace.

chrome beacon
#

Read it

#

Well are you updating it

#

Why would it move by itself

tender shard
#

you have to update it with an "offset" gradient every tick

chrome beacon
#

You gotta make it move ^^

rain patio
#

So I've been following this old Kody Simpson tutorial for JSON file storage: https://www.youtube.com/watch?v=CXQJA0VvFEY

I've copied the way the delete menu from this transfers the note ID to the confirm menu using a PlayerMenuUtility (PMU) and it works for the delete menu on my side, but for some reason in the other class that I'm using this method for, it doesn't transfer and gives me a null error when I'm trying to retrieve a variable from it

I'll post the classes in paste links
https://paste.md-5.net/noyecosoba.java -Event Teleport Confirmation
https://paste.md-5.net/ziziqakoce.java - Event List, (tries) to transfer the event id from the item to the PMU
https://paste.md-5.net/arutaviwel.java - the extended PMU
https://paste.md-5.net/camarixavi.java - Event class itself

https://paste.md-5.net/luvugesuja.java - Confirm Delete menu that I'm trying to mimic

https://paste.md-5.net/itoliqihow.java - Delete Menu that I am also mimicking

Any help is appreciated

In this episode, I show you how to store Java Objects and data from your plugin as JSON Text in a .json file and load/save from that file. I give you an example of a fully coded CRUD class to do basic operations with the data. #SpigotDevelopment #PluginDevelopment #Minecraft

Code: https://github.com/Spigot-Plugin-Development-Tutorial/json-file...

▶ Play video
tender shard
#

usually you want to have one color per char, e.g. colors A, B, C, D, C, B, A
next tick, you use
B, C, D, C, B, A, B
then
C, D, C, B, A, B, C
etc

chrome beacon
#

Now that error tells you what's null

#

So go to that method and take a look

#

Why would it be null

tender shard
#

yeah for example I'd do it like this for two colors:
startColor = 0,0,0 // r,g,b
midColor = 10,10,10 // the "middle color"
endColor = startColor
then all "inbetween" colors are just midColor - startColor / numOfChars / 2 * currentOffset (or sth similar)
then you get an array of colors, e.g. for 5 chars you'd have sth like 0,0,0; 5,5,5; 10,10,10; 5,5,5; 0,0,0
and then you "move that" around by one each tick

rain patio
#

ik it's the find event error is null, I think the eventID string is null but I don't understand why it's null because I'm using the same process the transfer the ID as the other class that does the exact same process and that one actually works

chrome beacon
rain patio
#

my fault

tender shard
#

I have a method to calculate the correct color for each with a 2-color gradient, you'd need to expand that to three colors, then apply the offset each tick. let's see if I can find it

chrome beacon
rain patio
#

I honestly might, I've no clue if I do or not

tender shard
#

maybe I can write a complete method later but first I'll visit the bathtub lol

chrome beacon
#

Time to check

rain patio
#

I don't believe I've made any EventsManager objects, and I've not instantiated it in my main class, which honestly might be a problem

#

I'm using that guys API and was very closely following the tutorial

tender shard
#

alrighty I'll do my best later today lol

#

can't promise that I can do it

remote swallow
#

coulndt you check how TAB does it

#

yeah, but it has an already established format and working stuf

quaint mantle
#

How can I may do a tpask command, I don't know how to create a max time to accept the request. Don't give the code just the steps or idea. I'm new and just want to learn not having all done.

remote swallow
#

just steal the code

chrome beacon
spare hazel
#

?paste

undone axleBOT
quaint mantle
spare hazel
#

Could not load 'plugins\HypixelSkillCore-1.0.jar' in folder 'plugins'
org.bukkit.plugin.InvalidPluginException: java.lang.IllegalArgumentException: Plugin cannot be null
at org.bukkit.plugin.java.JavaPluginLoader.loadPlugin(JavaPluginLoader.java:149) ~[server.jar:3284a-Spigot-3892929-0ab8487]
at org.bukkit.plugin.SimplePluginManager.loadPlugin(SimplePluginManager.java:394) ~[server.jar:3284a-Spigot-3892929-0ab8487]
at org.bukkit.plugin.SimplePluginManager.loadPlugins(SimplePluginManager.java:301) ~[server.jar:3284a-Spigot-3892929-0ab8487]
at org.bukkit.craftbukkit.v1_17_R1.CraftServer.loadPlugins(CraftServer.java:409) ~[server.jar:3284a-Spigot-3892929-0ab8487]
at net.minecraft.server.dedicated.DedicatedServer.init(DedicatedServer.java:233) ~[server.jar:3284a-Spigot-3892929-0ab8487]
at net.minecraft.server.MinecraftServer.x(MinecraftServer.java:1010) ~[server.jar:3284a-Spigot-3892929-0ab8487]
at net.minecraft.server.MinecraftServer.lambda$0(MinecraftServer.java:305) ~[server.jar:3284a-Spigot-3892929-0ab8487]
at java.lang.Thread.run(Thread.java:831) [?:?]
Caused by: java.lang.IllegalArgumentException: Plugin cannot be null
at com.google.common.base.Preconditions.checkArgument(Preconditions.java:122) ~[server.jar:3284a-Spigot-3892929-0ab8487]
at org.bukkit.NamespacedKey.<init>(NamespacedKey.java:72) ~[server.jar:3284a-Spigot-3892929-0ab8487]
at com.amirparsa.hypixelskillcore.HypixelSkillCore.<init>(HypixelSkillCore.java:24) ~[?:?]
at jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) ~[?:?]
at jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:78) ~[?:?]
at jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) ~[?:?]
at java.lang.reflect.Constructor.newInstanceWithCaller(Constructor.java:499) ~[?:?]

#

can anyone tell whats the problem?

eternal oxide
#

Who knows how meteor client manages to list plugins when all bukkit commands are blocked?

chrome beacon
eternal oxide
chrome beacon
#

server.properties

spare hazel
#

why could that be

#

oh i just found out the problemmm

eternal oxide
spare hazel
#

i set the namespacekey value outside onEnable

#

im dumb

#

lemme fix that'

chrome beacon
#

Also this

query-plugins: true

#

in bukkit.yml ^^

spare hazel
#

web discord is wayyyyy better than windows discord. it uses way less ram

chrome beacon
#

Yeah

spare hazel
#

oh nvm

#

500MB of ram

chrome beacon
#

Yeah I've had app discord take 3GB

spare hazel
#

discord app = 300

eternal oxide
spare hazel
#

Not storage

#

Memory

chrome beacon
#

I know

spare hazel
#

I have 6gb memory

#

2gb used by windows

chrome beacon
#

My discord took 3GB ram

spare hazel
#

4 gb to work with

#

and if i run my server and my minecraft client both at 2gb, i just turned my pc into a smoker. very nice lifehack

#

but i run my server at 1gb

#

and client at 1.5 gb

#

lemme go ahead and fix my plugin

zenith gate
#

I know this is very basic java, but like I need someone to tell me. something weird going on and I hope im jsut doing it wrong.

Is this how you do a hashmap?

public HashMap<UUID, Integer> mana = new HashMap<>();

mana.put(player.getUniqueId(), mana);
//.  ^^^ This doesn't exist apparently. Which is what I think you use to add data into a hashmap.
eternal oxide
zenith gate
#

ohh

#

Still the same thing....

tender shard
#

you cannot just call methods outside of a code block

zenith gate
#

im just an idiot im sorry guys lol. I had another variable called mana for some reason.

tender shard
#

oh ok

zenith gate
#

I was really confused why it wasnt working. i stared at it for 5 minutes.

#

and google.

#

if onyl google told me 😢

spare hazel
#

i can give the code

ocean hollow
#

how can I convert "Jeb, Hero, Amogus" to List<String> with "Jeb", "Hero", "Amogus"?

spare hazel
#

if you are wondering what this site is its a log tool provided by aternos, the sponser of spigot(i think)

spare hazel
#

plz

ocean hollow
#

oh, ok

young dome
#

Would you know how to transpose the contents of one .yml file into another while retaining the UTF-8 encoding? I've tried many things but nothing seems to work. It seems that the IDE displays everything in UTF-8 except when calling the YamlConfiguration#saveToString method. However, I load the content with the UTF-8 Charset

spare hazel
#

@tender shard

ocean hollow
#

what will be the list if string = ""?

spare hazel
#

oh got it

#

nvm noo ned to help

#

'setMaxHealth(double)' is deprecated
what should i do about this warning

young knoll
#

Use the new method

#

Aka attributes

spare hazel
#

how?

#

but will it work even though its deprecated?

young knoll
#

Iirc getAttribute(Attribute.max health thing).setBaseValue

ocean hollow
#

thanks, how can i do the opposite? List in one line

chrome beacon
#

but yes it will work

spare hazel
#

what will happen if i keep using it?

chrome beacon
#

Don't

#

Just use attributes

spare hazel
#

are deprecations there to make a developer's life harder?

chrome beacon
#

No

young knoll
#

Lol

remote swallow
#

they're there to say "dont use me"

young knoll
#

They are there because that used to be the method to use

remote swallow
#

or avoid it

young knoll
#

But now there is something new that replaces it

spare hazel
#

whats the difference between the deprecated method and the new way?

chrome beacon
#

One is old and shouldn't be used

#

The other is the new way to do it

ivory sleet
#

Deprecation is there to either tell developers that this method is gonna be, or can be removed in the future, alternatively if the choice of method needs an extra consideration, which can be due to unsafe results or byproducts.

spare hazel
#

anyways let me test my plugin
i hope theres no errors this time

chrome beacon
#

Mojang uses deprecation notes for methods that shouldn't be called

ivory sleet
#

Yea

#

Even Java std lib sometimes I believe

young knoll
#

Is there not a different annotation for that

ivory sleet
#

Maybe yeah

chrome beacon
#

There is

young knoll
#

Smh we need STANDARDS

chrome beacon
#

api internal or whatever

ivory sleet
#

Thats jetbrains

chrome beacon
#

Yeah

#

I know

pseudo hazel
#

basically if there is a new way, dont use the deprecated version xD

#

and if there isnt, sometimes you might have no choice

young knoll
#

I wonder why java does include any of these annotations in the standard lib

#

Not like they would increase the file size by much

rain patio
tender shard
ivory sleet
#

I think they want annotations that are more significant coll

#

Like Override, FunctionalInterface etc

#

Not sure tho

quaint mantle
#

how do i check if this extends my custom class?

for (ClassPath.ClassInfo classInfo : classInfoList) {
#

cus

if(classInfo instanceof MyClass)

doesnt work

zenith gate
#

Will there be multiple hashmaps if multiple plugins access my library? meaning if 2 plugins in the same server are accessing the mana class and minipulating it. Will they be editing their own hashmap or will it just be 1 universal hashmap?

young dome
quaint mantle
pseudo hazel
#

where did you get a list of class info from

young dome
quaint mantle
#
public static List<ClassPath.ClassInfo> classesFromPackage(final String path) {
        final List<ClassPath.ClassInfo> toReturn = new ArrayList<>();
        try {
            for(final ClassPath.ClassInfo classInfo : ClassPath.from(TestPlugin.plugin.getClass().getClassLoader()).getTopLevelClassesRecursive(path)) {
                if(classInfo==null)continue;
                try {
                    toReturn.add(classInfo);
                } catch (Exception e) {
                    e.printStackTrace();
                }
            }
        } catch (IOException e) {
            throw new RuntimeException(e);
        }

        return toReturn;
    }
spare hazel
# tender shard hm?

Cannot invoke "Object.getClass()" because the return value of "org.bukkit.configuration.serialization.ConfigurationSerialization.deserializeObject(java.util.Map)" is null
at org.bukkit.util.io.BukkitObjectInputStream.resolveObject(BukkitObjectInputStream.java:49) ~[server.jar:3284a-Spigot-3892929-0ab8487]
at java.io.ObjectInputStream.checkResolve(ObjectInputStream.java:1740) ~[?:?]
at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1689) ~[?:?]
at java.io.ObjectInputStream.readArray(ObjectInputStream.java:2112) ~[?:?]
at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1677) ~[?:?]
at java.io.ObjectInputStream$FieldValues.<init>(ObjectInputStream.java:2554) ~[?:?]
at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:2412) ~[?:?]
at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:2212) ~[?:?]
at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1689) ~[?:?]
at java.io.ObjectInputStream$FieldValues.<init>(ObjectInputStream.java:2554) ~[?:?]
at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:2412) ~[?:?]
at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:2212) ~[?:?]
at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1689) ~[?:?]
at java.io.ObjectInputStream.readObject(ObjectInputStream.java:495) ~[?:?]
at java.io.ObjectInputStream.readObject(ObjectInputStream.java:453) ~[?:?]
at com.jeff_media.morepersistentdatatypes.datatypes.serializable.ConfigurationSerializableDataType.fromPrimitive(ConfigurationSerializableDataType.java:60) ~[?:?]
at com.jeff_media.morepersistentdatatypes.datatypes.serializable.ConfigurationSerializableDataType.fromPrimitive(ConfigurationSerializableDataType.java:26) ~[?:?]
at org.bukkit.craftbukkit.v1_17_R1.persistence.CraftPersistentDataContainer.get(Cr

had to remove bcz discord limit

quaint mantle
#

?paste

undone axleBOT
quaint mantle
#

please

spare hazel
#

now its totally your problem

spare hazel
quaint mantle
#

basically every class inside a package

young dome
#

They're not linked

quaint mantle
#

yea they arent

spare hazel
pseudo hazel
#

for what unholy purpose do you need a list of class info

#

I mean

#

idk how to sovle your issue directly

#

im just curious

quaint mantle
#

automatically registering stuff like, commands, items, other things

#

for commands i use

 for (ClassPath.ClassInfo classInfo : classInfoList) {
            Object t = classInfo.load().getConstructors()[0].newInstance();
            if(t instanceof CommandExecutor) {
#

but it gives me an error when i do that with the ability class

young dome
#

You have better way to do that but if you want to do this like that, get java.lang.Class with Class#forName, you will find the path into the ClassInfo object and next you can check if the class extends from your class.

spare hazel
# spare hazel can someone tell me what is the problem (someone who used morepdc)
public void onPlayerJoin(PlayerJoinEvent e){
        HypixelSkillCore plugin = HypixelSkillCore.getInstance();
        Player player = e.getPlayer();
        if(player.getPersistentDataContainer().get(plugin.getKey(), plugin.getType()) != null){
            if(plugin.getPlayer(player.getUniqueId()) != null) return;
            plugin.setPlayer(player.getUniqueId(), player.getPersistentDataContainer().get(plugin.getKey(), plugin.getType()));
        }
        if(plugin.getPlayer(player.getUniqueId()) == null){
            plugin.createPlayer(player.getUniqueId());
            player.getPersistentDataContainer().set(plugin.getKey() , plugin.getType(), plugin.getPlayer(player.getUniqueId()));
            player.sendMessage(ChatColor.GREEN + "Welcome To IranSky! Your SkyblockSkills Account Has Been Created");
        }
    }

my PlayerJoinEvent class

quaint mantle
quiet ice
#

I guess you could do classInfo.load().isAssignableFrom(MyClass.class) if you are not afraid of loading classes early

tender shard
young dome