#help-development

1 messages · Page 721 of 1

lilac dagger
#

kind of

opal saffron
naive loom
#

?

young knoll
#

According to the docs Jigsaw's have their own block data

#

Called Jigsaw

kindred sentinel
#

Soo... what's differences between item pdc and custom tag

#

if the pdc is too custom tag?

sullen marlin
#

Because they made a fluid system then never actually made it useful

sullen marlin
weak meteor
#

How should manage my db interactions?

  1. OnEnable cache everything, when something changes add it, remove it, edit it in cache and then OnDisable sync it with db

  2. OnEnable cache everything, when something changes, cache it and sync it with DB and OnDisable nothing?

#

I wanna make Ranks, Sanctions, Login, etc.

#

Were talking about HikariCP

young knoll
sullen marlin
#

Don't do #1

#

You'll lose your data on server crash

young knoll
#

Generally you should be fine to just send changes to the DB right away

weak meteor
#

Okay

weak meteor
young knoll
#

HikariCP will manage the connection

weak meteor
#

okay

bold gorge
#

I have a wild theory

So I have a working menus library, but specifically everything is working but when remove item and update is called the item is removed then it's there again in the inventory
https://paste.learnspigot.com/motizifeci.java

Keep in mind everything works in a different plugin but not this.
Tested on versions 1.19.4 and 1.20.1 versions

LearnSpigot provides a free web-based pastebin service for storing and sharing code snippets with anyone. Powered by hastebin.

weak meteor
#

But lets say i mute "Player7" in Hub and when he joins Skywars, how should i fetch data? Can i listen when there's a change in DB or should i fetch data from DB when player joins?

young knoll
#

You could

#

Or you can use some kind of messaging system between the servers

orchid gazelle
#

yo any ideas ^Du hast (?<name>.+) (?<amount>\\d+)\\$ gegeben! $ about whats wrong with my regex?

thin iris
#

it’s not regexing

orchid gazelle
#

when making \\ \ it works on regex101

#

but it errors in Java

eager jacinth
#

Hello, I need some advice.

I want to make a small "banking" system, but I don't know how to do it better: 1. Separate backend server with Discord bot and web interface, and the plugin will simply send requests to the API. So, users will be able to transfer money whenever they want. 2. Do everything in the plugin.

I just want the user to be able to use the application at any time, regardless of whether the server is running or not

young knoll
#

Well if you want it to work when the server isn't running

#

Don't do it in a plugin

echo basalt
echo basalt
#

(as always)

#

There are multiple approaches to do something like this

#

Some are better than others

#

In a flawless world it's a mix of a few

#

You can:

  • Make a bungee plugin that loads the data and applies mutes globally
  • Make a spigot plugin that loads player data on join, saves it on quit (high potential for de-sync if reading is faster than writing)
  • Make a spigot plugin that loads player data on join and puts it in a low-latency cache
  • Make a bungee plugin that loads player data on join, puts it in a low-latency cache for spigot instances to read from
  • Make a spigot plugin that loads player data on join, and relays that data to other instances when transfering a player
#

What we do at work is put it in a low-latency cache that invalidates 30 minutes after the player quits

#

At some point I need to write a session manager and publish it out for free to standardize this kind of process

young knoll
#

Define low latency cache

echo basalt
#

something like redis

#

Where the write and read latency are far faster

#

but it isn't necessarily a persistent database

#

Just something temporary

young knoll
#

I assume the 30 minute period is to prevent reading it again if the player relogs right away

echo basalt
#

Something like that

#

minimizes spikes with the one idiot that has autoreconnect on

young knoll
#

lol

echo basalt
#

Depending on the application and database performance we can automatically adjust between 5 minutes and like 2 hours

young knoll
#

I was going to make a simple custom durability api today

#

I have not done that

echo basalt
#

I was gonna complete some stuff for driving school and a commission

#

done neither and I feel like shit

torn oyster
#

is there a way to keep a certain list of chunks loaded

echo basalt
torn oyster
#

or does it just load it in for a certain amount of time

echo basalt
#

forever

#

until the ticket is removed

#

or the plugin is unloaded

torn oyster
#

that sounds like it would work

#

thanks

haughty granite
#

hi, does anyone know a really good game server management panel? (except pterodactyl)

sullen marlin
#

Feel like most people use pterodactyl these days

#

AMP and Multicraft are the other big ones I know

#

Much older

torn oyster
#

how would i change the type of sapling leaves drop when they are broken/decay

orchid gazelle
#

oopsa

young knoll
#

I think decaying calls a BlockFadeEvent

#

However idk if you can control the drops from that event

orchid gazelle
#

if I have a regex like this:
^[Waffenschrank] Du hast deine (?<gun>.+) mit (?<amount>\\d+) Kugeln beladen.
^ should mean beginning of line, but I somehow suspect that it does something with the [ ]

#

is that a thing

#

?

glad prawn
orchid gazelle
#

well it's part of the string I wanna patch tho

#

the [] stuff

#

but I do not want it to do regex stuff with it

glad prawn
#

then escape

orchid gazelle
#

^\\[Waffenschrank\\] like that?

glad prawn
#

yeah

orchid gazelle
#

alright imma try

lilac dagger
#

What about screen you guys?

lilac dagger
kind hatch
#

Don't.. just don't. Screens suck

lilac dagger
#

Nope

#

I love screens

kind hatch
#

Hate them. Had to use them for the longest time and I'm glad that better things came along to replace it.

lilac dagger
#

I had names for all my screens

#

It wasn't a issue

#

I forgot which button i had to press for detach tho

hazy parrot
#

docker + portainer 😌

weak meteor
#

how would you do it?

echo basalt
#

depends on complexity and budget

weak meteor
#

And well, budget, idk what u mean w/that

echo basalt
#

Has to do with like

#

how many resources

#

y'know

#

do you have redis, mongo and influx

#

or just mysql

#

or whatever

#

So many fun things can work

weak meteor
#

Just mysql

#

wanna make the plugin simple for the user

#

and well, there's no need to be fast to code

#

just fun for me

#

thanks for the help

wet breach
#

just fyi you can use mysql like you would redis

#

as mysql does have memory only db's/tables

#

if you set it up

echo basalt
#

latency tho

wet breach
#

latency should be better and if its on the same host its a none issue

#

and if you really want low latency go with linux sockets with mysql

echo basalt
#

frosty you genius

#

wanna help me with this BS?

#

or you at work?

wet breach
#

about to head to work

echo basalt
#

rip

orchid gazelle
#

I like turtles

echo basalt
#

what the actual fuck have I encountered

#

what the actual fuck, worldedit

#

how is this able to paste fine but reading the contents is fucked

buoyant viper
#

__reserved__? duke

echo basalt
#

no fucking clue

#

this reads out as what's on the console

#

wtf is _reserved_ and why are all the coordinates fucked

#

man fuck this it's not worth the 200 bucks or whatever

young knoll
#

Lol?

echo basalt
#

apparently fawe does stupid conversions if you're on paper

#

I can't read schematic data with their own api

#

I simply won't bother

young knoll
#

Interesting

#

I haven’t tried my latest project on paper actually, so I wonder if I’ll encounter that

subtle folio
#

how do I add jpa repostories, and derived queries into my plugin similar to spring's jpa system? I know I can use hibernate ORM but how what do I use to make the queries? Or is there something that wraps this all together for me nicely?

weak meteor
#

for some reason lombok isnt working, what can i do?

#

method literally doesnt exist.

vocal cloud
#

Is the variable named CHub?

#

Or are you attempting to call a non static variable?

sterile token
sterile token
weak meteor
#

that creates

#

ig like

#

SCOREBOARD.get or smth like that

young knoll
#

That should be the correct way to do it

#

What ide are you using

vocal cloud
weak meteor
#

?paste

undone axleBOT
young knoll
#

Ah nvm

weak meteor
#

das main

young knoll
#

I know for eclipse you need to install a plugin for Lombok

#

Idk about intelij

weak meteor
#

lemme see

#

yeaa

#

that was

glossy wren
#

Yo, quick question. Is it possible to create a system like Wynncraft (model display inside barrier) without adding a huge list of locations into my plugin?

young knoll
#

Well you’ll need to track it somehow

#

You could technically track it with an entity at that location

glossy wren
#

So am I just better off making a list of locations?

young knoll
#

Mhm

#

You can reduce them into vectors if you track the world separately

drowsy helm
weak meteor
#

Everytime a runnable repeats its creating a new instance? Cause lets say i wanna do a count 1+1+1, setting up count, everytime it repeats will start count as 0 or the last value?

drowsy helm
#

It’s far more elegant

weak meteor
drowsy helm
#

If the count is in the run method scope itll reset

#

Just depends on variable scope

weak meteor
#

so

#

how should i do

#

setting it

#

out of the method

#

ye

drowsy helm
#

Is it a runnable class

#

Or anonymous

weak meteor
#
public class TitleRunnable extends BukkitRunnable {
    int count;
    @Override
    public void run() {
        Configuration cfg = CHub.getInstance().getConfig();
        List<String> strings = CHub.getScoreboard().getConfig().getStringList("scoreboard.title.animation");
        if (count >= strings.size()){
            count = 0;
        }
        for (Player player : Bukkit.getServer().getOnlinePlayers()){
            ScoreboardManager.getBoards().get(player.getUniqueId()).updateTitle(ChatColor.translateAlternateColorCodes('&', strings.get(count)));
        }
    }
}```
#

i came up with that

wet breach
young knoll
#

That was in bedrock though

#

Actually not even

#

Old pocket edition

wet breach
#

Yes but java edition had something similar too that was a placebolder

lethal coral
#

for a class name gmccommand are we thinking GmcCommand or GMCCommand

glad prawn
#

GamemodeCreativeCommand 🤓👌

#

GamemodeCreativeCmd

lethal coral
#

well I already have a GameModeCommand

#

and that would be very long 🤓

glad prawn
#

Nahh not matter

lethal coral
#

GMC is an acronym but

#

idk

glad prawn
#

You can't ignore just because it's long

lethal coral
#

GameModeCreativeCommand

#

that is probably the longest class name known to man kind

glad prawn
#

its fine lol, feel good

lethal coral
#

😭

glad prawn
#

😡😡

tender shard
#

or the item display itself

#

also what's wrong with having a huge list of locations?

lethal coral
#
        Collection<Player> playerArg = (Collection<Player>) args.get("target");
        Collection<Player> targets = playerArg;
        if (playerArg == null) {
            if (!(sender instanceof Player player)) {
                Component error = miniMessage.deserialize(
                        "<red>Console cannot use this command unless a target is provided.");
                sender.sendMessage(error);
                return;
            }
            targets = List.of(player);
        }
        if (targets.isEmpty()) {
            Component emptyMsg = miniMessage.deserialize("<red>No targets were found.");
            sender.sendMessage(emptyMsg);
            return;
        }

intellij is yelling me about this duplicated code fragment which will end up being in at least 5 of my commands and I don't know how to simplify it

tender shard
#
public static Collection<Player> getTargets(args) {
        Collection<Player> playerArg = (Collection<Player>) args.get("target");
        Collection<Player> targets = playerArg;
        if (playerArg == null) {
            if (!(sender instanceof Player player)) {
                Component error = miniMessage.deserialize(
                        "<red>Console cannot use this command unless a target is provided.");
                sender.sendMessage(error);
                return null;
            }
            targets = List.of(player);
        }
        if (targets.isEmpty()) {
            Component emptyMsg = miniMessage.deserialize("<red>No targets were found.");
            sender.sendMessage(emptyMsg);
            return null;
        }
        return targets;
}

idk something like this, then your other methods just return if getTargets(args) returns null or is empty

lethal coral
#

I like this approach better than what I was going to go for with throwing an exception and catching it

#

thanks

tender shard
#

throwing exceptions yourself is only fine if you don't wanna catch them

#

Exceptions are a wonderful thing. They can let your code recover from unexpected situations in a nice and clean way, if you use them properly. That does not mean that you should always rely on them though. For example, imagine this: Most highways have guardrails in the middle to avoid cars going into oncoming traffic....

#

you can also think about using a command framework like ACF that automatically handle this for your

#

e.g. ACF allows you to declare a method like this

public void onCommand(CommandSender sender, Player... targets)

and then it will only only "player names" as args and create an error message itself

drowsy helm
#

acf on top

lavish flower
#

can anyone link some plugins that use gradle and implements a SQL database? never used a SQL database in Spigot (or Java) previously, looking to do some digging into how it's implemented :)

sullen marlin
#

Gradle and spigot are irrelevant

#

SQL is built into java

#

Any tutorial should do

lavish flower
#

thank you, I'll do some more research on that :)

floral drum
torn oyster
#

how would i change the sapling type a leaf drops

#

I have fancy tree schematics with different types of leaves

#

But I want the game to be practical too and I want them to drop oak saplings

#

Is there a way to do that

quaint mantle
#

anyone know the uh

#

entityId list

#

for 1.8.9

#

whatever

#

just uh link plase

lethal coral
vale knoll
#

I am trying to change the text of a TextDisplay using the .setText() method. However, anything I put into that method becomes this:

#
text:'{"extra":[{"text":"This is a test"}],"text":""}'
sullen marlin
#

/Version?

#

Sounds like a bug but I would expect it to have been reported by now

#

?jira

undone axleBOT
vale knoll
#

Here's my code:


if (command.getName().equalsIgnoreCase("createEntity")) {
            if (sender instanceof Player) {
                final Player player = (Player) sender;

                final TextDisplay textDisplay = player.getWorld().spawn(player.getLocation(), TextDisplay.class);
                textDisplay.setText("This is a test.");

                // Show a particular entity
                if (!entityHider.getMembership(player, textDisplay.getEntityId())) {
                    entityHider.setMembership(player, textDisplay.getEntityId(), true);
                }

            }
        }
sullen marlin
#

You made it sound like that's what the actual text looks like

ember flicker
#

ho

#

@sullen marlin ping sorry dear

#

helping pls?

remote swallow
#

ask ur question

ember flicker
#

how to vote shop vip click gui download sent?

remote swallow
#

what

ember flicker
quaint mantle
ember flicker
#

balance /goldshop

remote swallow
#

ur just saying words, explain ur issue with what isnt working and what you want to happen

ember flicker
remote swallow
#

you want a plugin that has /goldshop that does something?

remote swallow
#

?services

undone axleBOT
remote swallow
#

are you just pressing the middle type complete on mobile

#

bc your just saying words that dont make sense

tall dragon
remote swallow
#

kek

vale knoll
#

If I wanted a player to be able to run my command, and pass in an entity, such as a TextDisplay, how would I parse a selector (@e[type=text_display])?

sullen marlin
#

?jd

undone axleBOT
vale knoll
#

How would I add a tag to a entity with a plugin?

vale knoll
#

This seems a bit convoluted. For clarification, I am looking to do the same thing as /tag add ingame, but through a plugin instead. Additonally, being able to check an entity for tags would be nice.

lost matrix
# vale knoll This seems a bit convoluted. For clarification, I am looking to do the same thin...

The proper way are PersistentDataContainers as they can hold keys+values which greatly improves the
usability of your tags. If you want a simple ScoreboardTag then you can call
Entity#addScoreboardTag(String)
https://hub.spigotmc.org/javadocs/bukkit/org/bukkit/entity/Entity.html#addScoreboardTag(java.lang.String)

rough drift
#

Is the overworld / world where all the player data is stored always the first loaded world? (so Bukkit.getWorlds().get(0))

vital sandal
#

I need help in serializing datas :l

#

it is kinda complex object

torn oyster
#

is there a limit to how many entities can target a player at once?

rough drift
#

no afaik

torn oyster
#

i am doing a wave-defence sort of game

#

and every second i set all entities targets to the nearest player

rough drift
#

each entity manages it's own target and no other class is told about it

torn oyster
#

but some just like to wander around

rough drift
#

well other classes can know about it

torn oyster
#

i can have up to like 60 entities at once

#

would something be interfering idk

#

it didnt happen when the server started up, but as more mobs were introduced more started to wander around

#

i might try LivingEntity.setAware()

vestal hill
#

I have a question.
I would like to know how many zombies are in the World, but I don't know how to do that.

hybrid spoke
rough drift
quiet ice
#

That is possible?

#

?jd-s

undone axleBOT
quiet ice
#

Welp - apparently so

hybrid spoke
#

apparently

#

didnt knew either

rough drift
#

Quick 5s in IntelliJ

vestal hill
rough drift
#

np

timid hedge
#

Can someone please help me, i am trying to do so the skull is in the middle of the end portal frame and so it is in the "normal" high, the picture to the left is how i want it, and the picture to the right is how it is right now

    @Override
    public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
        if(label.equalsIgnoreCase("vps")) {
            if (!(sender instanceof Player)) {
                sender.sendMessage("Kun spillere kan gøre dette.");
            } else {
                Player player = (Player) sender;

                Block targetBlock = player.getTargetBlock((Set<Material>) null, 5);
                targetBlock.setType(Material.ENDER_PORTAL_FRAME);

                Block aboveTargetBlock = targetBlock.getRelative(0, 1, 0);
                Block blockBlock = player.getWorld().getBlockAt(aboveTargetBlock.getLocation());
                SkullCreator.blockWithBase64(blockBlock, "eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvZjgyMjAyODJmMmVlNTk5NTExYjRmYzc0NjExMWM5NzM2ZDdiNDkxZThiY2ZiNjQ4YThhMTU2MjkyODFlZTUifX19");
                player.sendMessage("Blocken blev ændret til en vagtpost.");
            }
        }
        return true;
    }

https://i.imgur.com/as5jvOv.png

rough drift
#

the right one is using an armor stand

smoky anchor
#

Does the SkullCreator.blockWithBase64 change the material type ?

#

also, Block blockBlock = player.getWorld().getBlockAt(aboveTargetBlock.getLocation()); is completely redundant
just use aboveTargetBlock

humble heath
#

i am looking for like minded coders to work on a project for fun any one up for it

smoky anchor
orchid gazelle
#

I got enough projects on my mind

humble heath
#

where would i post it then

orchid gazelle
#

(And from experience I can say you 99% won't get anyone actually good and active work on it with you by asking strangers)

timid hedge
timid hedge
smoky anchor
#

the left one is skull placed on wall, the right one is skull placed on floor
Ok, so you're using SkullCreator by deanveloper

humble heath
#

can anyone plz help

smoky anchor
humble heath
#

thanks that is realy helpfull

smoky anchor
#

your fault for running paper and asking for help in spigot server....

smoky anchor
#

Also, what version are you running

timid hedge
undone axleBOT
#

Can't send images? That's because you're not verified! Use !verify to complete verification.
Alternatively, you can upload screenshots to any image hosting site and share the link.

Here's some screenshot utilities that can use to upload images.
Lightshot: https://prnt.sc
Imgur: https://imgur.com/upload
Flameshot: https://flameshot.org

smoky anchor
#

I don't know what it's called in 1.8.9 nor where it is...

timid hedge
smoky anchor
#

ye the first one

timid hedge
#

What here?

glad prawn
#

you again 💀have you done your basic Java

timid hedge
glad prawn
#

yes xd

smoky anchor
#

Ok ye
I'm gonna guess that you're using this SkullCreator (and it does look like it)
1.8.9 is not supported

timid hedge
#

Ohhh.. i didnt see that

smoky anchor
#

honestly surprised it didn't shit itself when you ran it

orchid gazelle
#

It probably did

timid hedge
#

Do you know another skullcreator method i can use where i can place a skull with a value and place it as i want?

orchid gazelle
#

He just haven't smelled yet

timid hedge
woeful wind
#

Can someone who knows about plugins help me?

smoky anchor
#

im too braindead to understand this rn lol
But it probably did do something

glad prawn
#

uh <1.13 use SKULL_ITEM

#

idk SKULL or SKULL_ITEM

#

both lmao

smoky anchor
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!

smoky anchor
#

?1.8

undone axleBOT
woeful wind
#

I have a kitpvp plugin, which I downloaded and am using, but its configuration is in a jar, I can't modify it using yml, I wanted to know if updating it in Java would be very difficult or not

smoky anchor
#

Sorry, I don't use this old versions.....

jaunty shuttle
#

Does anyone know how to remove invisible armorstands, they are there for spectators

smoky anchor
#

what are you using them for and for what version

smoky anchor
#

maybe?

#

Or are you asking to change the plugins code

woeful wind
#

i want change the plugin code

jaunty shuttle
smoky anchor
#

sorry for confusion, what are you using the armorstands for :D

jaunty shuttle
#

we dont use them

#

they are there with the minecraft spectator mode

#

we want to delete them

grizzled sable
jaunty shuttle
#

in the minecraft spectator mode are sometimes invisible armorstands

#

above playerheads

smoky anchor
#

Well the armor stands have to be spawned for the spectators to see them
so you seem to be using them...

#

maybe a different plugin is doing that ?

jaunty shuttle
#

mhm we have to check that, i dont think so but we wil lcheck it

smoky anchor
#

a picture might help btw

#

?img

undone axleBOT
#

Can't send images? That's because you're not verified! Use !verify to complete verification.
Alternatively, you can upload screenshots to any image hosting site and share the link.

Here's some screenshot utilities that can use to upload images.
Lightshot: https://prnt.sc
Imgur: https://imgur.com/upload
Flameshot: https://flameshot.org

woeful wind
wet breach
#

Makes it a bit redundant

grizzled sable
smoky anchor
#

Link us the plugin please

#

and tell us what you want to change

woeful wind
wet breach
woeful wind
#

i can't send .jar files

grizzled sable
smoky anchor
#

the Spigot website if possible

torn oyster
#

can anyone help

woeful wind
smoky anchor
#

well you had to download it from somewhere

woeful wind
wet breach
smoky anchor
torn oyster
#

or should i do it just once

#

is there a way to make them not change target

smoky anchor
woeful wind
#

i have the link

#

1 sec

woeful wind
wet breach
# torn oyster is there a way to make them not change target

Generally if you set the target to a specific player as opposed to nearest it should probably help with that. So might have to implement your own detection for nearest. Also may have to resort using scheduling to update entities so that you are not trying to do too many things in a single tick and lets the server spread that out over a few ticks if necessary and not be missed.

jaunty shuttle
smoky anchor
#

Are those NPCs ?

jaunty shuttle
#

yeah but its above playerheads too

#

thats a player, there are 2 armorstands 😄

smoky anchor
#

Unless you specifically coded it so that happens, it is a different plugin doing that shit.
The NPCs I get, it is not updated for TextDisplay

jaunty shuttle
#

mhm

#

maybe Citizens, we work with that becaue of NPC´s and the Skins of them

#

we will check it, write again in a few minutes

torn oyster
woeful wind
#

Does anyone have the time to tell me how I modify a .jar

chrome beacon
woeful wind
#

scoreboard name for example

chrome beacon
#

I recommend opening the jar with Recaf 3 then

#

You can use the bytecode editor to change the text

torn oyster
chrome beacon
#

Would probably be faster to just tas

#

?tas

undone axleBOT
vernal marsh
#

Hello, I have a question. Does anyone know a way to sort players in the tab list without having access to the scoreboard and teams?

chrome beacon
#

You can change the player names

#

but you probably don't want to do that

vernal marsh
#

Yes, it would be best if the player name stays the same. I just want to sort them according to roles but don't want to use teams for that either.....

smoky oak
#

what's the event fired when you drop an item with q?

chrome beacon
crystal swift
#

Hi does anyone know how I can use player.launchProjectile to shoot 3 arrows with flame?

chrome beacon
#

Call the method 3 times

#

and set the fire ticks of the arrow

crystal swift
wet breach
#

as far as I am aware the default order of the list is by connection, that is whoever connects first is higher up in the list

#

you can however use that packet to sort that list and send it to clients, as well as have per player ordering

chrome beacon
crystal swift
#

Can you send me example code maybe?

chrome beacon
#

launchProjectile(Arrow.class)

crystal swift
#

why .class?

chrome beacon
#

Because it wants the class

crystal swift
#

so i cant just create an item stack?

rough drift
#

no

#

An ItemStack is not an Entity

#

ItemStacks are for items in an inventory

crystal swift
#

Ty

#

Can you maybe explain me how i can do this arrow.class?

vernal marsh
# wet breach you can however use that packet to sort that list and send it to clients, as wel...

I've already tried the package to change the list of players but I didn't get any results. I used this method from Paper but no matter how I arrange the players in this list the tablist stays the same.....

    public ClientboundPlayerInfoUpdatePacket createPacket(List<ClientboundPlayerInfoUpdatePacket.Entry> entries) {
        EnumSet<ClientboundPlayerInfoUpdatePacket.Action> enumSet = EnumSet.of(ClientboundPlayerInfoUpdatePacket.Action.UPDATE_GAME_MODE, ClientboundPlayerInfoUpdatePacket.Action.UPDATE_LISTED, ClientboundPlayerInfoUpdatePacket.Action.UPDATE_LATENCY, ClientboundPlayerInfoUpdatePacket.Action.UPDATE_DISPLAY_NAME);
        return new ClientboundPlayerInfoUpdatePacket(enumSet, entries);
    }
rough drift
#

player.getWorld().spawnArrow(start, direction, speed, spread);

start - A location
direction - A vector
speed - A float (Like 1F)
spread - How much should the arrow deviate? A float (Like

chrome beacon
#

^^ that would work too

rough drift
#

@crystal swift what do you want to achieve

wet breach
crystal swift
rough drift
#

There's an event called ProjectileLaunchEvent

crystal swift
#

ik

rough drift
#

Check if the launched projectile is an arrow and the shooter is a player, if so use the scheduler to spawn two extra arrows after some time

vernal marsh
wet breach
#

the packet takes an array of UUID's

#

you have to the modify this array, to sort the UUID's in the order you want

#

just so you know, there is 2 arrays

#

its Array(UUID(Array Actions))

vernal marsh
#

There is no array in the package that I have open, which package do you mean exactly

wet breach
#

I don't know what you mean by package, I am talking about the packet itself

#

if whatever you are using doesn't allow you to do this, you may just need to modify the packet yourself

vernal marsh
#

i use the ClientboundPlayerInfoUpdatePacket 😅

#

from paper

wet breach
#

well this is spigot

#

as far as I know you should be able to just modify/send packets that you want by hooking into the network manager

#

if you are wanting to use paper, then it may be wise to move to their discord where they can help you with paper specific things

#

and not be here where its spigot specific things

wet breach
#

a way to describe the direction of a thing

eternal oxide
#

Imagine you are pointing your finger at the sun. the direction of your finger is the vector.

rough drift
# crystal swift What is a vector 😭😭

A vector is a collection of 3 numbers, or x, y, z, you can create a vector like so: new Vector(x, y, z);.

You can also obtain a vector from a location in two ways:

Location#getDirection gets the rotation of a location as a vector, without position
Location#toVector creates a vector from this location, without rotation

vernal marsh
echo basalt
#

I got this on my bookmarks

rough drift
#

for example, to get where the player is looking, you can use:

somePlayer.getEyeLocation().getDirection()

rough drift
echo basalt
#

Normalizing a vector is just scaling it down to a length of 1

rough drift
#

Multiplying a unit vector just multiplies it's x, y and z by that number

echo basalt
#

To set a vector's length, you normalize it and multiply by the new length :)

#

It's not that complicated

rough drift
#

yep

#

Just going in for the easier explanations you know?

wet breach
#

if you want to stick with math related terms 😛

wet breach
rough drift
#

Ah fair

#

Anyways, you know that feeling of rewriting a good chunk of your plugin because you got a better idea while the plugin itself was working 💀

echo basalt
#

well

#

that's the cycle of development

#

you write something

#

learn the flaws in your design

#

and rewrite it all

rough drift
#

it wasn't even flawed

echo basalt
#

btw ike did you also get an email from socks management?

rough drift
#

I just kinda felt like making it more customizable

eternal oxide
#

Then throw it all away and start again

rough drift
echo basalt
#

had a hr manager reach out to me

rough drift
#

what email

#

I'll check

echo basalt
#

might be because you're still underage and can't sign contracts

#

they're like rebuilding the team or something

rough drift
#

yeah dm me the email

#

I might've missed it

echo basalt
#

it was just a basic "my name is xyz and I'm reaching out because I have a few questions, add me on discord"

rough drift
#

hm

wet breach
#

totally doesn't match any spam filters with that

#

you know like your every day scam email XD

rough drift
#

fr

echo basalt
rough drift
#

I don't think I've received, and if I did they managed to put it in spam ¯_(ツ)_/¯

echo basalt
#

they did have my first name

#

so I know it was legit

rough drift
#

welp

echo basalt
#

I got their discord elsewhere because the tag on the email didn't work and everything checked out

#

then they told me they didn't have any positions for me and to basically fuck off

rough drift
#

LMAO

#

I am multitasking

#

12 IntelliJ windows

echo basalt
#

happens

rough drift
#

Yes

#

I am on 6 deadlines

echo basalt
#

oo

#

it's one of those weeks ok

rough drift
#

No, it's one of those months

echo basalt
#

I quit a project last night because I spent too much time and worldedit was fighting me

#

so now I'm only facing 3 deadlines thumbsup

rough drift
#

damn lucky ass

echo basalt
#

lucky ass

#

my ass

rough drift
#

I am pressured on all sides lmao

echo basalt
#

haven't worked on a small project in so long

rough drift
#

neither have I

rough drift
#

I got 3 work deadlines, 4 deadlines in my disc, got to mad train for a FIDE tournament in 4 days and have to try and use duolingo more 💀

echo basalt
wet breach
valid burrow
#

just invent a atom replicator to clone yourself 10 times

#

honestly i would still not finish

#

in time

rough drift
wet breach
#

just throw all your pawns out there, you should be fine 😉

rough drift
#

🥹

smoky oak
#

someone mentioned to me to not complie but run code from the IDE directly. Is there an explanation as to what that is or how to do it?

lost matrix
#

Just add a run configuration that starts your server. Intellij will do the rest in terms of
detecting if exceptions belong to your project. Thats the simplest approach-

chrome beacon
smoky oak
#

that looks like i still need to build it though?

#

is it just that it doesnt need a reload or smth?

lost matrix
#

You dont need to recompile for small changes.

#

Adding new methods, classes etc still needs a recompile.

smoky oak
#

ah

#

lright ill just keep remote debug then

#

so that if my IDE crashes again the server aint going down with it

#

on an entirely different topic, does anyone know why i cannot hear any sound using this command
/playsound minecraft:entity.ender_eye.deathrecord master @a ~ ~ ~ 1 1.5

smoky anchor
#

are you running it from chat ?

smoky oak
#

yea

lost matrix
#

did you disable your master volume?

smoky oak
#

no

#

only the music cuz i want my own background music

#

and i can hear other sounds

#

like me walking around on the floor

smoky anchor
#

is that even a real sound effect ? the "deathrecord" sounds weird

smoky oak
#

someone clearly forgot a space giving me that command

#

thanks

smoky anchor
#

---__---

smoky oak
#

irritating that its not like 'sound doesnt exist' but just doesnt do squat

smoky anchor
#

ye I would have expected that to pop up...

#

or at least maybe a warning message in client console ?

smoky oak
#

no

#

its like 'yea this sounds correct'

#
Moterius issued server command: /playsound minecraft:entity.ender_eye.deathrecord master @a ~ ~ ~ 100000 1.5
[15:20:52] [Server thread/INFO]: [Moterius: Played sound minecraft:entity.ender_eye.deathrecord to Moterius]
smoky anchor
#

client console

smoky oak
#

are sounds handled 100% client side or something

#

nothing there

lost matrix
young knoll
#

Yes sounds are client side

echo basalt
#

not all of them

young knoll
#

Resolving is

#

The server just says “hey play this sound”

#

And the client figures out the rest

echo basalt
#

well

#

reason why playsound doesn't trip at you is because resource pack sounds are a thing

young knoll
#

yes

#

The server has no idea if a sound with that namespace exists or not

#

So it just yolos a packet to the client

smoky oak
#

noted

#

ill just double check everything i get manually

alpine swan
#

in a plugin, if you perform an action which would call a listener (eg: player.attack could call entitydmagebyentity), will all the listeners be ran immediately, or will they be ran after the block of code (method) from the first plugin

i know that with callevent() it runs immediately but i dont know about this

young knoll
#

immediately

alpine swan
echo basalt
#

immediate I'd say

#

A calls event
Listener 1 runs code
Listener 2 runs code
Listener 3 runs code

A checks if event is cancelled
A does coolmath if event is not cancelled

shadow night
young knoll
#

It's all single threaded

echo basalt
#

yeah

#

or wlel

#

it all runs in the same thread

shadow night
young knoll
#

Minecraft isn't all single threaded

alpine swan
echo basalt
#

yes

young knoll
#

yes

shadow night
alpine swan
#

alr

#

just 1 more thing

echo basalt
#

Here let's fuck around and find out

young knoll
#

Worldgen is multithreaded, yes

#

Chat is also it's own thread (Or at least it was before the chat reporting update? idk if it still is)

echo basalt
shadow night
#

Do hurt target

echo basalt
#

nah

#

not that

#

if this is an nms player, do the nms attack

alpine swan
#

what would you expect to be more intenvive, searching for nearby entities within a 4 block radius, or doing a 3 block raycast (i can either raycast straight away or do a nearby entities check first)

ik neither are very intensive at all but im talking about doing like up to 1000 per second (over multiple ticks ofc)

echo basalt
#

bros got no clue how big his scale is

shadow night
#

1000 per second?

alpine swan
#

i dont really know what scale of stuff i can get away with in java

echo basalt
#

measure them both and come out with your own conclusions

young knoll
#

I would imagine just raycasting is better

#

But who knows

shadow night
young knoll
#

There's a framework for that

shadow night
#

I wonder what those 1000 per seconds are for

young knoll
#

Minigun

#

Oh wait no guns

#

Uhh

shadow night
#

No guns?

young knoll
#

Miniwatergun

shadow night
#

Lol

#

European alternatives

young knoll
#

Yeah Mojang doesn't like guns

shadow night
#

Wait

#

That's genius

#

Just say those are medieval weapons and not guns

#

Or it's waterpistols

young knoll
#

Or just go scifi

shadow night
#

And the hearts are actually how wet you are

young knoll
#

Laser gun

shadow night
#

Lol

shadow night
#

And when you have no hearts you "lose", you don't "die"

#

Guys, we are making a guns server

alpine swan
#

(no im not making an anticheat)

young knoll
#

Well

#

What are you making

#

This may be an xy

shadow night
#

Yeah, I thought the same too

alpine swan
shadow night
#

maybe there is, who knows

alpine swan
shadow night
#

Well, ¯_(ツ)_/¯

young knoll
#

I still doubt it

#

The animation event is basically just arm swing

#

Which also fires interact event

smoky oak
#

List<Location>[] projections = new List[12 * 20];
I'm... not having a good time right now lol

#

is there a better way to store an ordered list of lists

young knoll
#

I mean

#

You can do List<List>>

smoky oak
#

that gets eaten by method signatures

young knoll
#

But generally it's better to make a data class than to nest collections

smoky oak
#

List<List> is the same as List<>

#

this is my data class

young knoll
#

Time for another data class

#

OR you can just stick with the array

#

It's not the worst thing ever

smoky oak
#

oh ffs auto import
import javax.xml.stream.Location;

#

can i be like 'prioritize bukkit and spigot imports'

young knoll
#

Ah we love auto import

woeful wind
#

Can anyone help?
for (PotionEffect effect : battleplayer.getActivePotionEffects()) { battleplayer.removePotionEffect(effect.getType());}
error: 94: incompatible types: java.lang.Object cannot be converted to org.bukkit.potion.PotionEffect

young knoll
#

Gonna need more than that

#

Maybe an image

#

?img

undone axleBOT
#

Can't send images? That's because you're not verified! Use !verify to complete verification.
Alternatively, you can upload screenshots to any image hosting site and share the link.

Here's some screenshot utilities that can use to upload images.
Lightshot: https://prnt.sc
Imgur: https://imgur.com/upload
Flameshot: https://flameshot.org

chrome beacon
#

You need to provide all the libraries or it won't know what the methods are

woeful wind
chrome beacon
#

Save in the bytecode editor

#

Then export

#

Don't save in the code editor

smoky oak
#

question about class instances: The methods only exist once, and all the instance-specific fields once per instance, correct?

young knoll
#

yes?

smoky oak
#

k

young knoll
#

That's a very confusing question

smoky oak
#

ah well

#

i have a 'shape' class which contains a list of locations

#

idea was to just throw back a list of shape instances

#

but if the methods bloat it I'd just throw in a mergeShape method

#

@see NullShape#mergeVertexList(List)
This doesnt seem to work properly, can someone give me an @see example pointint to a method that has a list in its signature?

#

oh wtf

#

it needs to be on newline???

#

ah yea thats how annotations work

#

i need sleep

kindred sentinel
#

how to get if there are any numbers in string?

young knoll
#

Regex can help there

kindred sentinel
#

kk

smoky oak
#

[0-9]+ i think

kindred sentinel
#

i found this "

.*\\d.*

"

smoky oak
#

thats digit

#

works too

kindred sentinel
#

is itemMeta could be a null?

#

like if i'm trying to do new ItemStack(Material).getItemMeta()?

#

would it be a null?

young knoll
#

Only if the material is air

remote swallow
#

if the item is air yes

kindred sentinel
#

oh ok thanks

quaint mantle
#

What is Block#setTypeIdAndData deprecated in favor of?

young knoll
#

setBlockData I imagine

quaint mantle
#

oh

#

nvm

topaz cape
#

how do you deserialize a chat component when getting a message json through protocollib?

#

because i just want the message the player receives in chat

thin iris
#

how do i get the direction behind a certain player

smoky oak
thin iris
#

i want to push the player backwards

young knoll
#

Get their direction and multiply by -1

smoky oak
#

maybe zero the y component

#

or you might launch em

young knoll
#

You'll need at least a bit of y velocity

#

Otherwise friction will heck you

lilac dagger
#

text components are not really json

#

at least i think so?

young knoll
#

They are

topaz cape
lilac dagger
#

i see

kindred sentinel
#

Is it possible to make something like split but every 10 letters?

lilac dagger
#

substring

young knoll
#

Or regex

lilac dagger
#

or getChars

kindred sentinel
#

Like i have a string "123456789"
and i want an array ["12","34","56","78","9"]

young knoll
#

Or manual looping over the strings char array

kindred sentinel
#

oh ok

river oracle
#

you can turn string into char arrays using String#toCharArray

glad prawn
#

split \d{1,2} ig

kindred sentinel
#

i did
for(let i = 0; i < 2; i++){
list.add(String.substring(i*2))
}

glad prawn
#

why

kindred sentinel
#

idk

#

why not?

remote swallow
#

the fook is let i

kindred sentinel
#

oh

remote swallow
#

also that wouldnt work

kindred sentinel
#

it from js

#

sorry

#

int*

lilac dagger
#

use substring start end

glad prawn
lilac dagger
#

or use regex

kindred sentinel
#

hmm but yeah it would be better

river oracle
#

this is such a basic thing to do you just need to be-able to do it for the sake of learning the logical thought process

glad prawn
kindred sentinel
river oracle
#

then take a break before you code :P give your brain a rest if school is challenging

kindred sentinel
#

sooo i I just wanted to know if there is, in principle, a similar method in java without regex or loops

glad prawn
#

but you ll split what

lilac dagger
#

yes substring with start and end argument

glad prawn
#

digits or something

smoky oak
#

javadocs can crash install???

kindred sentinel
#

thanks

alpine swan
#

why does minecraft sometimes decide not to send a cancel digging packet

wary harness
#

What would be better logic to handel itemshop which has limited stock items
so some item can be bought 10 times and when it is sold it will restock after specific amount of time
so now I am thinking making check with for loop which will go thru all items in shop and check do they need to be restocked
code will be executed on specific delay like 1 sec and I think that would be bad
or make it so check is made when player opens shop or when they do /shopfastbuy <itemname> <amount>
thing is stock amount has placeholder which should be updated if item gets restocked
so if I do it only when player opens gui shop and item get restocked few sec leter placeholder will not be update
thing is I got stock limit per-player and global
so would it be to intensive if I do update once a second thru all items because they could be a lot of items in multiple gui shops
I really don't have inspiration and idea how to make this code logic
Thanks for reading my book 🙂

vast raven
#

In order to use ChunkSnapshot#getHighestBlockYAt(int,int) and it uses ranged coordintaes from 0 to 15, I've tried using module operation, but sometimes the operations produces a wrong result

chrome beacon
#

?nocode

undone axleBOT
#

It’s hard to answer a programming question without code
Oh no! You ran into a problem. But no worries, people are willing to help, but first they need to see your code. This is because otherwise, they would be providing help based on guesses instead of concrete knowledge. Whether it be a compile error, runtime error, or an unexpected output, I'm sure that if you were to provide code, you'd receive a quick solution.

vast raven
#

?paste

undone axleBOT
vast raven
#

in theory the solution is to create a new location object and using the snapshot chunk coordinates times 16

chrome beacon
#

Making a snapshot like that is redundant

vast raven
#

can it be run asynch isn'tit

chrome beacon
#

And if you're only going to grab the top location that's going to be slower

vast raven
#

let me explain

#

I'm inside a synch task since recent version reduced asynch operations, and I need to apply a disease to a player if it is exposed to rain, this is for each task tick

#

I can def increment the task period but I still have the same problem, it can cause lag

chrome beacon
#

Getting the top block is actually quite efficient

young knoll
#

^ It's stored via heightmap

chrome beacon
#

No need to async

#

You're just going to cause more lag

vast raven
timid hedge
#

?paste

undone axleBOT
vast raven
#

actually I can just get 1 block, since a player can be covered with the second top block, it won't work

#

so I would need either to iterate throught player top blocks

young knoll
#

what

chrome beacon
#

Did you just ignore the method you yourself used a moment ago

chrome beacon
#

No need to loop anything

vast raven
#

one of my friend suggested me to

#

but it would cause lag either so I have no clues

timid hedge
#

Can someone please help me with this problem
The skull isnt being the skull i want, its a skeleton head not the orb head i want and the skull is being placed 2 blocks too much to west and north
Code: https://paste.md-5.net/hesiretisa.java

chrome beacon
#

?conventions

young knoll
#

Yeah you can't just set the owner to a base64 string

timid hedge
chrome beacon
#

Spigot 1.18.1 added the new PlayerProfiles class, which finally allows us to use custom heads without needing any reflection! You can obtain them as normal items, or actually place them down into the world. I’ll show you how both works: Creating a new PlayerProfile First, we gotta create a new PlayerProfile object. To do so,...

young knoll
#

They are on pre 1.18

chrome beacon
#

Yeah 1.8

#

iirc

timid hedge
young knoll
#

You need NMS then

glad prawn
#

btw that dude using 1.8.9

chrome beacon
#

.8* but yes

#

I'm aware

timid hedge
#

I do use 1.8.9 but i dont want to create a skull i got the skull im just wondering why it isnt the right skull that is getting placed

young knoll
#

Because

vast raven
young knoll
#

That method requires a valid username

timid hedge
#

But look at this "String skullValue"

private void placeSkullOnTop(Player player, Block endPortalFrame, String skullValue) {
young knoll
#

That is not a spigot method

#

Just because you call the paramater skullValue won't magical make it accept a skull value

timid hedge
#

Okay but if i am using a username that wouldnt still fix the problem with it isnt placed correct

chrome beacon
#

It would if just the texture is the problem

young knoll
#

Wait why are they making an item and then using that to place the skull

#

what

chrome beacon
#

They have no idea what they're doing

#

We've given the learn java command 30+ times

young knoll
#

Did you try the version with !

chrome beacon
#

What you're seeing is a mix of spoon and copy pasted code

quaint mantle
#

Is there a DataWatcher field for baby zombies that would prevent them having amror?

#

it really should be sending us the armor but it seems to be super buggy, only shoiwng certain pieces or none at all

chrome beacon
#

You can probably listen for when the data is sent

#

and stop it or replace the information

valid burrow
#

is there a way i can stop mobs from growing up without cancelling their growing up event? Like some nbt i can modify or something?

young knoll
#

Api

#

setAgeLock

lost matrix
cyan bolt
#

Hey, I'm trying to make a cooldown that can be used for multiple events.
Here is my CooldownManager class.

package me.thatkermitguy.medievalmc.utils;

import org.bukkit.entity.Player;

import java.util.HashMap;
import java.util.UUID;

public class CooldownManager {

    public static HashMap<UUID, Double> cooldowns;

    public static void setupCooldown() {
        cooldowns = new HashMap<>();
    }

    public static void setCooldown(Player player, int seconds) {
        double delay = System.currentTimeMillis() + (seconds*1000);
        cooldowns.put(player.getUniqueId(), delay);
    }

    public static int getCooldown(Player player){
        return Math.toIntExact(Math.round((cooldowns.get(player.getUniqueId()) - System.currentTimeMillis()/1000)));
    }
    public static boolean checkCooldown(Player player) {
        if (!cooldowns.containsKey(player.getUniqueId()) || cooldowns.get(player.getUniqueId()) <= System.currentTimeMillis()) {
            return true;
        }
        return false;
    }
}
#

I'm getting the error

Could not pass event PlayerInteractEvent to MedievalMC v1.0-PREALPHA
java.lang.NullPointerException: Cannot invoke "java.util.HashMap.containsKey(Object)" because "me.thatkermitguy.medievalmc.utils.CooldownManager.cooldowns" is null
        at me.thatkermitguy.medievalmc.utils.CooldownManager.checkCooldown(CooldownManager.java:25) ~[MedievalMC.jar:?]
        at me.thatkermitguy.medievalmc.events.weapons.BattleAxeEvents.onRightClick(BattleAxeEvents.java:21) ~[MedievalMC.jar:?]
#

Any ideas?

#

I haven't worked with HashMaps that much so I'm very confused lol

echo basalt
#

why does it have to be static

#

also your error happens becauase you never called setupCooldown

#

but this is static abuse

cyan bolt
#

i mean i got an error from intellij telling me it should be static

echo basalt
#

mm no

cyan bolt
echo basalt
#

.

lilac dagger
cyan bolt
#

sorry, setup cooldown is called here:

package me.thatkermitguy.medievalmc.events.weapons;

import me.thatkermitguy.medievalmc.items.weapons.BattleAxe;
import me.thatkermitguy.medievalmc.utils.CooldownManager;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.block.Action;
import org.bukkit.event.player.PlayerInteractEvent;
import org.bukkit.potion.PotionEffect;
import org.bukkit.potion.PotionEffectType;

public class BattleAxeEvents implements Listener {

    @EventHandler
    public static void onRightClick(PlayerInteractEvent event) {
        // Potion ability (onRightClick)
        if (event.getAction() == Action.RIGHT_CLICK_AIR | event.getAction() == Action.RIGHT_CLICK_BLOCK) {
            if (event.getItem() != null) {
                if(event.getItem().getItemMeta().equals(BattleAxe.battleaxe.getItemMeta())) {
                    if (CooldownManager.checkCooldown(event.getPlayer())) {
                        event.getPlayer().sendMessage("Success!");
                        CooldownManager.setCooldown(event.getPlayer(), 10);
                    } else {
                        event.getPlayer().sendMessage("Failed! for another " + CooldownManager.getCooldown(event.getPlayer()) + " seconds");
                    }
                    Player player = event.getPlayer();
                    player.getPlayer().addPotionEffect(new PotionEffect(PotionEffectType.INCREASE_DAMAGE, 5, 2));
                }
            }
        }
    }
}

echo basalt
#

ew

#

what the fuck

#

?di

undone axleBOT
young knoll
#

Mehhh

cyan bolt
#

wait what the fuck i dont think i called it

young knoll
#

Cooldown manager sounds like a fine singleton

echo basalt
#

or just

#

di that bitch

young knoll
#

You could but why

#

Not liek multiple instances of it should ever exist

echo basalt
#

so?

#

doesn't mean you should singleton everything

opal juniper
#

id leave that as static 🤷‍♂️

echo basalt
#

Singletons should only be used in weird niche circumstances where DI is not applicable

young knoll
#

Means you don't have to DI something for basically no reason

echo basalt
#

if you face such an issue 9/10 times it's a design flaw

cyan bolt
#

i just trust intellij at this point, it does 20% of my work for me

young knoll
#

Sure there is an argument about testability but meh

ivory sleet
thin iris
#

does setting fire ticks add onto the original tick or change it directly

young knoll
#

The method is called setFireTicks

echo basalt
#

you don't want to share cooldowns between eating an apple and running a command

young knoll
#

Not addFireTicks

#

so

thin iris
#

erm

echo basalt
#

just make it an object so you can have separate cooldowns for stuff

thin iris
#

ok im just asking

young knoll
#

I guess you can do that

#

Or you can just give each cooldown a unique key and use the singleton

#

:p

ivory sleet
#

lol like a multiton?

lilac dagger
#

i do have a singleton somewhere

cyan bolt
#

ok im about to test with calling setupCooldowns in my onEnable in main class

young knoll
#

Multiton is a official design pattern now

#

Deal with it

cyan bolt
#

doesnt work

echo basalt
cyan bolt
#

welp i have to go anyways so ill probably deal with this tomorrow

echo basalt
#

also you'll have residual data with your listener if you don't properly invalidate data on quit

ivory sleet
lilac dagger
#

why would you even need a multiton for?

#

at that point just use a list of objects

ivory sleet
#

a singleton + objectpool can sometimes for the sake of convenience be a multiton

lilac dagger
#

oh

ivory sleet
#

i mean multiton is rarely ever considered a good pattern, but I mean you can find it being used every once in a blue moon

dense geyser
#

I'm making a system that needs to be able to get offline players by UUID, even some that have never connected to the server before and give their playername. So far, it isn't working and the playername is null by the basic Bukkit.getOfflinePlayer(UUID) method. Unless I'm doing something wrong, I wanted to use the mojang api to return information on the account if it didn't exist and then load it into the storage that craftbukkit uses to cache offline players. Does anyone know the method to do that in craftbukkit or where it might be?

twin venture
#

Hi is the item on courser mean this?
the item on the mouse?

#

like so?

#

not the item in hand , but the item on courser right?

young knoll
#

yes

twin venture
#

ok then why my code does not work ..

#

it send the message , but it does not add the item

chrome beacon
#

Try printing the material

twin venture
#

i did it does print it

alpine swan
#

will raytraceentities go through blocks, and is there an alternative that wont go through blocks?

young knoll
#

I know the regular raytrace won't

#

It'll go until it hits a block or an entity

lilac dagger
#

Is this factory pattern abuse?
``public class SomeObjectFactory {

public void registerBlueprint(String name, Blueprint blueprint) {

}

public SomeObject make(String name) {
}

}``

ivory sleet
#

Don’t think so?

lilac dagger
#

nice

smoky oak
#

Uh is this generated automatically or smth?

twin venture
lilac dagger
#

to ignore rechecking it

quaint mantle
#

Hmm... first time I opened bukkit in a project. 😄

lilac dagger
#

it is not getting compiled

smoky oak
#

well all inputs are final

sullen marlin
#

Doesn't that contract mean the method always returns null lol

smoky oak
#

yea

lilac dagger
#

yes

#

for any input

smoky oak
#

cuz im only doing the methods itself so i can put them in the other project

#

they're not populated yet

ivory sleet
#

IntelliJ is relatively good at inferring contracts

smoky oak
#

you can stuff null into lots of things without intelliJ complaining

#

so thats what im using as a placeholder

young knoll
#
public static Object getMeANull() {
  return null;
}
lilac dagger
#

nice

lost matrix
#
public static <T> T getMeANull() {
  return null;
}
lilac dagger
#

there's also a bug in intellij where it assumes it returns null even if for a specific input it can't

young knoll
#

Ah yes generics were designed for this

lost matrix
#
  public static <T> T surpriseMe(T input) {
    return ThreadLocalRandom.current().nextDouble() < 0.5 ? null : input;
  }
lilac dagger
#

and always surpriseMe("hey").charAt(0)

lost matrix
#

Imagine doing that with a 0.1% chance and then demanding someone to reproduce the error after they got it the first time

lilac dagger
#

haha

smoky oak
#

thats what logs are for

#

im pretty sure even if theres a jackson in here hes got no idea what youre doing

ivory sleet
#

Yeah I think

#

Altho that might be easiest by providing a custom serializer

smoky oak
#

oh wtf theres actually a java thing called jackson

ivory sleet
#

Yes its the faster json library to just gson

#

And hella enterprisy

#

Ugh, I don’t remember but maybe yeah

#

Or at least u need to set some option I think

lost matrix
#

Ok, but why?

dry hazel
#

the JsonProperty annotation should suffice, no?

lost matrix
#

Jackson can just serialize enums by using their name

dry hazel
#

if you want to make them case insensitive, there's a MapperFeature for it iirc (ACCEPT_CASE_INSENSITIVE_ENUMS I think it was named)

lost matrix
#
public enum Icon {
    ONE,
    ...
}

Will serialize just fine for properties

{
   "icon": "ONE"
}
#

Explain what you mean by that

dry hazel
#

you can change the serialized name in @ JsonProperty

ivory sleet
#

Are you using a weird enum morice?

young knoll
#

Why not just have the enum and strings be named the same way?

lost matrix
#

Why not just use PYRO and HYDRO directly?

ivory sleet
#

Sounds like you should be using Fire, Water etc as much as possible as well

#

And only map it to those fancy names such as Pyro and Hydro for the end user

alpine swan
#

I am trying to check if the player is currently allowed to build or if other players will block the building but im not sure what I should put in as the arguments, i cant really make new blocks in the world to input into it

smoky oak
#

?

alpine swan
# smoky oak ?

I am calling a blockplaceevent to see if any other plugins will cancel it to see if the player is allowed to build

#

but im not sure what arguments to put into the event creation

alpine swan
#

because i cant really create new blocks etc

lilac dagger
#

or something like that

young knoll
#

You don't need to create a new block

young knoll
#

You can just use the existing one at that location

lost matrix
pastel relic
#

Whats the text above the item bar called? Not the action bar the thing on the bottom.

young knoll
#

The action bar

opal juniper
#

thanks coll

young knoll
#

Idk what else there is

opal juniper
#

do you mean the item name?

young knoll
#

Ah that

#

That's client side

lost matrix
#

I think he means the item names

opal juniper
#

cause you can’t change that

young knoll
#

You could probably put an item in their hand for a single tick

#

Might work

kind hatch
#

There's probably a packet that can be sent.

young knoll
#

Well yeah