#help-development

1 messages ยท Page 1628 of 1

unkempt ore
#

I see

echo basalt
#

is this what you wanted

quaint mantle
#

Ok thank

#

good boy

echo basalt
#

I'm no dog here

tame coral
#

no you're Illusion

echo basalt
#

;)

unkempt ore
#

Cringe.

echo basalt
#

yeah

unkempt ore
#

Yeah like, I know very well how clients and servers communicate

#

But not relating to Minecraft, and I've been scared to try it

#

Just like I haven't wanted to try NMS. Is NMS mapped well?

echo basalt
#

Not really

unkempt ore
#

Shoot

echo basalt
#

ProtocolLib is a fancy wrapper for NMS packet stuff

#

I see NMS as just like

#

Decompile

#

and see what does what

unkempt ore
#

Is there a lot of obfuscated shit?

echo basalt
#

everything

unkempt ore
#

What the hell

#

I thought it'd be mapped

#

Like Forge

echo basalt
#

It's mapped

#

But like

#

not really

#

kinda

unkempt ore
#

Man

echo basalt
#

Just use that maven / gradle plugin that md_5 made

#

that kinda remaps the jars

#

and the code

unkempt ore
#

"Oh, an arrow's velocity? Sure man it's just f_17239182776482631_"

echo basalt
#

Nah

#

it's always like

#

a

#

b

#

c

unkempt ore
#

BRUH

echo basalt
#

and some very specific numbers

unkempt ore
#

Yeah I'd imagine there's magic numbers all over the place

echo basalt
#

for no reason

unkempt ore
#

There must be some

echo basalt
#

Also the most common NMS things are documented

unkempt ore
#

You know the quake fast inverse square?

echo basalt
#

Yeah I've seen it

unkempt ore
#

Magic number

echo basalt
#

It's some floating point hack

unkempt ore
#

Yeah it's very well done

proud basin
#

bump

unkempt ore
#

The magic number is there to make sure the error margin is only 1%

#

Ever since I saw it, I've respected magic numbers a bit more

echo basalt
#

Plugins use invisible armorstands / entities to add multiple lines

#

Unless you're talking about entity metadata packets where each player sees a different name

#

Not sure what you're trying to do here

unkempt ore
#

"Society if NMS was mapped as well as Forge"

echo basalt
#

pretty sure forge is just some nms refactoring without the lawsuits

#

problem with NMS is intellectual property

unkempt ore
#

What lawsuits could there even be?

echo basalt
#

DMCA

unkempt ore
#

It's custom deobfuscation

echo basalt
#

Custom deobf ehh

#

If it matches enough

unkempt ore
#

You're joking, right?

#

"It just happens to be similar enough to our real code"

#

Like come on man

echo basalt
#

They're already sharing the real code

#

the naming is the only difference

unkempt ore
#

Oh, for real?

echo basalt
#

It comes to a point where you can't tell if it's original with some slight name changes or if it's the distributed one with custom deobf

#

The code is not seriously obfuscated, all of the fields and methods are just renamed to a single letter

#

It's like the most basic proguard obfuscation

unkempt ore
#

Yeah, like, just making sure the names of stuff isn't a bunch of numbers

#

But not "real" deobf

echo basalt
#

it's never a bunch of numbers

unkempt ore
#

Isn't it?

echo basalt
#

it's always just a, b

#

a single letter

#

Except the bukkit / spigot / whatever patches have nice names too

unkempt ore
#

I feel like I remember functions in Forge that weren't mapped named something like...fuckin f_18938_ or something

proud basin
#

Is there a way to do something like java Bukkit.getOfflinePlayers().forEach

echo basalt
echo basalt
proud basin
#

updated it

unkempt ore
#

forEach also, it's a Collection

#

Just feed the consumer

proud basin
#

ah ok

echo basalt
unkempt ore
#

is it?

echo basalt
#

I prefer the traditional for loop

unkempt ore
#

In that case yeah nvm

echo basalt
#

but if you really want to use streams

unkempt ore
#

Arrays.stream

echo basalt
#

Stream.of(Bukkit.getOfflinePlayers())

#

it calls the same tbh

unkempt ore
#

Yes

echo basalt
unkempt ore
#

Ah, @SafeVarargs

#

I need to read what that does again

#

Something about generic heap pollution, it was weird

echo basalt
#

it just suppresses some compiler warning

unkempt ore
#

Yes, because it's dangerous

echo basalt
#

and makes sure the compiler doesn't get anxiety from all these objects ๐Ÿ‘€

worldly ingot
#

That method was removed. It's a Collection<? extends Player>

echo basalt
#

OfflinePlayers is an array

worldly ingot
#

Oh, offline players

echo basalt
#

OnlinePlayers is a collection

unkempt ore
#

Or well, if you do...I just wanna talk

worldly ingot
#

Sure they do. And when you write an API like Bukkit, ? extends Player is the correct type over just Player

crude charm
#

I want to support 1.17 in my plugin. Is this possible? I was told 1.17 made ALOT of changes and it's

a) not possible
b) a massive pain

is this true?

worldly ingot
#

Not really

unkempt ore
#

But why, Choco?

#

That is a bit strange

crude charm
#

This is a plugin that uses alot of nms

echo basalt
#

just do that fancy stuff with the nms where you have a package for each version

proud basin
#

does Bukkit.getOfflinePlayers() only get offline players?

crude charm
#

but, yes it does

echo basalt
#

I believe it actually sends ALL players

unkempt ore
#

Interface the NMS changes across versions, and load the correct implementation on startup

echo basalt
#

Since Player extends OfflinePlayer and the docs aren't really clear about it being offline specific so we assume it's all

unkempt ore
#

It does send all players

#

It sends every player that has ever joined the server

#

At least as far as the server's player data is concerned

crude charm
unkempt ore
#

Uhuh

echo basalt
#

If this guy is doing getOfflinePlayer for some name check I swear

unkempt ore
#

LOL

crude charm
echo basalt
#

let's hope

worldly ingot
#

Because when you return a Collection<? extends Player> you're denoting that it returns some implementation of Player. It's an upper bound generic. That method should, when implemented, return a list of objects that implement Player. As far as Bukkit is concerned, that could be either a GlowPlayer or a CraftPlayer. Also, as an added benefit, they're almost treated like read-only arrays. They're not, but they can be treated as one because one cannot do Bukkit.getOnlinePlayers().add(new Player() { /* and then implementing all the methods */ });. It will throw a compile error

echo basalt
#

I can tell choco likes writing essays

unkempt ore
#

Then it makes sense, alright

crude charm
#

I wanna make a prison server. Never made one only played them ALOT

unkempt ore
#

Since it's an upper bound, it's a producer Collection, so I assumed it was unmodifiable @worldly ingot

echo basalt
#

to not confuse the new devs just make it return some immutable Collection<Player>

worldly ingot
unkempt ore
#

I understand

#

Thank you for explaining

worldly ingot
#

o/

#

(and yeah CB returns an unmodifiable collection anyways)

unkempt ore
#

The only reason I thought it'd made sense is if different types are being handled under the hood, and that's just what was the case

echo basalt
#

every time I see a \o/ I think of a shocked face

worldly ingot
#

Right. iirc there's a List<CraftPlayer> in implementation

unkempt ore
#

Ah

echo basalt
#

ImmutableList

limpid pine
#

Heya Choco ๐Ÿ˜„

echo basalt
#

so I just see choco with half a face here

worldly ingot
#

Which can just be directly returned after being made immutable

#

Ye

#

I'm actually really bad about using ? extends X whenever I should definitely be using it for returned generic types

unkempt ore
#

But the thing I don't really get is, like. Why can't you just handle a List<Player> under the hood, and then return that? It's a Collection<Player>, and the compiler wouldn't complain because you're giving it the same compile time type

#

So it wouldn't care about the runtime type, still

#

Right?

worldly ingot
#

Could theoretically, sure. But why would you?

echo basalt
#

because spigot is all about confusing new devs

unkempt ore
#

Because it makes more sense, imo

worldly ingot
#

What if you want to refer to that List<CraftPlayer> under the hood and need implementation methods

#

You then have to iterate and cast each to CraftPlayer

unkempt ore
#

If that's truly the reason, sure, fine. But generally you wouldn't do this

worldly ingot
#

If you want to follow good API design patterns, you should ๐Ÿ™‚

echo basalt
#

Instead of returning Collection<? extends Player>, returning List<Player> actually helps because the developer can be certain there's some order

#

Although it doesn't imply immutability

worldly ingot
#

? extends Player and just Player are pretty much interchangeable when returned

#

When you're using the API it doesn't matter

echo basalt
#

Yeah but new devs don't know that choco

unkempt ore
#

I don't see why returning a List would be better than a Collection

worldly ingot
#

They should ;p They're still shown a Player

echo basalt
#

They'll get c o n f u s e d

unkempt ore
#

You shouldn't care, you just want "a bunch of players"

worldly ingot
#

Yeah, there's no real order in this case

#

Collection at least is the correct type

echo basalt
#

just make everything return Object

unkempt ore
#

Funny joke

unkempt ore
echo basalt
#

I did too

#

I was like hm

#

Someone sent me a friend request

#

Eh sure let's accept

unkempt ore
#

Account name Mijaa?

echo basalt
#

5 minutes later

LAUNCHING IN 10 MINUTES JOIN NOW FREE ADMIN RANK

echo basalt
crude charm
unkempt ore
#

I see

crude charm
#

haha

echo basalt
#

But I've had random accounts

unkempt ore
#

Work as what

crude charm
#

dev

unkempt ore
#

I see

echo basalt
#

I don't even get contacted by those losers

crude charm
#

this was a long time ago

echo basalt
#

ehh

rich yarrow
#

hello guys!

unkempt ore
#

I like to fuck with obvious bot accounts when they friend add me

bright jasper
#

I finally finished up my command system to a degree. Its a platform agnostic command framework which uses annotations to describe the command and that can be used to auto generate completions, atm it does not support brigadier but its really nice with spigot rn. Every platform needs an implementation though and spigot is the only one WITH an implementation but yeah it is good

unkempt ore
#

I'm like "Hmmmm, your account was created on XXX XXX XXX, you're a bot account lmao"

crude charm
unkempt ore
#

I think I've gotten some that are real people, doing it manually

#

People who don't know how to self bot, I guess

echo basalt
#

I tend to stay away from annotations because of performance

rich yarrow
#

i don't know exactly how to do that..
i'm trying to get just the slot from inventory crafting, but when i click on slot 1 in main inventory it's sending the message, but it should work just with crafting inventory slot

unkempt ore
#

I really would...prefer to avoid reflection, in such a case

#

Just because you can doesn't mean you should

bright jasper
echo basalt
#

^

#

This

#

Except annotations are pretty much made to have reflections attached to them

unkempt ore
#

Yeah

bright jasper
#

When i need a command i end up reading annotations and making something called CompiledCommand which kinda stores all the command meta/the methods and access and makes sure everything is safe and properly parsed/created

unkempt ore
#

You need to use reflection to find annotated things, if I understand correctly

echo basalt
#

Too much work

bright jasper
#

So i convert the annotation to something more standard

unkempt ore
#

And just, no

echo basalt
#

I'd rather just some random command system I made like 2 years ago

#

Where I can just use an identifier system and a wildcard that gets passed as arg

bright jasper
#

Fair, i wanted to do it though since i want my plugin to work on fabric AND spigot. And fabric has a very different system than spigot (brigadier)

#

So i used annotations which are read and turned into brigadier commands

unkempt ore
#

You're trying to do some template metaprogramming type shit and I want nothing to do with it

#

LMAO

echo basalt
#

^ me

bright jasper
#

Thats fine it works nice for my plugin personally, ill show a little example (also java template metaprogramming aint shit when you compare it to C++)

unkempt ore
#

It was a joke

bright jasper
#

I know

#

I wish C++ has runtime reflection though but sadly no runtime sadge

unkempt ore
#

You can't tmp in Java though. Just, I'd really go about trying this somehow differently

echo basalt
#

I wish C# had enums that weren't just static identifier bullcrap

#

java's enums are pretty much classes

crude charm
#

I've done barely anything in c# apart from some stuff in unity and all I remember from that is Time * Time.DeltaTime or smth like that

echo basalt
#

While C# has no params

unkempt ore
#

Like, look, let me get this straight. You want to make a command system that provides the Command implementations with information and properties through their annotations?

echo basalt
#

It's just like

enum SomeEnum {
  SomeValueOne,
  SomeValueTwo
}
#

and that's all

proud basin
#

So this is happening https://imgur.com/lLTMF8r and I understand this is not passing through ```java
if (kills > 0 && maxKills > kills) {
maxKills2 = kills;
maxKillsPlayer2 = playerName;
}

unkempt ore
#

Hey, Illusion, you have a gray pfp, right? Do you, or is my client fucking up rn

vast sapphire
#
                        if (location.getLocations().contains(blockLocation)) {
                                if (p.getLocation().distance(blockLocation) < 2.2)
                                    p.getInventory().addItem(new ItemStack(Material.IRON_INGOT));

                                }``` how do I get the distance of all of the locations in the location array?
echo basalt
unkempt ore
#

Uhuh, thought it was broken

echo basalt
#

actually ehh

#

it's weird

#

that's what it is

unkempt ore
#

Looks like you have no pfp

echo basalt
#

best paired with an invisible name and blank text

unkempt ore
echo basalt
#

probably some manager holder class

#

or his main

vast sapphire
# unkempt ore What is `location` here
public class location {
    private static ArrayList<Location> locations = new ArrayList<>();

    public static void addLocation(Location loc) {
        Generators.getInstance().getConfig().set("locations." + loc.getX() + loc.getY() + loc.getZ(), loc);
        Generators.getInstance().saveDefaultConfig();
        locations.add(loc);
    }

    public static ArrayList<Location> getLocations() {
        return locations;
    }
}
unkempt ore
#

No

echo basalt
#

yo what the

crude charm
unkempt ore
#

No, no, please bro

#

Please

#

No

crude charm
#

then would you see it

echo basalt
#

try it

#

it's only 1:20AM

crude charm
#

ru trying to burn my eyes?

crude charm
#

lmfao

echo basalt
#

uhh

#

lowercase class

#

and static non-final collection

unkempt ore
echo basalt
#

With that thing people complain about to use List<?> list = new ArrayList<>() instead of ArrayList<?> list = ...

proud basin
#

Why is nothing showing up https://imgur.com/lLTMF8r when the second if statement is true? ```java
int maxKills = 0;
int maxKills2 = 0;
int maxKills3 = 0;

    String maxKillsPlayer1 = "";
    String maxKillsPlayer2 = "";
    String maxKillsPlayer3 = "";

    for (OfflinePlayer p : Bukkit.getOfflinePlayers()) {
        for (String playerName : core.getConfig().getConfigurationSection(p.getUniqueId().toString()).getKeys(false)) {
            int kills = core.getConfig().getInt(p.getUniqueId() + ".kills");
            playerName = core.getConfig().getString(p.getUniqueId() + ".name");
            if (kills > maxKills) {
                maxKills = kills;
                maxKillsPlayer1 = playerName;
            }
            if (kills > 0 && maxKills > kills) {
                maxKills2 = kills;
                maxKillsPlayer2 = playerName;
            }
        }
    }
echo basalt
#

and singleton config

crude charm
#

oh yeah it does

echo basalt
#

Do you debug it?

crude charm
#

EWW

#

I cant see a thing

echo basalt
proud basin
reef wind
crude charm
proud basin
vast sapphire
crude charm
#

this is DISGUSTING

proud basin
#

oh found the issue I think

#

nvn

#

nvm

reef wind
#

discord light mode doesnโ€™t look that bad, but it burns your eyes.

crude charm
#

I cant see shit on it

whole stag
#

And blocked

crude charm
#

lol

rotund pond
#

Hello !
I have a simple question about FileConfiguration...
I need to make runtime configurable, and I would like to use this layout:

  beginning: 11:05
  ending: 11:10

Won't the two points be a problem?

Thank you for reading ๐Ÿ™‚

vast sapphire
#

yeah... green theme is better

proud basin
reef wind
echo basalt
echo basalt
bright jasper
#

That is inhuman

echo basalt
#

so yeah your updating is wrong

reef wind
bright jasper
#

@echo basalt ```java
@Command(aliases = {"link"})
public class CommandLink {
private final DiscordLink plugin;

public CommandLink(DiscordLink plugin) {
    this.plugin = plugin;
}

@Default
private void link(CommandSender sender) {
    sender.sendMessage(plugin.getLocale().getElement("link.example").set("player", sender.getName()).info());
}

@Command(aliases = {"subcommand"})
private void subcommand(CommandSender sender, @Choice({"tea", "coffee"}) String drink) {
    sender.sendMessage("You like " + drink);
}

}

this is the command, also beware @Command does have stuff for permissions too, here is it being used
https://i.kawaii.sh/5AyQBM5.mp4
#

its a cool concept i think anyway

#

so yeah it does kind of checking to make sure args are valid and automatically parses it. CommandSender is not bukkit commandsender its my own, this whole thing is not platform specific and has adapters

#

So spigot has a command implementation for this (and has an EventBus implementation since i made my own too)

#

๐Ÿ™ more of a very specific use case though so most wont need it and its bloat but i like for my stuff since i also support fabric

proud basin
vast sapphire
bright jasper
#

cursed

vast sapphire
#

I have green spots when I get up

reef wind
proud basin
final monolith
#

i can overpass that max distance?

echo basalt
final monolith
#

ok, thanks ;D

echo basalt
#

No worries

vast sapphire
#

nah jk i use this theme '

digital plinth
#

what plugin did you make? link?

quaint mantle
#

Does anyone know any reasons this might be happening?

digital plinth
#

a entity with multiple names? I think one entity can have only one name. What are you trying to do?

proud basin
#

don't worry I figured out what I wanted to do

quaint mantle
pulsar schooner
#

Fairly certain yml needs two spaces

#

Also did you register it in the main class (be honest, everyone forgets ๐Ÿ˜‰ )

quaint mantle
#

i did register it, but let me try to double space and see if that fixes it

pulsar schooner
#

Just do

List<UUID> entries = new ArrayList<>(kills.entrySet());
#

Or if you need a map use Map<UUID, Integer> instead

proud basin
#

What's wrong with what i have?

pulsar schooner
#

Idk it looks weird

#

If it works it doesn't rly matter

#

But that's just not how i would do it

#

whatever floats ur boat tho ยฏ\_(ใƒ„)_/ยฏ

quaint mantle
raw coral
#

Is there a way to make floating blocks that move freely so i can make animations with them that are life size (when i do it with an armor stand they are smaller)

rancid snow
#

How would I find the event for when a cow is milked?
I searched the java doc and there isn't anything for just cow milked

raw coral
#

holding a bucket

#

Oh PlayerInteractAtEntityEvent use that

rocky needle
#

t

raw coral
#

@EventHandler
public void cowMilk(PlayerInteractEntityEvent e){
Player p = e.getPlayer();
if (e.getRightClicked() instanceof Cow && p.getItemInHand().getType().equals(Material.BUCKET)) {
//Logic Goes Here
}
}

#

smth like that

rancid snow
#

whats the difference between PlayerInteractAtEntityEvent and PlayerInteractEntityEvent

raw coral
#

@rancid snow From the docs
PlayerInteractAtEntityEvent: Represents an event that is called when a player right clicks an entity that also contains the location where the entity was clicked.
PlayerInteractEntityEvent: Represents an event that is called when a player right clicks an entity.

And the PlayerInteractEntityEvent is a superclass of the PlayerInteractAtEntityEvent class

rancid snow
#

getItemInHand is deprecated

raw coral
rancid snow
#

alr

raw coral
# rancid snow alr

Sorry for giving you a deprecated function it isn't deprecated in 1.8 and i mainly use that .w.

rancid snow
#

np dw

proud basin
rancid snow
#

How do I make a message component?

#

I'm using player.sendMessage(); but i don't understand how to make the component

raw coral
rancid snow
#

there's like 4 different functions with the same name

#

ah this clears it up

raw coral
rancid snow
#

oh this doesnt work either

#

I don't understand how to do this correctly then

vast sapphire
#

I looped through the location but now I have a problem where for each generator I have placed down, I get 1 iron ingot so if I have 5 generators I get 5/t and I want 1/t for each one ```java
public void run() {

                            for(Location l : location.getLocations()) {
                                if (distanceBetween(p.getLocation(), l) <= 2.2) {
                                    p.getInventory().addItem(new ItemStack(Material.IRON_INGOT));

                                }
                            }
                        }
                    }, 0, REWARD_TICK_DELAY);```
#
                        switch (args[0].toLowerCase()) {
                            case "iron":
                                p.getTargetBlock((Set<Material>) null, 3).setType(Material.IRON_ORE);
                                blockLocation = (p.getTargetBlock((Set<Material>) null, 3).getLocation());
                                location.addLocation(blockLocation);
                                if (location.getLocations() != null)
                                    p.spigot().sendMessage(ChatMessageType.ACTION_BAR, new TextComponent("Generator Placed at " + blockLocation.getBlockX() + ", " + blockLocation.getBlockY() + ", " + blockLocation.getBlockZ()));
                                    Generators.getInstance().getConfig().set("locations", location.getLocations());
                                    Generators.getInstance().saveConfig();
                        }``` command
proud basin
#

put the gens in a map maybe?

raw coral
rancid snow
#

every one of these is deprecated

#

wtf

#

what should I be using then?

raw coral
#

like what i provided earlier

rancid snow
#

I don't want a normal string, I'm looking for colors

raw coral
#

You can

#

use

#

concactention

#

or however

#

you spell it

rancid snow
#

with colors?

raw coral
#

Yes

#

ChatColor.GREEN+"You milked a cow"

rancid snow
#

how is that better then what I sent

#

since I'm using components with 1.17

hasty prawn
raw coral
#

like you said using components is deprecated?

vast sapphire
slim bough
#

i need a way to make things unbreakable

rancid snow
slim bough
#

is there is aplugin u know of

rancid snow
#

I'm trying to find something that's not deprecated

hasty prawn
rancid snow
#

I didn't.

raw coral
rancid snow
#

look at this picture

#

everything is deprecated

#

that's why i'm confused

raw coral
#

YOU TRIED

#

wait

rancid snow
#

tried what

raw coral
#

let me check

#

for myself

rancid snow
#

okay

proud basin
#

bump

raw coral
#

player.sendMessage("")

#

is deprecated?

#

because i just got the latest

#

version of spigot

#

and its working completely fine

rancid snow
#

im on 1.17

#

oh hm

#

OHH

raw coral
rancid snow
#

.spigot().sendMessage is deprecated

raw coral
#

yeah

#

why were you using

#

.spigot

rancid snow
#

whoever told me that

rancid snow
raw coral
#

but that was

#

after

#

i told you

#

about

rancid snow
#

okay works fine

#

ty

raw coral
#

the first time

#

:l

hasty prawn
#

If my IntelliJ would behave I would help more ๐Ÿ˜‚

raw coral
#

anyway

hasty prawn
#

It has decided to not find my own classes

raw coral
#

next person

rancid snow
#

it's still deprecated

raw coral
#

NOT A COMPONENT

rancid snow
#

I DONT WANT A STRING

#

I WANT A COMPONENT

raw coral
#

WHY

rancid snow
#

THATS WHAT I WANT TO DO

raw coral
#

if you want

#

your .append

#

use a StringBuilder

rancid snow
#

I DONT WANT A STRING

#

I WANT A COMPONENT

raw coral
#

@SupressWarnings

#

if you arent going to use

#

what your supposed to

hasty prawn
#

What version of Spigot are you using? @rancid snow

raw coral
#

why care about depercation

#

also yeah

#

i just tested

#

and none of those

#

functions are deprecated

raw coral
#

If you want to use something thats apparently deprecated when there are other options that work perfectly fine

#

just supress it

quaint mantle
#

tf are yall doing

hasty prawn
#

Cause you don't need components for that.

raw coral
quaint mantle
#

player.sendMessage(ChatColor.translateAlternateColorCodes('&', myColorString));

raw coral
#

and complaining because the thing they want to use is deprecated

hasty prawn
quaint mantle
raw coral
#

Yeah

#

we all did

#

they arent listening

rancid snow
#

I ddon't want to use strings

#

I just want to make a component

quaint mantle
raw coral
#

Then just leave

rancid snow
#

how is that confusing

raw coral
#

WHY

#

LITERALLY WHY

rancid snow
#

Because that's how I want to do it

raw coral
#

tell us why you need to use a component

#

then

#

fucking leave

#

and deal

#

with the deprecatin

rancid snow
#

why do I have to explain myself

raw coral
#

ok?

rancid snow
#

it's literally there in the code

quaint mantle
hasty prawn
torn shuttle
#

when you set a wolf to angry does that go away after a set amount of time?

narrow vessel
quaint mantle
paper viper
#

and shade that in

narrow vessel
#

or you can use paper

#

like a normal person

paper viper
#

But yes

#

using paper is better

#

lol

hasty prawn
#

What are you trying to do jtx

#

Have a UUID -> Integer?

torn shuttle
raw coral
#

gj

proud basin
hasty prawn
#

Use a HashMap

proud basin
#

wait

#

what do you mean by ->

quaint mantle
proud basin
#

Like UUID to Integer?

hasty prawn
#

Yeah

raw coral
#

i think

hasty prawn
#

^

proud basin
#

yea

hasty prawn
#

Yeah use a HashMap

proud basin
#

But what's wrong with what im doing?

raw coral
#

HashMap<Integer,UUID>

#

Hashmaps are better

hasty prawn
#

Uhh, well doing entries.get(i).getKey() will just return a single UUID at the entry at index i

raw coral
#

OHHH

#

my brother

#

explained this to me a while ago

#

so with HashMaps it only has like one layer

#

but a list then a set has 2

proud basin
#

What im trying to do is have a top 10 leaderboard

raw coral
#

Anyway HashMap is basically a list of entrysets

hasty prawn
proud basin
#

yes

#

wait no

#

ye

raw coral
#

shouldnt your integers be the key then

hasty prawn
#

Just use a List<UUID> and use the index as the placement

proud basin
#

Yeah so what I was trying to do is just store the entries

#

but I guess ima do what you said

torn shuttle
proud basin
hasty prawn
#

Well add them in order

unkempt ore
proud basin
unkempt ore
#

They should, if you're sorting by them

proud basin
#

how come>

unkempt ore
#

Use a TreeMap, keyed by the integer, sort it, reverse it, and get the first 10 values

#

Because if you key by the integer and use a TreeMap, it'll be a natural order

#

Just one operation to sort it and then reverse it

proud basin
#

hm

unkempt ore
#

Natural order for ints is least to greatest, so that'll get ya the worst player to the best player

#

Then you just wanna reverse that to go from best player to worst, and the first 10 items of that state is a nice and neat top 10

proud basin
#

Will have to do some research on treemaps never used it before

unkempt ore
#

It's very simple, basically a Map implementation that has ordering and sorting capabilities

#

Which is exactly what you want

#

You have a mapping of "scores" and player UUIDs, and you're sorting by scores

proud basin
#

so should then should I be doing public Integer[] still?

granite beacon
#

Question, if I want preform a sync only method at some point through an async event should I just schedule a scheduler.runtask inside of the async event?

unkempt ore
proud basin
#

well before I was using their uuid

unkempt ore
#

What data is provided to you here

#

You want to make a leaderboard, right

proud basin
#

yes

#

Their UUID, Name & kills

unkempt ore
#

Are all of these in one object?

#

As in, does one object have name, UUID, and kills?

#

Or is the name and UUID separate from the kills?

proud basin
#

same object

unkempt ore
#

You sure? Alright

#

So you could actually have a Collection of this object

proud basin
#
6e103091-1f23-4818-904c-d8df7211ebda:
  name: wengengengengeng
  deaths: 2
  kills: 8

unkempt ore
#

Uhuh

#

And you deserialize these?

proud basin
#

deserialize?

unkempt ore
#

Well, not exactly what I meant. You have access to the configuration object in the place you're ordering the leaderboard, correct?

proud basin
#

yea

unkempt ore
#

Alright, so getting all the keys in the level you just posted will get you all the UUIDs. Now what you probably can do here is get all the configuration sections here

#

As in, get all the "player" objects, can you do that?

proud basin
#

Yeah not to hard ```jav
core.getConfig().getInt(p.getUniqueId() + ".kills");

unkempt ore
#

Well, no

proud basin
#

What did you mean then?

unkempt ore
#

I mean get all the ConfigurationSections of the UUIDs on top

#

Like a collection of them all

#

These would represent "player" objects

#

Yeah?

proud basin
#

I'm not sure if I understand what you're trying to say

unkempt ore
#

So, you know how there's a getConfigurationSection(String)?

proud basin
#

you mean getConfig().getString()?

unkempt ore
#

Actually, hold on. I have a better idea

#

You wouldn't mind doing this on Bukkit.getOfflinePlayers() would you?

#

And if they're not there, default to 0 kills?

proud basin
#

That's what I was doing before

unkempt ore
#

I mean that sounds fine honestly. Are you using the sorted list right away after making it?

proud basin
#

sure

#

though

unkempt ore
#

Or, will you

proud basin
#

I haven't even made the method..

unkempt ore
#

Okay, so look. You could get the OfflinePlayers, right? And then copy the collection

#

And then sort it by their kills in the config

proud basin
#

so sort the kills in the config file itself?

unkempt ore
#

Well, no, in your code

#

The config is where we get how many kills they have

#

So you can do Bukkit.getOfflinePlayers() and then pass that to new ArrayList<>(offlinePlayers); to make a copy of it

#

Which you can then sort, but for now just make a copy, and tell me

proud basin
#

so just copy the players UUID into the collection

unkempt ore
#

No, not UUID

#

Because you need the name later

#

So use the OfflinePlayer, trust me. Just make a copy of the offline player list first

#
Collection<OfflinePlayer> players = List.of(Bukkit.getOfflinePlayer());
raw coral
#

How can i get the midpoint of 2 locations

unkempt ore
#

Math

raw coral
#

val avgLocation = Location(armorStand.world,loc1.x+loc2.x/2,loc1.y+loc2.y/2,loc1.z+loc2.z/2) this isnt working

#

and im pretty dum

unkempt ore
#

Well that's because you're not organizing your orders of operations properly

raw coral
#

but

#

i thought

unkempt ore
#

Divison comes before addition, my friend

raw coral
#

java did math

#

from left to right

unkempt ore
#

Nope

raw coral
#

ah

#

ok then

#

mb

unkempt ore
#

Use that snippet I gave, it's like that

raw coral
#

pemdas ๐Ÿ˜‚

unkempt ore
#

Well, yeah, literally

unkempt ore
#

WHY ARE YOU ADDING LMAO

#

Is it addition? I totally forgot

raw coral
#

isnt avg (x+y)/2

unkempt ore
#

I thinkI may be being a dumbass idk

#

For a second I thought you subtracted in there

proud basin
raw coral
#

yeah that worked pog

proud basin
#

btw what is List suppose to represent?

unkempt ore
#

List.of is a static method that just copies what you give it

#

And gives you a List that is the copy

proud basin
#

Im on jdk 1.8

unkempt ore
#

I see

#

In that case, do Arrays.asList(Bukkit.getOfflinePlayers())

#

Then once you have this copy

proud basin
#

wait doesn't asList return a list? and your using it in a collections

unkempt ore
#

What

proud basin
#

wait let me try something

unkempt ore
#

It's polymorphism

proud basin
#

Yeah no instance(s) of type variable(s) T exist so that List<T> conforms to Collections

unkempt ore
#

Why is it Collections

#

It's Collection

#

They're different classes

rancid snow
#

how can I enchant items with a higher level enchant than 5?

proud basin
#

a shit right

#

so what was the next step again

raw coral
#

how do i get distance between loactions

unkempt ore
#

Bro

#

Location#distance

#

Lmao

raw coral
#

well damn

#

very pog

unkempt ore
#

Add the static import for comparingInt

plain oxide
#

player.getScoreboard().resetScores(resetMyScore);
How can I use this to reset the score starting with the specified character?

unkempt ore
#

What is your name...pyuagotto?

proud basin
#

getUniqueId is no longer a object

#

when adding reversed

unkempt ore
#

That's so weird...

#

I don't get why that happens, wow

proud basin
#

๐Ÿคท

#

players.stream().sorted(Comparator.comparingInt(p -> core.getConfig().getInt(p.getUniqueId() + ".kills")).reversed());

unkempt ore
#

You could do ((OfflinePlayer) p).getUniqueId()

#

Because for some reason it sees it as an Object

proud basin
#

alrighty

#

weird

unkempt ore
#

yes, that it very strange

proud basin
#

so everything gets sorted now?

unkempt ore
#

Well, now the list copy should be an ordered Collection from OfflinePlayer with the most kills to the one with the least kills

proud basin
#

Does Collection have a thing to only select top 10 or do I have to make something myself for that

unkempt ore
#

Stream it, and limit 10

proud basin
#

oh I see

raw coral
#

Hello im not very good at math so basically i have 3 points (the red green and blue wool) and i want to get a parabola so i can make somethign that travels smoothly that passes through those 3 points i also have a function to get a quadratic equation from 3 points but im wondering what the heck im supposed to pass as the points since this is 3d

proud basin
#

well this is my method ```java
public Collection<OfflinePlayer> getTopKills(int maxTop) {
Collection<OfflinePlayer> players = Arrays.asList(Bukkit.getOfflinePlayers());
players.stream().sorted(Comparator.comparingInt(p -> core.getConfig().getInt(((OfflinePlayer)p).getUniqueId() + ".kills")).reversed());
players.stream().limit(maxTop);

    return players;
}
unkempt ore
#
Stream.of(Bukkit.getOfflinePlayers())
              .sorted(comparingInt(p -> getConfig().getInt(((OfflinePlayer) p).getUniqueId() + ".kills")).reversed())
              .limit(10)
              .collect(toList());
#

This would be more succinct

proud basin
#

yeah was about to test that

#

coolio

#

uh

#

wtf

unkempt ore
#

What

proud basin
unkempt ore
#

Is it a ClassCastException

proud basin
#

bi

#

no*

unkempt ore
#

Lmaoooo

#

Dude

#

That's funny

#

You're putting the OfflinePlayers there

#

Not the players' names

#

Use their getName()

proud basin
#

??

#

im not putting their name

#

im calling my method

unkempt ore
#

You're literally putting them as Strings

#

So, somehow, you're passing the entire objects directly

proud basin
#

well I do have getTopKills in a string

unkempt ore
#

Because CraftPlayer[UUID=XXXX] and shit

#

Is OfflinePlayer's toString()

proud basin
#

in the stream?

unkempt ore
#

You're literally printing the Collection of them

proud basin
#

yea

unkempt ore
#

Somewhere

#

No, bro

#

Lmfao

#

Like, you're putting the result of the collection in a string?

#

Yeah that's why

#

It's doing toString() on the Collection, and it becomes that

#

So you're gonna want to extract these values yourself by iteration

#

What format do you want here, exactly?

proud basin
#

Format for what?

unkempt ore
#

For the leaderboard

proud basin
unkempt ore
#

Ahhhhh, shit

proud basin
#

wsup?

unkempt ore
#

So like you want the kills listed there also. We did it wrong then

#

Cuz like right now you're not storing the kills, ya know

#

And you need them later too, so

proud basin
#

yea

#

what were you thinking I was doing

unkempt ore
#

I am actually not sure what I was thinking in the end

#

But hey, it's not so bad. The original idea with the TreeMap is actually what you want

#

Now let's see. You'll want to make a TreeMap<Integer, OfflinePlayer>. And iterate through the OfflinePlayers

#

And for each one, put it in the TreeMap like

map.put(config.getInt(player.getUniqueId() + ".kills"), player)
proud basin
#

so do I still need the method I made?

unkempt ore
#

Nope, this has to change now. You could make the method return a Map<Integer, OfflinePlayer> though

waxen plinth
#

Whoa whoa whoa

#

That is a TERRIBLE idea

unkempt ore
#

Is it?

waxen plinth
#

Yes

unkempt ore
#

Should he sort it after the iteration instead

waxen plinth
#

If 2 players have the same number of kills it will drop one

unkempt ore
#

Ah, that is indeed a scenario

waxen plinth
#

You don't need random access, right? Only iteration?

unkempt ore
#

He wants a top 10 order of integers to players

raw coral
#

is there anyway i can fit a parabola to three points in minecraft so i can have something like ana rmor stand move smoothly through them

waxen plinth
#

If so you can use a PriorityQueue or TreeSet

#

TreeSet probably a better fit

unkempt ore
#

Why

waxen plinth
#

You can sort on kill count

#

Which by the way doesn't need to be stored in config

#

It's a statistic you can get from the player directly

#

getStatistic or something I think?

unkempt ore
#

He's storing it himself though, you don't know that he's depending on the overall kill count in the world

waxen plinth
#

True

#

You can still sort on kill count then

raw coral
#

anyone have any ideas or pointers for me because im struggling with google>

waxen plinth
#

Like plugin ideas for learning?

unkempt ore
#

No, the 3D parabola

waxen plinth
#

Ah

proud basin
#

so uh

waxen plinth
#

Are you trying to create a launch pad

#

I have done that before

unkempt ore
#

Thing is, Redempt, he wants to sort by OfflinePlayer kill counts he's stored, and also have access to the kill counts after the sorting is done

#

So a Set doesn't sound right, but a Map does

waxen plinth
#

Huh

#

You can totally use a TreeSet for that

#

And don't do OfflinePlayer

#

That's a bad idea for another reason

unkempt ore
#

Why? He's using the built top 10 of them right after it's built, and just taking their name with their kills

waxen plinth
#

Yes

raw coral
waxen plinth
#

That's easy to do with a TreeSet

#

@raw coral I don't think it would be easy to make a parabola but it shouldn't be hard to approximate one by slicing up a sine wave

unkempt ore
#

No, I'm asking why it would be bad to use OfflinePlayer then

waxen plinth
#

Ah

waxen plinth
#

Because if a player logs off and logs back on again

raw coral
#

im just in 8th grade im about to take geometry

waxen plinth
#

Then you get a new Player instance

unkempt ore
#

Doesn't matter

raw coral
#

ie: no idea what a sine wave is

waxen plinth
#

It's better to use UUID

unkempt ore
#

Well generally, but he wants the player's name

waxen plinth
#

Yes so you fetch the offline player by UUID

raw coral
#

why not use a UUID

#

up to everything

#

but the end

#

when you get the name

waxen plinth
#

Exactly

raw coral
#

thats what i did for ma leaderboard

waxen plinth
#

The map approach would work with an OfflinePlayer if not for the int collision

#

You'd want something like this

proud basin
#

So what's the plan

unkempt ore
#

Would you just get all the UUIDs of offline players just to fetch the offline players again with them after

waxen plinth
#
Set<UUID> leaderboard = new TreeSet<>(Comparator.comparingInt(id -> -config.getInt(id + ".kills")));```
#

Easy

raw coral
waxen plinth
#

Then to get the top 10

unkempt ore
#

Why are you negating

waxen plinth
#
leaderboard.stream().sequential().limit(10).collect(Collectors.toList())```
#

Because otherwise it sorts in ascending order

#

You want descending order, highest to lowest

unkempt ore
#

I know

#

But then he needs the kills after. Would you just fetch from the config again?

waxen plinth
#

Yep

#

Config is just a big hashmap though so it doesn't really matter

unkempt ore
#

Well yeah I know it's a cache

#

Just repeating myself makes me uncomfortable

#

I use Comparator#reversed here

raw coral
unkempt ore
#

Yeah

#

It is

waxen plinth
#

I mean yeah but that's a bunch of characters instead of just 1 lol

raw coral
#

alr well i guess drawing a 3d parabola is too complicated for me so ill just get averages of points

quaint mantle
#

hey hey

raw coral
#

ola

quaint mantle
#

this is a question that will lead to way more questions i assume

raw coral
#

whats up

waxen plinth
#

You can lerp between the 3 points as a start

quaint mantle
#

however, what are some of the best ways of detecting Flight on an anti-cheat

#

NOT ASKING FOR CODE

waxen plinth
#

And then smooth it into something like a parabola

quaint mantle
#

unless you want to provide it

#

just wondering some good ways

waxen plinth
#

By moving points by the square root of their distance to the center

raw coral
#

so what does the function return

waxen plinth
#

Lerp just gets a value along a line

raw coral
#

ah

proud basin
#

oh my

raw coral
#

so if this is my paravola

#

i would lerp red to green woll

#

then green to blue

waxen plinth
#

Yeah lerp would be a straight line

raw coral
#

Also how do i do that

#

with locations

waxen plinth
#

Same as if it were 1 dimesional basically, just applying all operations to 3d locations instead of 1d

raw coral
#

e.e ive never used this before can i get an example?

austere bone
#

hey, need a little help..

i have 3 worlds (for here lets just say test, test_nether, and test_end) and i want to link the nether/end portals between them..
currently i have, but this doesn't work

public void onPlayerPortal(PlayerPortalEvent e) {
        World fromWorld = e.getFrom().getWorld();
        switch (e.getCause()) {
            case NETHER_PORTAL:
                switch (fromWorld.getEnvironment()) {
                    case NORMAL:
                        e.getTo().setWorld(Bukkit.getWorld("test_nether"));
                        break;
                    case NETHER:
                        Location newTo = e.getFrom().multiply(8.0D);
                        newTo.setWorld(Bukkit.getWorld("test"));
                        e.setTo(newTo);
                        break;
                    default:
                }
            case END_PORTAL:
                e.getTo().setWorld(Bukkit.getWorld("test_end"));
                break;
        }
proud basin
#

@unkempt ore So what's the plan?

raw coral
proud basin
#

hm I see

#

I might just store the kills in a db

#

Will be much simpler to add it to leaderboard

raw coral
waxen plinth
proud basin
#

sounds easier

waxen plinth
#

But if you only need to store top 10 then TreeSet is your best friend

proud basin
#

eh

#

idk

waxen plinth
#

If it helps, I have a SQL helper

proud basin
#

Never really worked with TreeSet

waxen plinth
#

It's just a sorted set

proud basin
#

๐Ÿคท

quaint mantle
#

how do i set the amount of online players in the ServerListPingEvent

#

not to fake the playercount

#

well yeah to fake it but just to remove people who are vanished from it

waxen plinth
proud basin
#

This seems complicated the way you are saying

#

I've already have my own but thanks

waxen plinth
#

k

raw coral
#

Ok so i got the lerp to work but can u explain what you were saying about square root?

waxen plinth
#

Ok so you currently have it as linear

raw coral
#

yup

waxen plinth
#

Look at the graph of y=sqrtx from 0 to 1

raw coral
#

like want me to pull it up on desmos?

waxen plinth
#

Sure

raw coral
#

alr

waxen plinth
#

You can sqrt the number you plug into lerp

raw coral
#

val armorStand4 = SkyblockHolograms.createFloatingBlock(armorStand.location.lerp(armorStand3.location,0.2), ItemStack(Material.STONE))

#

so 0.2?

waxen plinth
#

Why do you have it as a fixed value

#

That should be a loop

raw coral
#

i was making sure my function worked lol

#

yeah i know

waxen plinth
#

Ok I am extremely tired

#

Gonna go temporarily die

#

Bye

raw coral
#

understandable

#

oh bye

#

eeeee

#

so close

#

yet so far

quaint mantle
#

how do i set the amount of online players in the ServerListPingEvent

raw coral
#

man i was so close

solid horizon
#

yo, im having a bit of an issue, but im sure its pretty simple to solve

raw coral
quaint mantle
#

the amount of players

raw coral
#

Then looking at that event

#

its not possible

quaint mantle
#

what i want to set/30

#

well i saw the Iterator for it

#

and was wondering how that one even works?

raw coral
#

well there isnt a setter for it

#

so no idea

solid horizon
#

basically, is there a way i can check if an argument in a command is null so it doesnt give me an error after running an if statement on an unentered/null argument?

raw coral
#

to determine

#

thats the only null safe way

solid horizon
#

args[0].length == 0?

raw coral
#

P+ / / / /

#

what

solid horizon
#

would that work?

raw coral
#

no

#

if(args.length==1)

#

then args[0] exists

#

args.lengt == 2

#

means args[0] and args[1] exist

solid horizon
#

would that only account for the first argument?

quaint mantle
#

and so checking the .length is checking how many strings are there

solid horizon
#

an argument?

raw coral
#

how many

#

args

#

do you want

#

in your command

#

thats what you should length check for

#

also dude i asked you this yesterday

raw coral
#

do you know java

quaint mantle
undone axleBOT
quaint mantle
raw coral
#

because it really would help you to get some foundationm

raw coral
quaint mantle
#

lmao

solid horizon
#

I assumed it was the lengh of a certain argument in characters

raw coral
#

i defenitely dont know math

quaint mantle
#

idk why they're so similar

#

i imagine .size() would've been more appropriate for collections of strings

solid horizon
#

ok, that makes more sense

quaint mantle
#

that probably is a thing i just cbb to check

raw coral
#

lol in kotlin

#

they just changed

#

arr.length to arr.size

quaint mantle
#

LOL

raw coral
#

imo string.length makes more sense

#

and size of array

#

makes more sense

solid horizon
#

also, i'm just starting to learn java, going from c#, ps, and batch lmao

ivory sleet
#

C# is basically Java just switched some cases

solid horizon
#

I'm a few weeks in

solid horizon
#

almost*

raw coral
#

anyway i just spent the last 3 hours to make a failed parabola because the person that was helping me had to sleep

ivory sleet
#

Looks pog :0

solid horizon
#

nice

raw coral
solid horizon
#

you call that failed?

raw coral
solid horizon
#

meh

raw coral
#

no like literally

#

since it was linear interpolation

#

i think

#

idk

ivory sleet
#

Redempt went to sleep already!?

solid horizon
#

lines are cool ..

ivory sleet
raw coral
#

apparently

raw coral
ivory sleet
#

No I suck at math

#

Or rather inexperienced since Swedish schools are kinda dumdum

solid horizon
raw coral
#

pog

#

ill just wait for my brother to get home i guess

solid horizon
#

i was just tryna make a smite command, but if the user didnt enter a player, it sent an error

raw coral
#

although he tried to get me to use advanced physics to get the parabola

ivory sleet
#

Lol

solid horizon
#

i'm really just making a simple plugin for my server

raw coral
#

and im trying to copy skyblock, a very large game

ivory sleet
#

Hypixel SkyBlock?

raw coral
#

yeah

#

just a sandbox

#

trying to make some of the cooler items

ivory sleet
#

Ah

raw coral
#

so people that are too poor

#

can see what their like

solid horizon
#

๐Ÿ˜ฌ thats big

ivory sleet
#

Oo thatโ€™s a nice motive to say the least (:

solid horizon
#

dude i only have fot and strong/young drag ;-;

raw coral
#

i got banned and wiped

#

a bit ago

solid horizon
#

how come?

raw coral
#

if i told you id have to kill you Alice_evil_smile

ivory sleet
#

Prince are you adding dungeons also? O.o

solid horizon
#

๐Ÿ˜„

raw coral
#

idkkk

solid horizon
#

go ahead

raw coral
#

so farive made hyperion and terminator

#

and mob spawning

#

but considering admins took 8 months for admins with a whole dev team