#help-development

1 messages ยท Page 2238 of 1

valid totem
#

instead of args[0] == null

tender shard
#

look at the full error. it will tell you that there's an index out of bounds exception.

mortal hare
#

actually that's better way to handle this, because by using container synchronizer method, your items will still be handled by the server, and you can make invisible slot selections

old sail
#

There're a few actions that conflicts with the glow packet. So the problem should be fixed by re-sending the packet right after listening for these events, I guess?

#

I do have one private final HashMap<Player, ArrayList<Entity>> glow = new HashMap<>();

quaint mantle
#

I'd like to do it the Dynmap way then

#

Could you explain a bit more?

balmy fox
#

I am working on many different project with diffreent program langues and its getting masy ๐Ÿ˜…

mortal hare
tender shard
#

yeah pretty stupid description lol but it probably makes perfect sense

mortal hare
#
    @Override
    public void write(ChannelHandlerContext ctx, Object msg, ChannelPromise promise) throws Exception {
        if (msg instanceof Packet<?>) {
            for (PacketListener<?> handler : this.handlers) {
                Class<?> clazz = handler.getClazz();
                if (!clazz.isInstance(msg)) continue;
                if (!handler.onPacketSend(player, clazz.cast(msg))) return;
            }
        }
        super.write(ctx, msg, promise);
    }
#
public class PacketListener<T extends Packet<?>>
#

im trying to reuse my old packet listening code

tender shard
#

do not use Packet<?> but T in your method

mortal hare
tender shard
#

then show the full class pls

#

if you only send parts of it, it's hard to figure out what the problem is

mortal hare
#
public class PacketListener<T extends Packet<?>> {
    private final Class<T> clazz;

    public PacketListener(Class<T> clazz) {
        this.clazz = Objects.requireNonNull(clazz);
    }

    public Class<T> getClazz() {
        return this.clazz;
    }

    public boolean onPacketSend(Player player, T packet) {
        return true;
    };

    public boolean onPacketReceive(Player player, T packet) {
        return true;
    };

}
#

this is old code, this should use preconditions rather than requireNonNull, since i prefer those nowadays

ocean lion
#

Player target = player.getServer().getOfflinePlayer(args[0]); does not work

#

what would I replace it with?

lost matrix
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.

ivory sleet
ocean lion
crisp steeple
mortal hare
#

i fixed it

modest garnet
#

anyone know how i can
set a players XP

however it automatically calculates the levels ect

crisp steeple
#

i used the kind of hacky solution of just casting it to a non-generified type but it ended up working

tender shard
mortal hare
#

i removed the wildcard

#
            for (PacketListener<Packet<?>> handler : this.handlers) {
                Class<Packet<?>> clazz = handler.getClazz();
                if (!clazz.isInstance(msg)) continue;
                if (!handler.onPacketSend(player, clazz.cast(msg))) return;
#

and this has no errors anymore

#

don't ask me how this fixed it

ocean lion
mortal hare
tender shard
modest garnet
#

anyone know how i can
set a players XP

however it automatically calculates the levels ect

ocean lion
#
Player target = player.getServer().getOfflinePlayer(args[0]);
crisp steeple
#

you can just do Bukkit.getOfflinePlayer(args[0]) presuming args is a string array

quaint mantle
#

Still pretty confused on this

ocean lion
#

does not work either

#

big red line under

tender shard
ocean lion
#

needs Player variable and not Offlineplayer

#

DUDE

#

you asked me 5 times now

crisp steeple
#

chill out

mortal hare
tender shard
#

Server#getOfflinePlayer definitely requires a String or UUID and not a Player.

old sail
ocean lion
#

I told you already, it says it needs a player variable instead of offlineplayer

crisp steeple
#

works fine for me (even though it is deprecated)

tender shard
#

getOfflinePlayer definitely doesn't require a player, and args[0] most likely is not an offlineplayer

quaint mantle
#

getOfflinePlayer returns an OfflinePlayer, not a Player object

tender shard
#

so what you say doesn't really make any sense

#

show a screenshot of your code or ?paste it

#

not just the single line

crisp steeple
#

not sure what you expected

tender shard
#

oh I didnt even look at the left side of the assignment

#

yeah obviously an OfflinePlayer is not a Player

ocean lion
#

obviously

tender shard
#

yeah so you know what the problem is now

ocean lion
#

yeah now I do thanks to deotime. Not you asking me the same question over and over and now realizing you havent even looked at what I sent out

knotty gale
#

Hi, does anyone know how mods work? like how to make them

mortal hare
#

Do you guys do preconditions on internal methods or classes

coarse shadow
#

you need forge to use mods

mortal hare
#

im wondering if that's a waste or not

tender shard
#

well if the only explanations you give is "well, it says it requires a Player variable instead of Offlineplayer" and "it has a big red line under" then obviously I don't spent 20 minutes to try to find out what the exact error actually is

hexed hatch
#

forge or fabric

coarse shadow
#

ye

knotty gale
hexed hatch
#

that's how you make them too pal

#

with the forge api

coarse shadow
#

there are courses that teach you how to do them

knotty gale
#

oh ok

ocean lion
#

just type the same question over and over

hexed hatch
#

first off, do you know Java

tender shard
#

a correct question would have been "Why can I not assign an OfflinePlayer into a variable that's declared as Player" and then we could have easily told "that's because OfflinePlayer is the super class of Player"

coarse shadow
#

guys can we shade protocollib into our plugin

tender shard
hexed hatch
#

If not, learn Java first, then try making spigot plugins or forge mods

coarse shadow
#

so users dont have to download it

tender shard
#

anyway have a nice day

ivory sleet
#

but its not intended for that

mortal hare
ivory sleet
#

(like you could instantiate your own instance of its main class and invoke onEnable, onDisable etc)

coarse shadow
#

lemme check thay

heavy marsh
#

Do I need to do something with the SmithItemEvent event?
Fixed it by adding a smithing recipe

gleaming grove
#

Would it be possible to set skin from png file? Or i can only use skins assigned to official minecraft accounts ?

quaint mantle
#

Hey, how would I get all blocks in the players perspective?

balmy fox
#

The blocks in the inventory? or around him?

mortal hare
#

he means in his FOV probs

crisp steeple
#

you could just use the max fov though in whatever calculation to stay safe

subtle folio
#

is there any way to condense this to one line? java getCommand("ldsync").setExecutor(new CommandManager()); getCommand("ldsync").setTabCompleter(new CommandManager());

mortal hare
#

make a new method

subtle folio
#

alright

#

ty

#
public void registerCommand(String name, CommandExecutor executor, @Nullable TabCompleter tabCompleter) {
        getCommand(name).setExecutor(executor);
        if(tabCompleter != null) {
            getCommand(name).setTabCompleter(tabCompleter);
        }
    }
#

something along this?

#

cool cool

tender shard
subtle folio
#

{} ftw

tender shard
#

no I meant

#

for the original two lines code

#

if you removed the newline there, it would have been one line lol

subtle folio
#

oh

#

i mean

#

i guess

#

but thats bad pratice

#

for readability

#

all one line

#

crazy crates the plugin

#

for their sub commands

tender shard
#

oh you haven't seen my death chest plugin in 5 lines

subtle folio
#

they have a long ass chain of if else checks

#

for each sub command

#

instead of like new classes and a sub command manager

tender shard
#

the rule was: no more than 3 semicolons per line

subtle folio
#

is it on github

tender shard
subtle folio
#

lies

#

thats llike 22 lines right there

tender shard
#

bruh

#

read the rules in the readme

#

lol

subtle folio
#

ik ik im joking

tender shard
#

even the thread is still existing

#

we were pretty bored that weekend

subtle folio
#

WHAT IS THIS

humble tulip
#

Do u know why ppl use nms to serialize itemstacks?

subtle folio
#

bro even my wide monitor cant fit it all zoomed all the way out

subtle folio
humble tulip
#

It makes no sense to me since spigot preserves nbt

tender shard
humble tulip
#

Then to base 64

subtle folio
#

lmfao

#

md5 it next

tender shard
humble tulip
#

One sec I'll show

worldly ingot
#

Added API for this now. Though you still have to have a catalyst block in the world (at least for now). Still waiting to get merged, but should look something like this (unless it changes during the review process)

if (!(block.getState() instanceof SculkCatalyst catalyst)) {
    return;
}

SculkSpreader spreader = catalyst.getSculkSpreader();
spreader.addCursor(catalyst.getLocation(), 25); // You can put this at any location within the viscinity of the catalyst though```
#

Related note: sculk is really, really weird to wrap your head around, but it's cool

tender shard
#

i have no idea what a skulkcatalyst is

#

but it looks useful

#

thanks โค๏ธ

worldly ingot
#

It's a block that spreads sculk in exchange for mob experience

#

That's the shrieker

#

However you spell it

tender shard
balmy fox
#

How could I get a list of all the usernames so i can check if there is config information of that player?

tender shard
humble tulip
#

Since the names are at the root of the path, you just do config.ketKeys(false)

#

Did u get ur db to work?

subtle folio
#

yaml storage supremcy >

humble tulip
#

LOL

#

Just use sqlite

subtle folio
#

is sqlite flat file

balmy fox
#

So your telling me I should start using something you gave up on? xD

humble tulip
subtle folio
#

link

worldly ingot
#

Gotta sign the CLA though

humble tulip
balmy fox
#

Im justing making the plugin for my own server with some friends so this should be fine

subtle folio
balmy fox
#

Alright thanks

quaint mantle
#

How can I paste a schematic? FAWE API doesnt import for me with maven

lethal roost
#

why can't i use getItemInMainHand here?

    public void onItemDrop(PlayerDropItemEvent event) {
        Player player = event.getPlayer();
        Inventory playerInventory = player.getInventory();
        Material configMaterial = Material.valueOf(plugin.getConfig().getString("material"));

        BukkitScheduler scheduler = Bukkit.getScheduler();
        scheduler.runTaskLater(plugin, () -> {
            ItemStack mainhandItem = playerInventory.getItemIn ???```
umbral socket
worldly ingot
#

Because an Inventory is not a PlayerInventory

#

Change your playerInventory variable to be of type PlayerInventory

umbral socket
#

I'm getting a multiple root tags error

lethal roost
#

Ah i see, thx!

umbral socket
#

Can someone help?

quaint mantle
ornate patio
#

bump

umbral socket
#

Ik that's why I'm trying to make it work. On line one I'm getting an error(multiple root tags)

quaint mantle
#

you only need

<repositories>
    // REPOS HERE
</repositories>

<dependencies>
    // DEPENDENCIES HERE
</dependencies>
#

u have multiple of those, and repos in dependencies, vice versa

tender shard
#

which is called <project>

jaunty bison
#

database ?

quaint mantle
#

I use ORMLite

#

no

jaunty bison
#

I mean, depends on the data

#

stuff like tags, or data that is really only useful in game

#

PDC works for

#

item identifier

#

etc

#

player data that you might need offline or gets complex ?

#

why ?

ornate patio
#

bump bmup mubp

jaunty bison
#

that code is split up a lot ๐Ÿ˜…

#

do you have the server source ?

echo basalt
#

PacketPlayOutAnimation iirc

#

depends on what swing you mean

#

Check if the target block is null or something

#

just do a raytrace

#

if it hits a block, it's breaking

#

if it hits an entity, it's attacking

quaint nimbus
#

does anyone know how to use 9host?

simple shale
#

why do my items merge when i die, even though item merge radius is -1

subtle folio
#

what the

jaunty bison
#

smh

subtle folio
#

what do i even do

lost matrix
jaunty bison
#

import the right one

subtle folio
#

i need to use it for attributes

#

idk why

#
AttributeModifier modDamage = new AttributeModifier(UUID.randomUUID(), "generic.attackDamage", item.getDamage(), AttributeModifier.Operation.ADD_NUMBER, EquipmentSlot.HAND);

        meta.addAttributeModifier(Attribute.GENERIC_ATTACK_DAMAGE, modDamage);
        MultiMap<Attribute, AttributeModifier> modifiers = new MultiMap<>();
        modifiers.put(Attribute.GENERIC_ATTACK_DAMAGE, List.of(modDamage));
        meta.setAttributeModifiers(modifiers); //above error here
        itemz.setItemMeta(meta);```
lost matrix
#

Wut? Thats just me standing there. Was out and some weird poses. idk

lost matrix
subtle folio
#

no errors for sum reason

#

how do i set the attack damage and attack speed of an item

#

this clearly isnt the solution

lost matrix
subtle folio
#

item is an enum

#

itemz is a item stack

#

item enum contains abunch of itemz

lost matrix
#

Why do you even need this:

    modifiers.put(Attribute.GENERIC_ATTACK_DAMAGE, List.of(modDamage));
subtle folio
#

bc for some reason

#
AttributeModifier modDamage = new AttributeModifier(UUID.randomUUID(), "generic.attackDamage", item.getDamage(), AttributeModifier.Operation.ADD_NUMBER, EquipmentSlot.HAND);

        meta.addAttributeModifier(Attribute.GENERIC_ATTACK_DAMAGE, modDamage);

        itemz.setItemMeta(meta);```
umbral socket
subtle folio
#

doesnt set the attack damage properly

lost matrix
subtle folio
#

like it just doesnt work

#

does no damage lol

lost matrix
# subtle folio does no damage lol

This should be it:

    ItemMeta meta = itemz.getItemMeta();
    AttributeModifier modDamage = new AttributeModifier(UUID.randomUUID(), "cool.name", item.getDamage(), AttributeModifier.Operation.ADD_NUMBER, EquipmentSlot.HAND);
    meta.addAttributeModifier(Attribute.GENERIC_ATTACK_DAMAGE, modDamage);
    itemz.setItemMeta(meta);

Use this and see if you get the attribute tag ingame (should be visible in lore)

subtle folio
#

got it

lost matrix
#

just use a random name

umbral socket
#

any help for me?

lost matrix
umbral socket
#

yes

lost matrix
#

This is the absolute weirdest multi module setup i have ever seen

lost matrix
lost matrix
umbral socket
#

yes

lost matrix
#

Because this looks completely fked. Like someone scrambled several poms and just deleted half of the important tags.

#

This is not xml syntax

#

You cant define dependencies several times

#

The project is not closed up. The pom is just open to the bottom end

#

This is just completely fked

#

Nothing in there should ever have worked

#

My suggestion: Set up a clean pom from scratch

umbral socket
#

Ok thank you

tender shard
umbral socket
#

is it possible to compile a plugin with the following files?

echo basalt
#

that code ๐Ÿคฎ

#

yeah it's possible

lost matrix
#

First of all: This code is absolute garbage

#

I wouldnt want to get that on my server

tender shard
umbral socket
lost matrix
tender shard
umbral socket
#

yes

echo basalt
#

how tf did spigot approve that

umbral socket
#

approve what

lost matrix
#
public String player _suicide;
#

like..

#

Where is the src code? This is almost as amusing as the "terrible plugin"

umbral socket
#

My friend told me that he has got the code and wants me to compile it. but it is almost impossible for some reason

tender shard
#
  • Source code costs additional money!
#

1kk?

#

there's probably some library for that. if not, write it yourself?

lost matrix
#

Does it have to be performant?

umbral socket
tender shard
#

I don't do this at all

lost matrix
#
public static String withSuffix(long count) {
    if (count < 1000) {
       return String.valueOf(count);
    }
    int exp = (int) (Math.log(count) / Math.log(1000));
    return String.format("%.1f %c", count / Math.pow(1000, exp), "kMGTPE".charAt(exp-1));
}

This is ok

tender shard
lost matrix
#
                   0:        0
                  27:       27
                 999:      999
                1000:    1.0 k
              110592:  110.6 k
         28991029248:   29.0 G
 9223372036854775807:    9.2 E

This are the test results

tender shard
lost matrix
#

I used this for some physics stuff. Frequencies.

#

So G = Giga, T = Terra, P = Peta and so on

tender shard
#

ah ok

umbral socket
ancient plank
#

petabyte

#

yum

lost matrix
#

Then change out the suffixes

tender shard
ancient plank
#

yer

tender shard
#

haha nice

ancient plank
#

on some shitty paper

tender shard
#

awesome

#

i love it

lost matrix
#

fking birb

ancient plank
#

are u tearing apart my crappy website now

#

ngl I started using my website to host lore for my arma 3 campaigns

lost matrix
#

just read that

ancient plank
#

I don't understand the joke

wet breach
#

General kenobi the Negotiator ๐Ÿ™‚

ancient plank
#

I never watched star wars

wet breach
#

General Kenobi was given the title of the Negotiator due to his ability to prevent wars/battles without the use of a weapon

spring minnow
#

Is there a way i can get the class that called a specified method?

ivory sleet
#

context?

lost matrix
ivory sleet
#

iirc there's a way thru reflection to get the class or sth

#

might be unsafe

spring minnow
#

do you know the specific method to call to do that?

#

basically i would like to have the class that instanciated another class, for example:

spring minnow
#

in the class 1 i do new Class2(); and from Class2 i want to get class1(since that's the class that instanciated class2) instanciated without having to like adding Class1 to the constructor of Class2

spring minnow
#

idk how to explain myself, i'm italian sorry

lost matrix
#

I would strongly advise against using this for anything else than logging purposes.

ivory sleet
#

StackWalker @spring minnow iirc

spring minnow
ivory sleet
#

might exist alternatives

tender shard
spring minnow
spring minnow
tender shard
#

wait you want to get the INSTANCE of the class that called the method?

ivory sleet
#

?paste

undone axleBOT
umbral socket
#

sorry

spring minnow
#

sorry if i didn't explain well

tender shard
#

if you have an opening <project> somewhere then you also must have some closing </project>

spring minnow
umbral socket
#

I do have a closing.

spring minnow
tender shard
umbral socket
#

ah

#

I edited it, but now I'm getting a different error. Dependency 'xxx' not found

#

wait

#

maven fixed my issue

heavy marsh
#
    @EventHandler
    public void onShieldBlocksDamage(EntityDamageByEntityEvent event) {
        if (!event.getEntityType().equals(EntityType.PLAYER)) return;
        Player player = (Player)event.getEntity();

        if (!player.isBlocking()) return;
        PlayerInventory inventory = player.getInventory();

        ItemStack mainHand = inventory.getItemInMainHand();
        ItemStack offHand = inventory.getItemInOffHand();

        ItemStack shield = NetheriteShield.is(mainHand) ? mainHand
                : (NetheriteShield.is(offHand) ? offHand : null);
        if (shield == null) return;

        event.setDamage(Math.max(1d, Math.ceil(event.getDamage() * 0.3d)));
    }

Trying to reduce the amount of damage that is done to my custom shield, but it isn't taking any damage. Should I be using a different event? Or should I apply the damage to the item manually?

worldly ice
heavy marsh
#

right so I have to manually set the item damage?

worldly ice
#

the way i've gone around that is by setting the damage modifier of BLOCKING to 0

umbral socket
#

maven cannot auto download dependencies for worldedit-core

heavy marsh
worldly ice
#

im not sure if theres another way to do it

quaint mantle
#

How can I paste a schematic from local file?

worldly ice
#

from what i know, it's the only way to change how much damage reduction a player recieves

heavy marsh
#

this seems to have worked

Damageable meta = (Damageable)shield.getItemMeta();
meta.setDamage(meta.getDamage() + (int)Math.round(event.getDamage()));
shield.setItemMeta(meta);
worldly ice
#

unless you want to do some funky maths

worldly ice
#

not the shield

heavy marsh
#

oh! no.

#

I suppose if that was the case I could do something similar by just manually damaging the player

worldly ice
#

yeah, the only problem with that is if you die the death message won't be accurate

#

like if you died from fall damage it'll just say "Player died"

#

instead of "Player fell from a high place"

heavy marsh
#

hmm

umbral socket
#

maven cannot auto download dependencies for worldedit-core
I tried manually adding it but I'm getting an error Could not find artifact com.sk89q.worldedit:worldedit-core:pom:7.3.0 in dmulloy2-repo (https://repo.dmulloy2.net/repository/public/)

eternal night
#

why are you using dmulloy2

#

as your repo for world edit

umbral socket
#

maven used it

eternal night
#

I hope you have the enginehub repo in your repos as well

modest garnet
#

hey im trying to develop a "pets" plugin any idea how i can make heads float and follow the player

umbral socket
crude estuary
umbral socket
#

I downloaded worldeditc-core 7.2.9

#

added it but I'm still getting an error

eternal night
#

did you add the repo ?

#

can you show your pom.xml

umbral socket
#

I believe I haven't added the repo

eternal night
#

you have not

umbral socket
#

am i supposed to download a file from there?

eternal night
#

no ?

#

you add the repo to the <repositories> tag

umbral socket
#

what should the id be

eternal night
#

whatever

#

does not really matter

#

probably just enginehub

umbral socket
#

it worked thanks

modest garnet
#

anyway to get a wolf head?

eternal night
#

don't think there is a MHF skull for that

lethal roost
#

so i have a line here that uses whatever material the user wishes from config.yml Material configMaterial = Material.valueOf(plugin.getConfig().getString("material"));
but i want to change it so that there could be a list of materials that the code will use (so instead of just "give effect when holding diamond", it's "give effect when holding either of these items in the list"
so how would i do that?

modest garnet
#

change to StringList

then use a for loop forEach key in the String list

umbral socket
#

error while trying to compile

eternal night
#

<project> xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">

#

do you see the issue

umbral socket
#

<project not <project>

#

??

eternal night
#

ye

umbral socket
#

ty

lethal roost
echo basalt
#

if the list doesn't exist on the config, or is badly formatted, it returns an empty list

lethal roost
#

ah i see, thanks!

#

k so this matches the first element in the list of materials in my config.yml:
Material.valueOf(configMaterial.get(0)
so my list is

- DIAMOND
- DIAMOND_SWORD
- EMERALD```
and my code (using the line sent above) gives the player an effect whenever they are holding a diamond, since it gets the first element in the list

how do i make it so that if they player holds EITHER a diamond OR and diamond sword OR an emerald, they get the effect?
ornate patio
#

bump bmup pumbup bump

eternal night
#

do you have the server source ?

#

the process is rather complex

lethal roost
glass mauve
#

show how you check for the effect

#

I gonna guess and the list size isnt always 3 right

glass mauve
lethal roost
#

currently the player can configure config.yml to whatever item they want, but it's only 1 item at a time

#

i want to have the player be able to add a list of items rather than just 1

glass mauve
#

I would prob. do smth like this:

if(stringList.stream().map(s -> Material.valueOf(s)).anyMatch(material -> <MATERIAL IN HAND> == material)) {
  // apply effect
}
worldly ice
#

doesn't List have a method called contains?

#

or am i tripping

glass mauve
#

oh yea kill me pls :D

#

I thought he wants to do smth else

lethal roost
#

aight lemme see what i can do with that, thank you guys

glass mauve
#

just try to do it with contains

hasty prawn
#

stringList.contains(material.name()) tada

#

Some capitalization stuff you'll have to be careful of though

quaint mantle
#

I'm having an issue where my plugin doesn't think that my gui title and the string i've provided for the title is the same

glass mauve
#

show your code

quaint mantle
#

1 sec

glass mauve
#

๐Ÿ‘

quaint mantle
#

Lines 4 and 5 return the exact same thing

glass mauve
#

getTitle is deprecated btw

#

use title()

quaint mantle
#

ah, that could be why

#

ill try changing it

glass mauve
#

I dont think so

#

bc as you said the prints are the same

quaint mantle
#

true

glass mauve
#

but!

#

you use Paper?

glass mauve
#

this is only for paper

quaint mantle
#

Cannot resolve method 'title' in 'InventoryView'

quaint mantle
#

but i use spigot api

glass mauve
#

wait you use paper or spigot?

glass mauve
#

looked in the wrong docs

quaint mantle
#

i use paper on the server, but spigot api in the plugin

glass mauve
#

then stay with getTitle

quaint mantle
#

sure

#

no idea what could be making that return false

glass mauve
#

can you show what printed

quaint mantle
#

im testing again in a sec

#
[02:48:42 INFO]: [CieloSkyblock] ยงnCreate an island
[02:48:42 INFO]: [CieloSkyblock] &nCreate an island
#

ahhh i see

glass mauve
#

its not the same ;)

quaint mantle
#

yup didnt realize initially lool

glass mauve
#

xD

valid sorrel
#

can I cancel teleport/move event without sending teleport packet to player

glass mauve
valid sorrel
#

then it sends the player an unnecessary teleport packet

glass mauve
#

if you cancel Entity/PlayerTeleportEvent?

valid sorrel
#

which resets x/y/z/yaw/pitch to like previous tick

#

yeah

glass mauve
#

thats weird

valid sorrel
#

huh what

#

I just tried again and it doesnt

#

lemme see further...

desert tinsel
#

https://paste.md-5.net/fojexereje.xml I have that pom.xml, but when I try to load plugin it give me an error like: No goals have been specified for this build. You must specify a valid lifecycle phase or a goal in the format <plugin-prefix>:<goal> or <plugin-group-id>:<plugin-artifact-id>[:<plugin-version>]:<goal>. Available lifecycle phases are: validate, initialize, generate-sources, process-sources, generate-resources, process-resources, compile, process-classes, generate-test-sources, process-test-sources, generate-test-resources, process-test-resources, test-compile, process-test-classes, test, prepare-package, package, pre-integration-test, integration-test, post-integration-test, verify, install, deploy, pre-clean, clean, post-clean, pre-site, site, post-site, site-deploy. -> [Help 1]

worldly ingot
#

How are you building your plugin?

desert tinsel
#

with maven

worldly ingot
#

Yeah what command?

#

Or are you doing this with your IDE? If so, which one?

desert tinsel
#

yes

worldly ingot
#

That's IJ?

desert tinsel
#

IntellijIDEA

worldly ingot
#

Beyond my domain. Though you should be able to edit your build somehow to insert goals. By default, no goals are specified. You want to either clean package or clean install

#

I just have no idea how to do that because I don't use IJ

valid sorrel
#

oof

#

it looks like player teleport event changed in 1.19 or something

worldly ingot
#

Not as far as I'm aware

valid sorrel
#
  1. it doesn't rubberband players back when cancelled
  2. doesn't fire anymore when player moves wrongly
worldly ingot
#

No changes to the event since 2019

#

Mmm internal

valid sorrel
#

which first, I'm fond of

#

but second, I used to rely on it

worldly ingot
#

Very possible that the server just doesn't handle it the same way anymore

valid sorrel
#

then any ideas how to change behavior when player moves wrongly

worldly ingot
ornate patio
#

bump

sweet pike
#

i am using the IntelliJ Minecraft Development plugin and i had a question about local maven projects.

when you create a new project using the dev plugin, it also asks you to fill out your maven dependency details.

lets say you created two projects in your IDE, both with the MC Dev plugin. Both projects have their own pom and dependency details.

How would you add project 1 as a dependency to project 2 with maven?

desert tinsel
#
import me.kyllian.captcha.spigot.CaptchaPlugin;
import me.kyllian.captcha.spigot.handlers.MapHandler;
import org.bukkit.Bukkit;

public class MapHandlerFactory {

    private CaptchaPlugin plugin;

    public MapHandlerFactory(CaptchaPlugin plugin) {
        this.plugin = plugin;
    }

    public MapHandler getMapHandler() {
        String minecraftVersion = Bukkit.getMinecraftVersion();
        int mainVer = Integer.parseInt(minecraftVersion.split("\\.")[1]);
        return mainVer >= 13 ? new MapHandlerNew(plugin) : new MapHandlerOld(plugin);
    }
}``` why I have a` java.lang.NoSuchMethodError: 'java.lang.String org.bukkit.Bukkit.getMinecraftVersion()'` at `String minecraftVersion = Bukkit.getMinecraftVersion();`?
glass mauve
#

prob. getVersion()

#

@desert tinsel

desert tinsel
#

I will try

glass mauve
#

SQLite in a Plugin?

#

or SQLite generally

azure dirge
#

excuse me, but i could not find ChatMessage class in 1.19
is it removed or renamed?

humble tulip
#
public class SQLiteDatabase extends SQLDatabase {

    private final File folder;
    private final String fileName;

    public SQLiteDatabase(File folder, String fileName) {
        this.folder = folder;
        this.fileName = fileName;

        if (!this.folder.isDirectory())
            this.folder.mkdirs();

        File file = new File(this.folder, this.fileName);
        try {
            if (!file.exists())
                file.createNewFile();
        } catch (IOException e) {
            e.printStackTrace();
        }
        setupDataSource();
    }

    public void setupDataSource() {
        dataSource.setJdbcUrl("jdbc:sqlite:" + folder.toPath().toAbsolutePath().resolve(fileName));
        dataSource.setDriverClassName("org.sqlite.JDBC");
        dataSource.setConnectionTestQuery("SELECT 1");
    }

    @Override
    public String getType() {
        return "SQLite";
    }
}
#

i think i sent it for mysql

quaint mantle
#

As a Rust user myself,
It pains me to see File getting stored in an object ๐Ÿ˜ญ

humble tulip
quaint mantle
humble tulip
#
public abstract class SQLDatabase extends Database<Connection> {

    protected final HikariDataSource dataSource;

    public SQLDatabase() {
        this.dataSource = new HikariDataSource();
    }

    public Connection getConnection() {
        try {
            return this.dataSource.getConnection();
        } catch (SQLException e) {
            e.printStackTrace();
            return null;
        }
    }

    public boolean isConnected() {
        try (Connection connection = this.getConnection()) {
            return connection.isValid(2);
        } catch (SQLException e) {
            e.printStackTrace();
            return false;
        }
    }

    public void close() {
        if (!dataSource.isClosed())
            this.dataSource.close();
    }
}
humble tulip
quaint mantle
#

it is..

humble tulip
#

File is called path in java?

quaint mantle
#

no

#

File represents a file but Path is a, well path

humble tulip
#

yeah but i find it weird that File just represents the path to a file

#

and not a file itself

quaint mantle
#

well you cant really own a file

#

in every language its like that

#

either you store what the file was, or keep a reference to it

#

because files arent stored inside the language

humble tulip
#

hm that's true

quaint mantle
#

its dependent on the OS

humble tulip
#

oh btw can you help me out with reactive streams?

humble tulip
#

i'm reading here but i dont understand it

quaint mantle
#

maven local will handle the rest

humble tulip
#

if ur just working with sql, just remove that

#

it's so i can have mongo as well

sweet pike
quaint mantle
#

show the pom

sweet pike
quaint mantle
#

did you do mvn install

sweet pike
quaint mantle
#

it builds it and installs it to the local repository

glass mauve
quaint mantle
#

huh

#

just do maven install on whatever you need to be accessible

#

it handles the rest

valid sorrel
#

can I change the behavior when player moves wrongly (such as >10 blocks in one tick, through blocks, too fast)

glass mauve
#

I mean if I for example use spigot api as dependency. Doesnt maven download it from the internet

quaint mantle
#

yeah

sweet pike
quaint mantle
#

mvn install

#

thats it

#

you can press the maven button on the side of your intellij also

glass mauve
# quaint mantle yeah

and how could I upload my own project to maven so others can just add it to the dependency? never got told

sweet pike
quaint mantle
quaint mantle
sweet pike
#

oh am i supposed to remove it first?

quaint mantle
#

which one

sweet pike
quaint mantle
#

im confused

sweet pike
#

not the one i am trying to add

quaint mantle
#

where did you install

sweet pike
#

ah wait

#

nvm

#

nvm

quaint mantle
#

yeah wrong one

sweet pike
# quaint mantle yeah wrong one

Could not resolve dependencies for project dev.shreyasayyengar:rpdnd-core:jar:1.0-SNAPSHOT: dev.shreyasayyengar:purchaseclaim:jar:1.0-SNAPSHOT was not found in https://repo.papermc.io/repository/maven-public/ during a previous attempt.

rpdnd-core is my main project, purchaseclaim is the dependency i am tryuing to add

#

which is still showing as red

quaint mantle
#

do install on purchaseclaim

sweet pike
#

done, that was successful

#

now do i go back to my main proj?

quaint mantle
#

yup

sweet pike
#

oh lol ayt it worked now, it's no longer red

quaint mantle
#

should work now

#

๐Ÿ‘๐Ÿฟ

sweet pike
#

๐Ÿ˜ญ can you explain what just happened

glass mauve
#

xD

quaint mantle
#

install builds the project then puts it on your local repository

glass mauve
#

maven just weird

quaint mantle
#

nah its simple

sweet pike
sweet pike
#

it first looks into local projects, adn then tries to search globally i assume?

quaint mantle
quaint mantle
#

into a folder in your user folder

sweet pike
glass mauve
#

actually not that hard, but no one ever explained how to use maven

quaint mantle
#

it reloads dynamically

#

for intellij i think

humble tulip
#
public interface AltPlayer {

    Set<PlayerIP> getIPs();

    PlayerIP getIP(String ip);

    boolean hasJoinedWith(String ip);
    
    boolean hasJoinedWith(PlayerIP playerIP);

    PlayerIP getLastIP();

    String getName();

    UUID getUUID();

    long getLastLogin();

    void addLogin(String ip);

}

I have this interface with an implementation and I'd like changes to be pushed to the db no matter where addLogin(String) is called from. Other than passing my database class which can put the player data back in the table, what other solutions are there?

sweet pike
#

or am i completely wrong

quaint mantle
#

right

quaint mantle
#

not the entire web

#

its not that stupid

#

anyways

sweet pike
quaint mantle
#

C:\Users\YOUR_USER\.m2\repository

humble tulip
waxen plinth
#

An AltPlayer should only be a record

#

Any mutations can happen through a manager class

#

Alternatively, inject mutation callbacks into the object

#

That way the object doesn't need to actually know about the db

quaint mantle
#

^ hes trying to say, make a manager class

waxen plinth
#

But it can still carry out what you need

waxen plinth
quaint mantle
#

^ but make sure altplayer only knows what it needs to

waxen plinth
#

The second is to inject callbacks

#

Or just one in this case I guess

#

Consumer<AltPlayer> onUpdate

humble tulip
#

so addLogin(String) should be just part of the impl?

waxen plinth
#

That would probably make sense

quaint mantle
waxen plinth
#

Updating the db is an implementation detail though

humble tulip
#

hold on i gotta google these terms

waxen plinth
#

Your implementation of the interface should have a constructor that takes any dependencies it needs

#

You don't want it to have a dependency on the actual database

quaint mantle
#

anti encapsulation

#

that

waxen plinth
#

So you should pass in callbacks that perform the db update and are called when the field is mutated

waxen plinth
#

The callbacks could add a task to a queue

quaint mantle
waxen plinth
#

Ignore him

quaint mantle
#

Ignore the guy above me

humble tulip
#

ok so just to clarify, it's ok to remove addLogin from the interface and put it in the implementation only where i can call addLogin(Consumer<AltPlayer> onUpdate)?

waxen plinth
#

No

#

That should be passed to the constructor

humble tulip
#

the onUpdate

waxen plinth
#

You hold onto the consumer (callback)

#

Yeah

humble tulip
#

ok that makes even more sense

waxen plinth
#

And when addLogin is called, you call it

humble tulip
#

yep gotcha

waxen plinth
#

That way the database isn't a hard dependency for AltPlayer

humble tulip
#

ok ty

waxen plinth
#

We love callbacks

#

Anytime

quaint mantle
#

suckup

humble tulip
#

lmao

waxen plinth
#

I just like answering design questions 100x more than npe #8553368801

quaint mantle
#

i hate intellij

#

always adding stupid .iml files

errant narwhal
#

hi

quaint mantle
#

no

waxen plinth
#

?nohello when

quaint mantle
#

what would that do

errant narwhal
#

can someone help please i got this error : The method registerPlaceholderHook(String, PlaceholderHook) from the type PlaceholderAPI is deprecated when using placeholder api

quaint mantle
#

say "Saying hello is disallowed in this server."

quaint mantle
#

try CTRL + Q

#

i might have a different keybind

waxen plinth
#

You call .register() on your PlaceholderExpansion

#

If I recall

waxen plinth
errant narwhal
quaint mantle
#

?nohello

undone axleBOT
waxen plinth
#

And you just call .register() on it

ocean lion
#

hello

errant narwhal
quaint mantle
ocean lion
#

Hello imajin

waxen plinth
humble tulip
#

another question,
public record PlayerIP(UUID getUUID, String getIP, int getNumLogins, long getLastLogin){}
This is the PlayerIP record and these are how instances are stored in AltPlayerImpl
private Map<String, PlayerIP> ipMap = new HashMap<>();
When i want to modify a PlayerIP, to change last login or whatver, should i just create a new one and replace it in the map or should i switch from a record to class with getters and setters for PlayerIP?

quaint mantle
#

private final :yawb

#

kms

#

๐Ÿฅฑ

humble tulip
#

it's telling me as well

waxen plinth
#

I don't final my fields either

#

It's ok

humble tulip
#

i'll fix it later

glass mauve
humble tulip
#

i always do those when i'm done coding

quaint mantle
waxen plinth
#

Make PlayerIP a class with setters

#

It doesn't really need to be copy on write

humble tulip
#

ok!

#

tysm

waxen plinth
#

๐Ÿ‘

quaint mantle
#

target/
.idea/
Cargo.lock
*.iml
Redempt

waxen plinth
#

?

quaint mantle
#

ignore

#

git

#

forget it

humble tulip
#

using a Consumer<PlayerIP> onUpdate since the only thing that can really be updated in AltPlayer is the playerip

#

i guess i can change to a consumer<AltPlayer> if that changes

waxen plinth
#

You may want to create a separate record class that indicates what changed if that happens

#

Otherwise you'll need to update every row in the db because you don't necessarily know what changed

humble tulip
#

since that corresponds to a single row

waxen plinth
#

A manager class is a bit less elegant but it does reduce the boilerplate

#

Yeah

#

Keep it to just PlayerIP if you can then

quaint mantle
#

rust guy below me

#

ferris

crisp steeple
#

i am very mad at java for not naming the method in Consumer "eat"

quaint mantle
#

fuck java

earnest forum
#

should be consume

quaint mantle
#

no because consume usually means get rid of itself, return a value

#

i think eat would be perfect

earnest forum
#

eating returns nutrients

#

eating is good for you

#

you get something out of eating

river oracle
#

Eat<FuckingClass>

humble tulip
#

another design choice question

#

planning my plugin rn hence all the questions

#
public abstract class AltDatabase {

    public abstract AltPlayer getAltPlayerFromUUID(UUID uuid);

    public abstract AltPlayer getAltPlayerFromName(String name);

    public abstract Set<AltPlayer> getPlayersFromIP(String ip);

    public abstract void insertIPData(PlayerIP playerIP);

}
river oracle
#

why leave this as an abstract?

humble tulip
#
    @Override
    public AltPlayer getAltPlayerFromUUID(UUID uuid) {
        //get stuff and then
        return new AltPlayerImpl("name", UUID.randomUUID(), 5, new HashSet<>(), this::insertIPData);
    }
river oracle
#

ope

humble tulip
river oracle
humble tulip
#

to support multiple types of databases

#

putting data in mongo is not the same as inserting into sql

river oracle
#

but

#

interface

humble tulip
#

ohh

#

yeah

river oracle
#

considering you have 0 implementation at this level an interface is just a better option

humble tulip
#

that was just an example i typed out

river oracle
#

and yes you'd want to abstract your database layer.

#

You'd also want something like connect and along those lines

humble tulip
river oracle
#

looks good to me, but I'm not an expert

distant wave
#

Can i store in persistentdatastorage my custom class instance?

desert tinsel
#

Asynchronous command dispatch! what is that?

#

my code line is Bukkit.dispatchCommand(Bukkit.getConsoleSender(), "kick "+player.getName()+" Ai gresit captca-ul");

#

and if i want to replace it with player.kickPlayer(reason) it send me Asynchronous player kick!

river oracle
#

could it possibly be that ๐Ÿคทโ€โ™‚๏ธ its being run asynchronously

#

considering I have no clue of the implementation my gut is telling me your using AsyncPlayerChatEvent

#

and running this

glass mauve
river oracle
# desert tinsel can i solve it?

not that I'm aware of api warns of restricted uses

 The constructor provides a boolean to indicate if the event was fired synchronously or asynchronously. When asynchronous, this event can be called from any thread, sans the main thread, and has limited access to the API. ```
glass mauve
# distant wave Can i store in persistentdatastorage my custom class instance?

smth I did a few months ago:

public class PartyDataType implements PersistentDataType<byte[], Party> {

    @Override
    public Class<byte[]> getPrimitiveType() {
        return byte[].class;
    }

    @Override
    public Class<Party> getComplexType() {
        return Party.class;
    }

    @Override
    public byte[] toPrimitive(Party complex, PersistentDataAdapterContext context) {
        try (ByteArrayOutputStream bos = new ByteArrayOutputStream();
             ObjectOutputStream out = new ObjectOutputStream(bos)) {
            out.writeObject(complex);
            return bos.toByteArray();
        } catch (IOException e) {
            e.printStackTrace();
        }
        return null;
    }

    @Override
    public Party fromPrimitive(byte[] primitive, PersistentDataAdapterContext context) {
        try {
            InputStream is = new ByteArrayInputStream(primitive);
            ObjectInputStream o = new ObjectInputStream(is);
            return (Party) o.readObject();
        } catch (IOException | ClassNotFoundException e) {
            e.printStackTrace();
        }
        return null;
    }
}
distant wave
quaint mantle
#

yes

glass mauve
#

yea

#

also useful

distant wave
#

in namespaced key, first argument, can just do new Pluginname()?

glass mauve
#

isnt first argument the name?

distant wave
glass mauve
#

no first argument is the plugin

#

dont create a new instance of your plugin

distant wave
#

then how do i access it?

earnest forum
#

?di

undone axleBOT
distant wave
#

like

glass mauve
#

with static variable

earnest forum
#

di is better

glass mauve
#

im gonna stay with static variable

distant wave
#

like this?

earnest forum
#

yes

#

that works but its good practice to use dependency injection

#

also instead of making it public make a static getter

glass mauve
#

yea

distant wave
#

ok

glass mauve
#

and make it private

distant wave
#

cool thanks

eternal oxide
#

Learn DI though. It will serve you well in many instances

quaint mantle
#

Elgar

eternal oxide
#

yep

quaint mantle
#

are you a fan of rust

eternal oxide
#

Never used it

quaint mantle
#

are you a fan of it tho

eternal oxide
#

I've never even looked at it to know

quaint mantle
#
// Include a function that's defined by the VM.
// These have to be included manually, (as seen below), because we don't want the VM to cloud the namespace.
include vm_stdout_write;

// This function is ran when the VM starts.
_start:
    // Push the message to the stack.
    push "Hello, world!\n";

    // Write to stdout.
    call vm_stdout_write;
    
    // After the call to vm_stdout_write, the stack should have a new value, an i32.
    // Since the _start function should also return an i32 as the exit code, we'll just return.
    ret
#

thoughts on the frontend of my vm?

#

inspired by assembly

eternal oxide
#

I can see the similarity

quaint mantle
#

one of those comments is wrong

eternal oxide
#

Too early in the morning for me to read faint grey on black comments.

quaint mantle
#

ill help with that

eternal oxide
#

much better

eternal oxide
#

UK

quaint mantle
#

surprising

#

thought you were merican

errant narwhal
#

can someone help please

river oracle
#

?ASK

quaint mantle
#

?ask

undone axleBOT
#

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

glass mauve
quaint mantle
errant narwhal
#

i got this error using placeholder

eternal oxide
#

U keep an odd schedule

glass mauve
#

lmao

errant narwhal
#

Failed to load expansion class PlaceHolder - One of its properties is null which is not allowed!

river oracle
#

Fuck he got me

river oracle
quaint mantle
#

brain weird

errant narwhal
#

java.lang.NullPointerException: Cannot invoke "String.replace(char, char)" because "name" is null

quaint mantle
#

self explanatory once again

eternal oxide
#

um, why would stdout leave an i32 on the stack. seems wrong

river oracle
#

are you programming java without the knowledge of what null means

#

you better quit while your at it

eternal oxide
#

Having never seen Rust but I know ASM I'm going to assume an i32 is a call reference used to return to the calling function

quaint mantle
#

if it ever happens

eternal oxide
#

it uses teh stack for errors? odd

quaint mantle
#

you are assembly man

#

teach me the ways of the error

eternal oxide
#

errors in asm are sinple binary checks

#

the stack is not used

#

stack is for data (push/pop) and calls

#

well and for swopping register values

quaint mantle
#

pardon my slow typing and thinking

golden kelp
#

yo imajin

#

you rust god?

quaint mantle
#

no

#

maybe

#

decent

#

maybe something like this

_start@success:
    ret i32:0;

_start@error:
    ret i32:1;

_start:
    push "Hello, world!\n";
    uni i32 var; // unset variable
    mov var, vm_stdout_write; // mov Destination, Data
    cmp var, i32:0 // comparison of `var` and 0 (success)

    uni i32 code; // haha
    mov cat _start@success, _start@error // continue at: If True, If False
    ret code;

@eternal oxide

golden kelp
quaint mantle
#

no

#

i cry in agony

golden kelp
#

Oh

#

thats just every dev then

#

nothing special other than severe depression

golden kelp
quaint mantle
#

i made an .ass language once

#

in python

#

renamed it to stackL

#

deleted it

eternal oxide
#

looks very close to standard asm with a few tweeks

quaint mantle
#

i read like 10 pages of assembly documentation

golden kelp
quaint mantle
golden kelp
#

ill remake it

quaint mantle
#

want the syntax?

golden kelp
#

yea

#

booleans gonna be "booba"
true and false is "a/t"
errors are gonna be "RuntimeDickhead" rather than "RunTimeException"

quaint mantle
#

the syntax isnt that advanced

eternal oxide
#

my asm days were from before there were GUI compilers. we wrote mnemonics and then straight to hex.

quaint mantle
#

its called stackL for a reason

golden kelp
#

y

#

uhm imajin

#

help me out

#

i m usin python rn

return "dingus", req.json()

what will this return

#

an array of two elements?

quaint mantle
#

a tuple

golden kelp
#

explain in java terms ๐Ÿ”ซ

river oracle
#

python supports multiple return types

quaint mantle
#

(&str, JsonObject)

golden kelp
quaint mantle
#

oh

#

thats python

earnest forum
#

explain in fortnite terms

river oracle
#

for example

golden kelp
#

O

#

ty

river oracle
#
var1, var2 = function();
golden kelp
#

[] but final and unwritable

quaint mantle
#

use dict

golden kelp
quaint mantle
#

oh aight

quaint mantle
#
stack String messages_to_print;

cpt print_messages:
    copy messages_to_print -> stdout_buf;
    run stdout_flush

cpt main:
    push "Hello, world!" -> messages_to_print;
    run print_messages;

@golden kelp have a blast

river oracle
quaint mantle
#

Rust

golden kelp
#

i bet rust devs got a load of crabbitches

river oracle
#

And here I was thinking rust syntax was super fucking weird from glancing at it in the past

golden kelp
#

xd

river oracle
#

that seems semi normal

golden kelp
#

what language will get u more bishes
1๏ธโƒฃ - rust
2๏ธโƒฃ - c
3๏ธโƒฃ - js
4๏ธโƒฃ - brainfuck

river oracle
#

people who use code in JS hate themselves too much to find someone else

river oracle
#

They are busy on debating whether they should go on to actually think about getting a gf

#

their minds are busy on "Is life really worth it"

river oracle
golden kelp
#

xd

golden kelp
#

i mean NaN + 00.1 + "true" != true

river oracle
#

If i were to ever touch web dev I'd use WASM if I can't only purely use wasm I'll use Type Script to soften the pain

golden kelp
#

i use ts + react for frontend

#

and ts for backend + expressjs

river oracle
#

gross web development is too oversaturated for me to care about anyways

#

It seems like everyone and their brother wants to be a web developer

golden kelp
#

especialy on twitter

#

with that #100devs thing

river oracle
#

I rather work back end or on system administration than Web Develop

golden kelp
#

everyone is either a "10+ year experience web3 solana smart contract developer" or a "expert in html developer"

river oracle
#

Web Development Sucks why I sitll haven't gotten around to my website

#

I need to learn wasm first

#

but before I learn wasm I need to learn rust

#

eh I'll make that my project next week

#

@quaint mantle your answering all my rust questions next week

#

don't worry though I'm quite acquainted with the search engine named Google

maiden thicket
#

rust makes me cry myself to sleep

alpine urchin
river oracle
maiden thicket
#

no

golden kelp
# alpine urchin

thats so fucking smart, whoever thought of that has like 69696969696iq

alpine urchin
#

yes

grand glade
#

Hi guys, I need some info about server management. Could I remove the fallback server and re-add it? What will happen when I remove the fallback server?
I mean using ProxyServer.getServers().remove() method.

tender shard
#

sometimes I wonder how they justify the price of 499โ‚ฌ for this when it does shit like this

glass mauve
#

lmao

#

but why 499 Euro

#

is it so expensive

tender shard
#

ultimate costs 499โ‚ฌ

#

idk

glass mauve
#

WHAT

#

tf

tender shard
#

for 1 year per person

glass mauve
#

I though like 120+ or smth xD

tender shard
#

oh wait i just see, if you go to "for personal usage" then it's 150 per year

glass mauve
#

600 Euro????

#

yea

#

about 200 a year

tender shard
#

also why can't i define a constructor signature in interfaces

#

or at least declare an abstract constructor in an abstract class

#

or force a class implementing an interface or extending an abstract class that they have to "override" a certain static method

lime moat
#

sender.sendMessage(ChatColor.translateAlternateColorCodes('&', "&#084cfbY&#1256fbo&#1b60fbu&#2569fb'&#2f73fbv&#397dfce &#4287fcu&#4c91fcs&#569bfce&#5fa4fcd &#69aefcy&#73b8fco&#7cc2fcu&#86ccfdr &#90d6fdk&#9adffdi&#a3e9fdt&#adf3fd!")); how could I use gradients?

vale ember
tender shard
#

or to have a constructor that takes a Map

vale ember
#

well you can do that through documentation?

#

and if you really want you can check whether they do so with reflection, and if not, throw an exception

tender shard
#

still this requires me to use reflection to call the respective method then

#

and this could be avoided by allowing interfaces or abstract classes to declare static methods or constructors

#

I'm not asking for a workaround but why it's not possible in the first place ๐Ÿ˜›

subtle folio
#

reflection ๐Ÿ˜

vale ember
#

well, since static methods are part of the class, you should be calling them with ClassName.method() and therefore, if you want to accept Class<? extends YourInterface> as parameter you'll have to use reflection to call the method, and if you are calling the static method on the instance of the class like new ClassName().staticMethod() you can just not make it static.

tender shard
#

unfortunately it isn't and so my question was: why not?

#

it should at least allow to declare a constructor signature

#

but it doesn't and that's why I'm sad

quiet ice
#

Abstract constructors (especially in interfaces) are nonsense

lime moat
hybrid dirge
lime moat
#

Thank you! Iโ€™ll try it out :)

vale ember
# tender shard yeah I know. but if I have a method that takes a `Class<T extends MyInterface>` ...

well according to OOP definition of interface

In Object Oriented Programming, an Interface is a description of all functions that an object must have in order to be an "X".

interface defines a description of functions for the object and since static methods are not members of objects, but rather classes, then it won't make sense to allow interfaces to enforce static methods. What you are suggesting is a compile-time checks for the presence of methods access with reflection

in the specific case of serialization, in my opinion, it would make more sense to create a separate Serializer(s) and Deserializer(s) and register them for their corresponding types, like, for example in GSON

although i never worked with, i would assume that compile-time reflection checks would be possible with java compiler plugin

tender shard
#

but it isn't

tender shard
vale ember
#

constructors are special methods, and i'd rather say they are static methods

Line from JLS

Constructor declarations are not members. They are never inherited and therefore are not subject to hiding or overriding.

tender shard
vale ember
tender shard
#

anyway, I know that I cannot declare constructors or static methods in interfaces. I just say, it would be nice if it would be possible

chrome beacon
#

You could use an abstract class depending on what the goal is

grim ice
#

LMFAO

#

wtf

#

we have some kind of idiom here that goes like:
"climb the tree and get the dates. come back here who told you to climb??"

summer scroll
#

Have you add the repository?

tender shard
grim ice
#

so it make sense

maiden briar
#
SELECT *, FIND_IN_SET(rating, (SELECT GROUP_CONCAT(DISTINCT rating ORDER BY rating DESC) FROM {table} WHERE ranked = 1)) AS r FROM {table} WHERE ranked = 1;
SELECT *, FIND_IN_SET(previous_season_rating, (SELECT GROUP_CONCAT(DISTINCT previous_season_rating ORDER BY previous_season_rating DESC) FROM {table} WHERE previous_season_ranked = 1)) AS previous_rank FROM {table} WHERE previous_season_ranked = 1;

Anyone knows how I can combine these 2 queries into one? So I get 2 extra columns at my ResultSet (AS rank and AS previous_season_rank)

Note: {table} is replaced with the name of the table

grim ice
#

for static methods to not be able to be overriden

tall dragon
chrome beacon
grim ice
#

and there are some design patterns to go around that problems

tender shard
grim ice
tender shard
#

I need it to call the constructor of my serializable classes without reflection

chrome beacon
tender shard
#

and since I cannot declare that every MapSerializable has a Constructor that takes a Map, I can't do that without reflection

chrome beacon
#

Ah I see

#

Now I understand the issue

tender shard
#

I basically wanna do what bukkit's ConfigurationSerializable does, and that one has the same problems that I currently have lol

#

it also needs to call the static deserialize or the map-constructor with reflection

#

I'm pretty sure that if md5 hasn't found a better way, then I won't find any better way either lol

vale ember
#

if you don't want to be dirty, i'd suggest you something like this

public interface MapSerializer<T> {
  T serialize(Map<String, Object>);
}

Instead of having an additional constructor in the class, you put the serialization in a separate class like MyClassMapSerializer implements MapSerializer<MyClass> or even lambda expression map -> ..., and store those serializers instead of constructors, like Map<Class<?>, MapSerializer<?>>. with a method <T> void add(Class<T>, MapSerializer<T>) which will guarantee that class will match with correct map serializer

tender shard
grim ice
#

So you want to call a constructor of an abstract class after your constructor was already called and give it arguments

#

isnt that just a design problem

tender shard
#

no, I want to call the constructor of the given class that extends my abstract class