#help-development

1 messages · Page 879 of 1

slender elbow
#

i mean, there is no reason for mojang to include debug logging on a product release lol

#

they do have debug logging in the source, they just strip it from the log4j config

remote swallow
#

could be useful for us

slender elbow
remote swallow
#

well spigot or cb could re-add it or remove the deleting stuff with a patch

river oracle
#

Can you patch resource files?

#

Wonder how you'd even go about that

remote swallow
#

uhhhhhhhh

#

i have no idea

#

i mean technically we patch a pom so im guessing its a similar process

slender elbow
#

i mean you can provide your own log4j config file anywhere on the filesystem and override it with the log4j2.configurationFile system property

remote swallow
#

does spigots log4j2 config not override it

slender elbow
#

spigot has a separate log4j config from vanilla?

remote swallow
#

ye

#

or bukkit

#

idk which

young knoll
#

I thought we did at least

#

¯_(ツ)_/¯

slender elbow
#

that's barely any different from the vanilla one tbh

#

but it is different i s'pose

remote swallow
#

so wouldnt it override vanillas and re-enable the levels

slender elbow
#

i don't run a server but i would not like to be spammed with potentially hundreds of meaningless debug messages on a production server tho

young knoll
#

I was thinking more for the plugin loggers

#

Being able to setLevel would be nice

remote swallow
#

^^

#

could probably add something in spigot config for levels

eternal oxide
#

used to be able to, before log4j

obsidian tiger
#

talking about logging, is there any way to have nicely formatted messages e.g. "test {} log message" where {} is replaced by the first arg and so on? I can only pass a string to most of the methods

slender elbow
#

the server ships slf4j api, although it's not exposed in bukkit you can include it in maven/gradle and just use it as usual

timid hedge
#

What is best for making a discord bot? jda? or is there anything else

tender shard
#

wtf is wrong with IJ

obsidian tiger
#

nothing is

tender shard
#

and if I click on "Wrap using Boolean.valueOf()" it comes up with this lmao

obsidian tiger
#

change it to boolean instead of Boolean

tender shard
#

No.

#

primitives are not nullable. And also you can set a Boolean object to a primitive boolean because of autoboxing

#

the code is valid

#

it's just IJ being stupid

obsidian tiger
#

I am aware but that wont change your IJ being stupid.

#

:)

tender shard
#

the weirdest thing is that it uses Foo.valueOf like wtf

obsidian tiger
#

have you tried just writing Boolean out yourself instead?

tender shard
#

I just use the code I sent, it compiles fine

obsidian tiger
#

as I said I am aware that it is valid code, but that wont stop your issue.

tender shard
#

Boolean.valueOf gives me "cannot access java.lang.Boolean"

chrome beacon
#

Just use Boolean.TRUE and Boolean.FALSE ?

#

You'll avoid the wrapping and valueOf

tender shard
#

as said, it cannot access java.lang.Boolean lol

chrome beacon
#

?

#

Invalidate caches

tender shard
#

yeah I'm already waiting for it to finish

shadow night
#

This is the first time I see somebody using Boolean instead of boolean

obsidian tiger
#

I am more questioning why you don't want a primitive

#

why would you want a nulled Boolean?

#

at that point just use an integer and bitwise.

tender shard
young knoll
#

Minecraft components moment

obsidian tiger
#

how do you even get to that stage of code if neither of those two were specified?
should just prevent that stage in the first place

#

anyways, your way of coding. I'll go back to my show on netflix.

tender shard
rotund ravine
#

TriState 👀

#

False, true, undefined

obsidian tiger
#

isn't there a default state that you keep track of?
if nothing is specified you just invert the default state in memory.

obsidian tiger
#

without even jumping to the part that checks for on/off

tender shard
rotund ravine
#

Default is not defined

warped zealot
#

Hey guys, for some reason, non-op players are able to use commands other than create. A month or two ago, only ops could do that. I'm using the latest version of paper and that's the only plugin I have in the server I'm testing. I also haven't really changed my plugin.yml of my mod, can you guys think of reasons why this is the case?

name: HungerGames
version: '${project.version}'
main: me.cantankerousally.hungergames.HungerGames
api-version: '1.20'
commands:
  select:
    description: "Select an arena in HungerGames"
    usage: <command>
  create:
    description: "Create an arena in HungerGames"
    usage: <command>
  chestrefill:
    description: "Refills Chests an arena in HungerGames"
    usage: <command>
  supplydrop:
    description: "Drops a Supply Crate in HungerGames"
    usage: <command>
  setspawn:
    description: "Sets SpawnPoints for Arenas in HungerGames"
    usage: <command>
  start:
    description: "Starts the game in HungerGames"
    usage: <command>
  end:
    description: "Forcefully Ends the game in HungerGames"
    usage: <command>
permissions:
  hungergames.select:
    description: "Allows you to select an arena in HungerGames"
    default: op
  hungergames.create:
    description: "Allows you to create an arena in HungerGames"
    default: op
  hungergames.chestrefill:
    description: "Allows you to refill chests in HungerGames"
    default: op
  hungergames.supplydrop:
    description: "Allows you to drop a supply crate in HungerGames"
    default: op
  hungergames.setspawn:
    description: "Allows you to set spawnpoints for arenas in HungerGames"
    default: op
  hungergames.start:
    description: "Allows you to start the game in HungerGames"
    default: true
  hungergames.end:
    description: "Allows you to forcefully end the game in HungerGames"
    default: op
rotund ravine
#

The command does not need to be on and off

tender shard
#

this is the new boolean to allow using "on" and "off" instead of just toggling

#

before that, the method just had Command, CommandSender as args

obsidian tiger
#

where do you call that method, I need to see some more

tender shard
obsidian tiger
#

a cleaner way to avoid a nulled Boolean would be using a byte if you care about extra allocation of 3 bytes compared to an int or not, or an enum which would be an extra class though and a bit overkill.

tender shard
#

not really

rotund ravine
#

A nulled boolean should be fine 🤷🏽‍♂️

obsidian tiger
#

of course its fine but theres a reason primitives exist

tender shard
#

a boolean represents two states, on or off, and the boolean not being there prepresents neither on nor off was chosen. I really don't see any reason why someone would be so obsessed with looking for problems with that

#

maybe I rename onOff to "chosenNewState" to make you happy

river oracle
#

@tender shard bro fuck you your buildSrc makes my laptop sound like its going to blast off into space

tender shard
#

get an apple silicon then

river oracle
#

lol

tender shard
#

the m2 macbooks don't have fans I think

shadow night
rotund ravine
river oracle
#

or does it just not 😂

remote swallow
#

ive only ever used jda so no idea how good d4j is

timid hedge
#

What would you prefer?

#

Alright okay, thanks

tender shard
tender shard
river oracle
#

meanwhile my laptop

tender shard
#

it's more powerful than my desktop (i7 9700K) and stays super silent and cool all the time. no matter whether im compiling basics or rendering a 4k video or whatever

#

ok tbh I only render 1080p videos

shadow night
#

Can you render a 4k video

tender shard
river oracle
#

yep

chrome beacon
#

I believe it thermal throttles pretty bad

river oracle
#

cooler

remote swallow
#

dont apple use those vibrating air coolers

river oracle
tender shard
chrome beacon
river oracle
#

wonder why

#

unless you're running through a VM

#

then in that case its pretty obvious why

slender elbow
#

if you close your eyes, there is no problem

tender shard
river oracle
rotund ravine
tender shard
#

i got the max

#

the one with 12 cores, 30 gpu and 16 neural engine thingy

rotund ravine
#

Heard the m3 max overheTed

tender shard
#

oh yeah idk I got the m2

clear elm
#

how can i learn making plugins

vocal cloud
worthy yarrow
#

Hey there anyone here familiar with Squaremap api?

tribal valve
#

is there a way to get config locations and loop through them? this is kinda repetetive

vocal cloud
#

you can getKeys for a config section which allows you to easily loop through them and get them all

orchid brook
#

u can use ConfigurationSection maybe

ConfigurationSection section = this.config.getConfigurationSection("core.blocks");
Set<String> identifiers = section.getKeys(false);

        for(String identifier : identifiers ) {
}

tribal valve
tender shard
#

the strings will be the names of the sections, in this case "coal", "wood", "iron"

tribal valve
#

ohhh thanks

tender shard
#

to get the actual location you still have to throw in the result of getKeys(...) into a get method of the config

tribal valve
#

okay thanks

worthy yarrow
tame wolf
#

Have you tried asking the devs of said APIs?

worthy yarrow
tame wolf
worthy yarrow
# tame wolf This is still holding up

Well to be completely fair with you, I've had an interaction with them before and their support is utterly useless... they just kinda make fun of you for not understanding their api...

tame wolf
#

Time to switch then, if the devs are evil you really need to switch

#

Because of they won't provide support for the API they develop I doubt you will find much anywhere else

worthy yarrow
#

Yeah that's a good point, dynmap was an option until the guy I'm helping out decided to just go squaremap.... so that also doesn't help

tame wolf
#

You could try explaining to him the cons of going with squaremap

worthy yarrow
#

I have, I believe it's just the fact that squaremap is already setup

#

I could always see if they would actually be willing to help me as this is somewhat of an addon I suppose... it's got api usage from towny / siegewar / and squaremap so perhaps that might entice them to actually provide support lol

tender shard
#

emojis in method names

worthy yarrow
clear elm
#

?learn

#

?learnjava

undone axleBOT
clear elm
#

?spigot

#

?learnspigot

shadow night
#

#bot-commands moment?

clear elm
#

how can i learn make plugins?

shadow night
#
  1. Learn java
clear elm
#

this is normal java

#

i wanna learn how to make plugins with spigotapi

shadow night
#

It's one google search away

clear elm
#

there only curses for 90$

shadow night
clear elm
#

what are easy plugin ideas

shadow night
#

Custom join and leave messages

#

The most basic

tender shard
#

stuff from essentials

worthy yarrow
#

Custom commands

tender shard
#

join/leave messages, tp, tpa

worthy yarrow
#

I'd suggest trying to make functional plugins... meaning something with multiple layers perhaps... tpa system would be good for sure

clear elm
#

idk how to make a tpa system no idea

tender shard
#

then start with sth simpler?

worthy yarrow
#

Just think about it logically... what needs to happen in order for teleport / accept system to work? Firstly you need the command to request the teleport, then you need to response method in order to "accept / deny" that request... and so on

clear elm
#

hmm i can try ig

#

but i dont think i can make this

worthy yarrow
#

It's not as bad as you think

tender shard
worthy yarrow
#

I think I made my first tpa system with like under 100 lines so it's not super complex

clear elm
#

can i make it all in 1 class

tender shard
#

if you want

worthy yarrow
#

Yes but it's recommended to setup a class per function as it were

clear elm
#

you mean an class for tpa an class for tpa deny ...

tender shard
#

no, a class for a commandexecutor

worthy yarrow
#

No, that can all be handled in a single class

tender shard
#

a class for the "main plugin"

#

etc

clear elm
#

can i make an main class and one commadn class

tender shard
#

i don't know if you can

#

have you tried?

clear elm
#

idk if it can work

shadow night
#

programming is about trying

clear elm
#

okay lets go xD

worthy yarrow
#

Function meaning a mechanic I suppose, just write out everything related to the "tpa function" in the tpa class right? if you were to add maybe like an admin usage of the tp command to check permissions and force teleportations instead of a request, you'd probably write that one out in a seperate class than the tpa

#

@tender shard are you familiar with towny / siegeware api?

#

Sorry for the ping btw I know a lot of people hate it, just trying to get some quick support

worthy yarrow
#

If so, I've been made aware that nothing happens when the player joins / leaves a town. The function is supposed to trigger on townjoin / townleave, if the player is on cooldown they are disallowed to do so and both the inviter / player are sent a message notifying them of the cooldown, otherwise they are allowed and put on cooldown.

tender shard
clear elm
#

how can i make if its an online player here? : if (args[0].equalsIgnoreCase())

worthy yarrow
#

I'm not sure if my timer system is just busted, or if I'm just not using to correct events? I have no experience with towny / siegewar api other than trying to read through their documentation for about an hour

worthy yarrow
#

Or perhaps just a null check tbf

#

if bukkit.getplayer(args[1]) != null would work i think

clear elm
#

do you think its smart to ask chatgpt for an tpa system code and look how it works?

worthy yarrow
#

Chatgpt can write you anything to be fair, although for learning purposes it'd be best to try and write out the functions yourself

#

Chatgpt is also very error prone as it doesn't have real time access to api's meaning it can be incorrect about a lot of methods

clear elm
#

but idk how to make tpa

#

it gave me this code : ```java
package com.example.teleportation.commands;

import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;

public class TpaCommand implements CommandExecutor {

@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
    if (!(sender instanceof Player)) {
        sender.sendMessage("Dieser Befehl kann nur von Spielern verwendet werden.");
        return true;
    }

    Player player = (Player) sender;

    if (args.length == 0) {
        player.sendMessage("Benutzung: /tpa <accept|deny|player>");
        return true;
    }

    if (args[0].equalsIgnoreCase("accept")) {
        // Implementiere die Annahme eines TPA-Antrags
        player.sendMessage("Du hast den TPA-Antrag angenommen.");
    } else if (args[0].equalsIgnoreCase("deny")) {
        // Implementiere die Ablehnung eines TPA-Antrags
        player.sendMessage("Du hast den TPA-Antrag abgelehnt.");
    } else {
        // Implementiere das Senden eines TPA-Antrags an einen anderen Spieler
        String targetPlayerName = args[0]; // Annahme: Der Name des Ziel-Spielers ist das erste Argument
        Player targetPlayer = player.getServer().getPlayer(targetPlayerName);

        if (targetPlayer == null) {
            player.sendMessage("Spieler nicht online oder nicht gefunden.");
            return true;
        }

        // Implementiere die Logik für das Senden eines TPA-Antrags an den Ziel-Spieler
        // Beispiel: targetPlayer.sendMessage(player.getName() + " möchte zu dir teleportieren. /tpa accept oder /tpa deny");
        targetPlayer.sendMessage(player.getName() + " möchte zu dir teleportieren. /tpa accept oder /tpa deny");
        player.sendMessage("TPA-Antrag an " + targetPlayer.getName() + " gesendet.");
    }

    return true;
}

}

worthy yarrow
#

It's very good to use when you have some experience with spigot api... athough it can still be used to write "skeleton" type kind of syntax as to allow for the filling of code to still allow you to learn

#

Ehm

#

Yeah it looks correct to me

clear elm
#

okay i try to understand how the code works

worthy yarrow
#

Might want to add a permissions check however

#

if (player.haspermission("permission node of your choice")){
}

#

This will make sure only people who should be able to tp are allowed to send requests

clear elm
#

i wanna undersatnd first how this system even works to make it a bit different by myself

worthy yarrow
#

So essentially this is a very basic, command + argument system. When it comes down to it, if args length = 0, it send the command usage message to the player. if args[0] = accept, it sends the player the "du hast den tpa-antrag abgelehnt" message, otherwise if args[0] = deny, it send the deny message, else it gets the player name from args[0] and turns the string into a usable player variable in order to then send them a couple more messages.

clear elm
#

i dont understand this part :

            Player targetPlayer = player.getServer().getPlayer(targetPlayerName);

            if (targetPlayer == null) {
                player.sendMessage("Spieler nicht online oder nicht gefunden.");
                return true;```
worthy yarrow
#

Currently, there is no actual teleporting functionality and this will only send players messages

clear elm
#

bruh

worthy yarrow
peak depot
#

Hey just wanted to ask what the "proper way" now is to create heads with base64 values thats my old code: https://paste.md-5.net/equjupugim.cs, but now in the console it says its wrong

slim gate
#

what should I do so I can have a common module, and then have some type of Player type there inside an interface and use it for paper module and spigot module (and maybe if possible bungeecord in the future)

echo basalt
#

You need to make your own player wrapper class

#

and an adapter for each platform

slim gate
#

sounds something that takes time

#

just if there was a lib for this or a gist

sharp heart
#

Hello, do someone know how to remove the background of TextDisplay entity ? like this

pine sandal
#

That might be being done using custom maps. (At least thats how I would do text on a wall like that.)

warped zealot
#

Hey guys, for some reason, non-op players are able to use commands other than create. A month or two ago, only ops could do that. I tried it on the latest version of paper and spigot and that's the only plugin I have in the server I'm testing. I also haven't really changed my plugin.yml of my mod, can you guys think of reasons why this is the case?

name: HungerGames
version: '${project.version}'
main: me.cantankerousally.hungergames.HungerGames
api-version: '1.20'
commands:
  select:
    description: "Select an arena in HungerGames"
    usage: <command>
  create:
    description: "Create an arena in HungerGames"
    usage: <command>
  chestrefill:
    description: "Refills Chests an arena in HungerGames"
    usage: <command>
  supplydrop:
    description: "Drops a Supply Crate in HungerGames"
    usage: <command>
  setspawn:
    description: "Sets SpawnPoints for Arenas in HungerGames"
    usage: <command>
  start:
    description: "Starts the game in HungerGames"
    usage: <command>
  end:
    description: "Forcefully Ends the game in HungerGames"
    usage: <command>
permissions:
  hungergames.select:
    description: "Allows you to select an arena in HungerGames"
    default: op
  hungergames.create:
    description: "Allows you to create an arena in HungerGames"
    default: op
  hungergames.chestrefill:
    description: "Allows you to refill chests in HungerGames"
    default: op
  hungergames.supplydrop:
    description: "Allows you to drop a supply crate in HungerGames"
    default: op
  hungergames.setspawn:
    description: "Allows you to set spawnpoints for arenas in HungerGames"
    default: op
  hungergames.start:
    description: "Allows you to start the game in HungerGames"
    default: true
  hungergames.end:
    description: "Allows you to forcefully end the game in HungerGames"
    default: op
hasty oyster
#

Question, what is the best way to store a mapping of strings to integers in Java/Spigot?

I want to give each player their own map of resources, and then store that map, my structure would look roughly like this:

{
  SOME_UUID = {
      wood = 0
      stone = 5
      iron = 10
  }
}

JSON/GSON maybe?

warped zealot
# peak depot ?whereami

I'm using the spigot API to develop the plugin, I also tried it on spigot, I still have the same error

slender elbow
# sharp heart

you shouldn't call teleport in the consumer action, the entity does not exist in the world (and, besides, you are already spawning it there)
but as for your actual question, you want to change the background colour with setBackgroundColor

worldly ingot
#

^ the background color allows you to specify an alpha value. setDefaultBackground(false) does nothing because that's the default value

#

Give it an alpha of 0

slender elbow
#

you can try

#

it'll throw an exception iirc

clear elm
#

is there a way to make a plugin for all verions

remote swallow
#

if it doesnt use nms use the lowest api verison you want to support

slender elbow
#

all versions?

#

that's a lot

clear elm
#

or how can i change version in intelyIDE

#

my plugin is currently for 1.20.1 i want it for other verions too

remote swallow
#

lower the spigot-api dep version in pom.xml and change api-version in plugin.yml

remote swallow
#

whats the lowest version you want to support

tender shard
#

no

clear elm
#

i want hiher versions

remote swallow
#

so you want 1.20.1 and up?

clear elm
#

yea

remote swallow
#

leave it as is then

clear elm
#

and in pom.xml?

remote swallow
#

leave as is too

clear elm
#

<version>1.20.1-R0.1-SNAPSHOT</version>

remote swallow
#

yup

clear elm
#

there stands 1.20.1

remote swallow
#

yes

clear elm
#

okay ty

tender shard
#

you can only do that if you're cheating

clear elm
#

so it will wortk for 1.20.4 too?

tender shard
clear elm
#

and how can i change name casue my plugin names SUPERRTP-1.0-SNAPCHOT.jar

#

i only want SuperRTP.jar is this possible?

tender shard
#
<plugin>
  <groupId>org.apache.maven.plugins</groupId>
  <artifactId>maven-jar-plugin</artifactId>
  <version>3.3.0</version>
  <configuration>
    <finalName>SuperRTP</finalName>
  </configuration>
</plugin>

Add this to your pom.xml inside <build><plugins>

clear elm
#

just add at the bottom?

tender shard
#

anywhere inside your <build><plugins> section, doesn't matter where exactly

remote swallow
#

as long as its not inside another plugin section

clear elm
#

okay ty

clear elm
remote swallow
#

what dont you get out of copy that

tender shard
#

isn't it kinda obvious if you look at the screenshot?

remote swallow
#

and paste it inside <build> <plugins>

clear elm
#

prob now wait

#

yay ty

dawn plover
#

Hey everyone, i am a bit confused why my PlayerJoinEvent never runs?

#

i never see "SOMEONE JOINED " in my console

remote swallow
#

do you register it

dawn plover
#

yup

remote swallow
#

does it implement Listener

dawn plover
#

in the same file there is the onPlayerLeave event, which does work

#

wait hu?, i am so stupid

#

ignore me

tender shard
#

what was the issue lol

dawn plover
#

XD

remote swallow
#

kek

dawn plover
#

but the thing is, i thought i registerd because the "player left: ${name}" logger was super close to an other message that got logged, so i thougth the above playerLeave event worked

#

but still tankyou haha, cus it saved a lot of time and headacke when you said that :P

tender shard
#

which code looks easier to read / understand?

val maxAllowed = player.getPermissionNumberValue(module.permissionSetHomeMultiple.name) ?: 2
val allowUnlimited = player.hasPermission(module.permissionSetHomeUnlimited)

val isOkay = if (allowUnlimited) {
    true // Player may set unlimited homes
} else {
    if (homeList.homes.size < maxAllowed) {
        true // Player may set more homes
    } else {
        if (homeList.homes.size == maxAllowed && homeList.getHome(homeName) != null) {
            true // Player already set his max amount of homes, but this home will replace an existing one
        } else {
            false // Buy a rank, ffs
        }
    }
}

if (!isOkay) {
    module.msgHomeLimitReached.tagUnparsed("limit", maxAllowed.toString()).sendToSender(player)
    return true
}

or this

val maxAllowed = player.getPermissionNumberValue(module.permissionSetHomeMultiple.name) ?: 2
val allowUnlimited = player.hasPermission(module.permissionSetHomeUnlimited)

val isOkay = allowUnlimited || // Player may set unlimited homes
        homeList.homes.size < maxAllowed || // Player may set more homes
        (homeList.homes.size == maxAllowed && homeList.getHome(homeName) != null) // Player already set his max amount of homes, but this home will replace an existing one

if (!isOkay) {
    // Send message if the player cannot set/replace a home
    module.msgHomeLimitReached.tagUnparsed("limit", maxAllowed.toString()).sendToSender(player)
    return true
}
tardy delta
#
if (homeList.homes.size == maxAllowed && homeList.getHome(homeName) != null) {
            true // Player already set his max amount of homes, but this home will replace an existing one
        } else {
            false // Buy a rank, ffs
        }```
cmon man
tender shard
#

what

#

if I "simplify" that, how am I supposed to add the "buy a rank" comment :p

tardy delta
#

thats like doing if x return true else return false

tender shard
#

yeah but imho it's easier to understand

tardy delta
#

i think its clear enough without comments

tender shard
#

if limit is reached but one home gets replaced:
-> its okay
otherwise
-> nah

#

i really don't like to omit the last thing and replace it with just returning the thing I'd test for

flint coyote
#
val isOkay = when {
    allowUnlimited -> true // Player may set unlimited homes
    homeList.homes.size < maxAllowed -> true // Player may set more homes
    homeList.homes.size == maxAllowed && homeList.getHome(homeName) != null -> true // Player already set max homes, replacing existing one
    else -> false // Buy a rank, ffs
}

Doesn't that work?

tender shard
#

oh yeah I like that

#

thanks

flint coyote
#

Could extract the size statement aswell

worthy yarrow
#

Anyone got experience with squaremap api by chance?

worthy yarrow
tender shard
#

do you have any specific question? the api basics seem quite straightforward

tender shard
#

Kotlin

flint coyote
#

Kotlin is alright

orchid gazelle
#

Declined

tender shard
#

reason?

fluid cypress
#

how are uuids generated in offline mode? are they generated based on the username or something like that? or is it just random? is it possible to know what the uuid for a username will be, without actually joining the server?

flint coyote
#

But actually. Alex?
I was gone for a few months but I still remember you hating on kotlin. What happened?

clear elm
#

can some1 teach me java

tender shard
orchid gazelle
tender shard
#

you'll be surprised but I also like gradle now

worthy yarrow
# tender shard do you have any specific question? the api basics seem quite straightforward

Yes I've got a project I'm working on, I'm a bit slow right now since I had a head injury last week and am on a lot of meds so the logic is just a bit slowed currently haha. This is the original version although I've made some updates that well... haven't worked so far. The point of this project is so that when a siege started against a town, a flame icon is created on squaremap at the spawn location of the town, on siege end the icon gets removed from squaremap... pretty simple although like I said, I'm having a pretty rough time understanding the api usage

flint coyote
#

That's what I told you months ago - without the gradle part lol. Glad you listened though

tender shard
# worthy yarrow Yes I've got a project I'm working on, I'm a bit slow right now since I had a he...

ok I haven't looked at your code, I'll just explain what my general idea would be:

  1. You create one MapWorld for each loaded world and keep that in a Map<UUID, MapWorld> (where UUID is the world UUID - do not store the world itself). Check WorldLoad and WorldUnloadEvent
  2. You create a SimpleLayerProvider for each of those worlds and add them to each MapWorld. You can use the same key everytime, e.g. "sieges".
  3. Whenever a siege starts, get the respective MapWorld and add the marker. You later need the key again to remove it, so you gotta use a key for the marker that you can later recreate, e.g. the center location of the siege in x_y_z format or sth like that
#

actually you don't even need to store the MapWorld, you can just store your SImpleLayerProvider

worthy yarrow
#

There's only one world I'm dealing with, does that simplify at all?

tender shard
#

in that case, you can simply keep your SimpleLayerProvider in a field

worthy yarrow
#

ok let me have a look

tender shard
#

I see you're creating an icon, you will only have to register it once and then you can use it again each time you create a marker

worthy yarrow
#

Well I also have split the events to different classes now as well

#

Would it be bad to use a static method to get the icon?

tender shard
#

you will always ever only have one flame icon so that's fine

fluid cypress
tender shard
#

it's not "name:..." but sth similar

fluid cypress
#

tho i guess i could look at spigot source? unless its done by minecraft itself

worthy yarrow
#

Alright so heres the plan I think... on enable call the icon creation method just to get it registered and available to use when my other events are called. eg: siege start / siege end, get the icon and put it on squaremap at the spawn location of sieged town, when the siege ends simply remove the icon from the map.

tender shard
#
    public static UUID createOfflinePlayerUUID(String s) {
        return UUID.nameUUIDFromBytes(("OfflinePlayer:" + s).getBytes(StandardCharsets.UTF_8));
    }

@fluid cypress

#

that's what spigot uses

#

s is the plain player name

fluid cypress
#

ok then i guess i have a problem in the js code

#

ill try that in java first

tender shard
#

how so? did you already change it to "OfflinePlayer:..."?

fluid cypress
#

yea

worthy yarrow
fluid cypress
#

but its generating weird stuff depending on the string length

#

for example i dont think this is a uuid: 6d6973646f63756d656e6f

worthy yarrow
#

Alright let me see what I can come up with real quick

tender shard
worthy yarrow
#

Alright if I can ping you with the results?

tender shard
#

sure

tender shard
#

@fluid cypress Here I just threw this together, works fine if you got the crypto thingy

const crypto = require('crypto');

function createOfflinePlayerUUID(name) {
    const namespace = 'OfflinePlayer:';
    const input = namespace + name;
    
    const hash = crypto.createHash('md5').update(input, 'utf8').digest('hex');

    return [
        hash.substring(0, 8),
        hash.substring(8, 12),
        '3' + hash.substring(13, 16),
        hash.substring(16, 20),
        hash.substring(20, 32)
    ].join('-');
}

console.log(createOfflinePlayerUUID('mfnalex'));
fluid cypress
#

this is what i did

const encoder = new TextEncoder()
const array = encoder.encode('OfflinePlayer:misdocumeno')
const uuid = new Uuid().fromBytes([...array])
console.log(`uuid for misdocumeno is: ${uuid.toString()}`)
#

using OfflinePlayer i get 4f66666c-696e-6550-6c61-7965723a6d6973646f63756d656e6f, using name i get 6e616d65-3a6d-6973-646f-63756d656e6f, which is significantly shorter, and the actual uuid on the spigot sv is f62a41ae-4198-391b-ad68-6dbbc530da23

tender shard
#

yeah idk how UUIDs in javascript work, it's easiest to simply md5 the string and use that directly lol

fluid cypress
#

mmm, so uuids are just a md5 hash after all?

tender shard
#

well, no

fluid cypress
#

or the version that minecraft uses maybe, bc there are a few versions afaik

tender shard
#

a UUID is simply a unique identifier, usually generated randomly - however for offline players, yes it creates it from the md5 string of the input

#

here's openjdk code for nameUUIDFromBytes

fluid cypress
#

so there is no standar algorithm or something for creating a uuid based on something?

tender shard
#

type 3 is what minecraft / nameUUIDFromBytes uses

#

so yes, there is a standard algorithm for that

fluid cypress
#

mmm i see

#

interesting

devout kite
#

Hey, is there any possibility to set the title of the player Inventory? so this has a other title when the inventory opens
https://prnt.sc/IH-1mRBR579X

tender shard
#

of the player's own inventory?

#

no

fluid cypress
tender shard
orchid gazelle
#

Mojang should send a packet for that plz

tame wolf
#

I thought it was only client side when in creative

tender shard
#

well you can detect when they're clicking in their inventory, but you can't detect whether it's open or not

flint coyote
#

Isn't there the InventoryOpenEvent? Or is that for chests etc. only?

tender shard
#

doesnt work for player inventory

#

it'S client sided

flint coyote
#

true. Just tested that. They should really add that to the javadoc though

devout kite
tender shard
#

it used to be possible to detect players opening their own inventories through advancements, but that was removed in 1.14 or so I think

tender shard
#

but you can't change it on the fly or anything

devout kite
river oracle
#

under the hood this sends an open container request to the player with the same ID and will trick the client into using your new title

tender shard
#

but for the player's own inventory? which the client doesn't even tell the server about when it's being opened?

river oracle
#

the best method there would be to use a scheduler tbh

#

given you want to do it on the fly

#

otherwise editing the lang file seems good enough

devout kite
worthy yarrow
#

I haven't registered the listener classes yet either so don't mention that haha

hushed spindle
#

does LivingEntity#addPotionEffect() forcefully add the effect? like do i need to check if the entity has a preexisting effect to not force it

#

the method has a force overload but that one is deprecated

worthy yarrow
#

I mean I'd assume if an entity already has the effect you're trying to add, you wouldn't need to add it correct?

#

You could also inverse the check to simplify

hushed spindle
#

i mean i would also like the effect to not apply if the entity happens to have the same effect with stronger amplifier

flint coyote
#

I think if the time is lower and the level is the same it refreshes the time.
If the level is higher it overrides the lower, ignoring the time left

#

this is what I think I remember - don't take it for granted.

hushed spindle
#

i guess ill find out

#

thanks

worthy yarrow
#

Yeah if that's true just make an inverse check ie: if !entity.haspotioneffect

solar portal
#

So I'm trying to push a player downwards, but if they jump, and run the command right after, they will be pushed upwards. I have no idea how to fix it, could anyone help?

        ...
        if(args[0].equalsIgnoreCase("down")) {
            double speed = 2;
            pushEntity(player, speed);
            return;
        }
    }

    private void pushEntity(Entity entity, double speed) {
        Vector currentVelocity = entity.getVelocity();
        currentVelocity.setY(-speed);
        entity.setVelocity(currentVelocity);
    }
hushed spindle
#

the deprecation reason is that entities can have multiple of the same potion effect type, but im pretty sure thats not true?

worthy yarrow
flint coyote
#

it isn't but I think it's the override change that was introduced at some point

#

Using the /effect command approves what I said. Higher levels override lower levels (ignoring time) and same levels refresh the time if higher

#

otherwise you get an error. Spigot probably behaves the same

#

(without an exception)

worthy yarrow
# worthy yarrow https://hastebin.skyra.pw/nasoyedure.java In case you want the hastebin

Btw if anyone has any experience with squaremap / towny / siegewar api, help would be greatly appreciated. The intended function of this plugin is on siege start event / siege end event, create a flame icon for the spawn location of the besieged town adding it to squaremap, when the siege ends simply remove the flame icon. (https://github.com/jpenilla/squaremap/wiki/API-Basics) I was having a pretty rough time understanding the api usage haha

GitHub

squaremap is a minimalistic and lightweight world map viewer for Minecraft servers, using the vanilla map rendering style - jpenilla/squaremap

summer scroll
#

Is there in any way to clear entity's pathfinder with spigot api? Right now I do LivingEntity#setAI, but this option removes the gravity and colission of the entity too and I don't want that.

worthy yarrow
# summer scroll Is there in any way to clear entity's pathfinder with spigot api? Right now I do...

As of my last knowledge update in January 2022, the Spigot API itself does not provide a direct method to clear an entity's pathfinder while preserving gravity and collision. The setAI method you mentioned is a general-purpose method to enable or disable the entire artificial intelligence (AI) of an entity, and it may affect various behaviors including movement, gravity, and collision.

However, you might consider using more specific methods or workarounds to achieve your goal. Here are a couple of suggestions:

Custom Pathfinder Goals: Instead of disabling the entire AI, you could look into creating custom pathfinder goals using the Pathfinder API. This way, you have more control over the specific behaviors of the entity. You can add and remove goals as needed.

EntityCreature entityCreature = ((CraftCreature) livingEntity).getHandle();
entityCreature.goalSelector.clear(); // Clear existing goals
entityCreature.targetSelector.clear(); // Clear existing targets

// Add your custom pathfinder goals
entityCreature.goalSelector.a(1, new PathfinderGoalYourCustomGoal(entityCreature));

Note: This involves using NMS (net.minecraft.server) classes, and it's generally not recommended as it may lead to compatibility issues between different Minecraft versions.

Packet Modification: You might explore packet modification to achieve more granular control over entity behavior. This approach involves manipulating packets to modify specific aspects of the entity's behavior. It's important to note that this approach is more advanced and might not be suitable for all scenarios.

Keep in mind that the Spigot API is regularly updated, and there might be new features or changes after my last update. Always refer to the latest Spigot API documentation or community resources for the most up-to-date information. Additionally, be cautious when using NMS-related code, as it can lead to compatibility issues and is not officially supported.

#

Hopefully chatgpt helps 😄

flint coyote
#

Yeah he asked for a spigot-api way though.

worthy yarrow
#

Oh is there methods for that then?

#

In that case, I'm sorry I provided false information...

summer scroll
#

Thanks for the help, if there isn't any way to do that with spigot-api, then I should use nms yes.

flint coyote
#

No. But that means the answer would "No" instead of "use NMS" xD

worthy yarrow
flint coyote
#

It's fun, you should try it some time. Can add parrot AI to pigs that attack you

worthy yarrow
#

Ooo actually that gives me an idea

flint coyote
#

They'll fly after you and even dodge fire just to murder you

worthy yarrow
#

Have you ever played assassins creed black flag?

flint coyote
#

Yes it was the last assassins creed I played actually

worthy yarrow
#

Oh yeah amazing, yk the whale/shark hunting mechanics? I think it would be awesome to try and implement something of that sort for minecraft

sullen canyon
#

help

hushed spindle
#

sir this is development help

sullen canyon
#

what

flint coyote
quiet ice
# sullen canyon

Well f(0) should be -2 unless I did some doofus, so it probably intercepts y = -2

worthy yarrow
quiet ice
#

What x-intercepts are I have little idea. Probably the result of me only having done german maths

tender shard
flint coyote
worthy yarrow
quiet ice
# tender shard

Hm, so y-intercepts are "Y-Achsenabschnitt" (so f(x) = y with x = 0) and x-intecepts are "Nullstellen" (so f(x) = 0)

tender shard
#

I guess y-intercepts are all points where fx is 0, yes

elder harness
#

I am using Mojang's API to get a player's UUID by name. However, since this request is limited by 200 for every 10 minutes, I get a 429 error from time to time. Is there a way to get a player's UUID by name in an alternative way? I need to get it also if the player hasn't joined the server before

quiet ice
#

I mean as far as I know no function can have more than a single point for any given x

worthy yarrow
quiet ice
#

okay why on earth are you using AWT in a plugin?

echo basalt
#

awt is fun

quiet ice
#

Doesn't that blow up on mac?

flint coyote
orchid gazelle
#

But, anyways, good question

river oracle
#

What is the difference between kotlin's Comparator interface and java's? more importantly why would I ever use kotlin's when it'd cause issues when using java's stdlib

quiet ice
#

Oh lord, even hardcoding the font name - so that will even blow up on many linux distros unless AWT uses a good replacement

quiet ice
#

It's really strange

tender shard
quiet ice
#

a function from a set X to a set Y assigns to each element of X exactly one element of Y.
Yep, no more than one value for every X

river oracle
#

the contract of a function is math is that every input has a distinct output

tender shard
river oracle
#

e.g. f^-1(x) = x^2 is not a function

#

but f(x) = x^2) is

quiet ice
#

I don't think that is actually the case

river oracle
#

wait no

#

wrong thing

#

I'm trying to think what the mod was

quiet ice
#

Though I cannot remember the context, so perhaps there was some loss of context here

sullen canyon
river oracle
sullen canyon
#

how much is it

river oracle
#

this is sad

flint coyote
echo basalt
#

2.5 * 2.5?

#

that's like

#

at least 2

quiet ice
#

6.25 or something? I donno, I cannot do maths (ignore that I am majoring in maths)

echo basalt
#

it is 6.25

tender shard
#

imagine doing math

#

imagine having to do math

sullen canyon
quiet ice
#

I instinctively wanted to do 4.25 until I was like "hold on, that is wrong" - so 5.25 it was until I was like "hold on, that is too close too to 2 * 2.5"

river oracle
worthy yarrow
#

Hey ImlIIusion have you any experience with siegewar / towny / squaremap api?

tender shard
echo basalt
#

I did some squaremap stuff

worthy yarrow
#

omg

sullen canyon
river oracle
#

and reported

worthy yarrow
#

Would you be willing to help me?

echo basalt
#

wasn't anything special

#

I just integrated a claim plugin into squaremap

icy beacon
undone axleBOT
#

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

sullen canyon
#

don't expect any help from them

echo basalt
worthy yarrow
sullen canyon
#

they aren't tolerate

river oracle
echo basalt
#

man needs help doing (1/2 + 2) ^ 2

worthy yarrow
sullen canyon
river oracle
echo basalt
#

same shit

icy beacon
echo basalt
#

different number

#

Anyways

sullen canyon
echo basalt
#

how much is 1/2

river oracle
#

@echo basalt I wish we had this guy instead of CMarco tbh

icy beacon
#

Fucking hell

#

Download Photomath or some shit

sullen canyon
echo basalt
#

how much is 1/2 + 2

tender shard
#

7

quiet ice
# tender shard dude are you in 3rd grade

Funny story: My classmates (Q3 - so the semester before the "abitur") which are majoring in maths don't know how to multiply a three digit number with a two digit number without a calculator. After the teacher taught them "schriftliches multiplizieren" (multiply in written form - according to google) they were "this is the hardest thing we have ever done".

I think at this point I should really not be surprised that I am the top of my class by a large margin.

echo basalt
#

good job alex you get a cookie

icy beacon
#

I need to be awake in 4.5 hours but instead I'm indulging a circus performance

echo basalt
#

I slept lik an hour

worthy yarrow
echo basalt
#

im doing good

tender shard
quiet ice
#

Well there is still Q4, but that is the abitur more or less

tender shard
#

for me q1 was 11 grade, q2 was 12th grade, and then i had my abitur

#

but yeah if they can't multiply on paper theyre a bit stupid lol

quiet ice
#

We have "G9" here, so E-phase was 11th, Q1/2 12th and Q3/4 is 13th

river oracle
#

I love how no one here has considered they are a troll

echo basalt
#

german guys can y'all fuck off to #general

orchid gazelle
#

@tender shard are you talking about quarter years or grades?

quiet ice
tender shard
quiet ice
#

Yep

orchid gazelle
#

For us it is called Q11, Q12, Q13

tender shard
worthy yarrow
# echo basalt does it run?

Eh have not had a chance to test this updated version yet, the guy I'm making it for is like 8 hrs behind me haha

echo basalt
#

Well

#

I don't see you use the flame emoji anywhere

#

I'd honestly just make a .png file and stick it in the resources folder

#

and load it

#

ImageIO.load(file) or whatever

orchid gazelle
echo basalt
#

Playing with AWT can cause problems in headless environments

worthy yarrow
#

Ok that sounds like a fair point

#

As far as my implementation of the squaremap api goes, am I doing it correctly?

echo basalt
#

uH

#

api.getWorldIfEnabled(mapWorld.identifier()).ifPresent(worldMap - >api = (Squaremap) worldMap);
wtf is this

#

The addon I wrote does it a bit different

worthy yarrow
echo basalt
#

Yeah that looks right

river oracle
worthy yarrow
#

I had to change it slightly for the ide to be happy but still

echo basalt
#

(Dont judge the poor getters I just forked their module)

worthy yarrow
#

Well you can see in my project, I'm trying to create a static usage for my flame icon lol

echo basalt
#

wel lyeah but you don't use the icon anywhere

#

You just assign it to a field with no getter

worthy yarrow
#

I know, currently I wasn't sure how to add the marker to squaremap

#

@EventHandler
public void onSiegeStart(SiegeWarStartEvent event) {
Siege siege = event.getSiege();
Town siegedTown = siege.getTown();

    if (siegedTown != null) {
        Key key = Key.of("my_unique_marker_key");

        Location spawnPoint = siegedTown.getSpawnOrNull();

        if (spawnPoint != null) {
            Point point = convertLocationToPoint(spawnPoint);
            Icon marker = Marker.icon(point, key, 3);

            epirateSiegewarAddon.provider().addMarker(key, marker);
        }
    }
}
#

Thats one of the events where I should be getting the icon for use

echo basalt
#

Ugh

#

YOu're returning a new layer provider every time you call .provider()

worthy yarrow
#

Oh haha

echo basalt
#

Basically you want to init the layer provider once and pass it around with DI

orchid gazelle
#

How do you guys like to handle databases? Load data on start? Load playerdata in cache when player joins? Real-time?

echo basalt
#

Add the marker to your layer provider

echo basalt
#

Load data on join = good under certain cases but can cause desync

worthy yarrow
#

That was the goal with the initialization being in main class, I didn't realize I was doing that haha

echo basalt
#

real-time = highly complex and latency prone

orchid gazelle
#

Okay, so what would you do? Depending on the data

echo basalt
#

I usually just load it all on player join

#

like whatever i need

#

For example this tycoon minigame's a bit more complex

#

When a player joins I fetch their island id from the database

#

I then fetch the server that has it on redis

#

If that server exists, and is not the current server, I don't load the rest of the island

orchid gazelle
#

Do I load playerdata on join and if the data isn't there yet let the player wait and freeze them?

echo basalt
#

And when the join event fires you take it from the cache and put it in your map

#

That means the player's the one waiting longer

#

but it's fool proof

orchid gazelle
#

Well but what if some stuff needs longer in general?

#

Hard preparations?

#

Strong server lag?

echo basalt
#

Basically you load the data you need ASAP on login and the data you need later on join?

echo basalt
#

The login event is still called async

orchid gazelle
#

Hmm ok

echo basalt
#

Like there are multiple valid solutions, each one with its own compromise

orchid gazelle
#

And if the server needs to do some heavy task at boot that is multithreaded tho, may I freeze the whole server or start it and like deny any connections or ticks until it's done

echo basalt
#

uH that depends

#

But joining threads on enable is something that certain people see as acceptable

orchid gazelle
#

For example "I gotta render this special map and gotta pull 1GB from my db/IO"

echo basalt
#

disappointment I need context

orchid gazelle
#

I don't have context

#

Those are hypotetical questions

echo basalt
#

sigh it depends

#

Why would you be pulling 1gb

orchid gazelle
#

So I know how I can handle different tasks when writing big plugins or systems

echo basalt
#

Always try to attach your data's lifecycle to some other lifecycle

#

We can start with that

orchid gazelle
#

Hmm ok

echo basalt
#

So player data is only kept in memory for as long as the player is connected

orchid gazelle
#

Thanks for the answers btw.

echo basalt
#

If you need a minigame world from a template

#

You fetch the template and create the world when it's needed

#

If that's too much IO or the latency is too high you can consider caching the template

#

When the minigame is over, its world is too

orchid gazelle
#

Ahh yes, another problem, save data real-time, sync memory with db scheduledly or on playerquit?

echo basalt
#

on a timer + when the lifecycle ends

#

Is ideal

#

Real time depends

#

Basically real time = more IO & CPU but better resilliency

orchid gazelle
#

So like, I change my data in memory and schedule a task syncing the data to the db every now and then?

echo basalt
#

Sumn like that

orchid gazelle
#

I can do that async then

echo basalt
#

Yep

#

Saving real time is good if the server crashes

orchid gazelle
#

Yeah sure

echo basalt
#

Or if you don't plan on doing things often

#

Like uh

#

Think of luckperms permissions or user data

orchid gazelle
#

Well, maybe if it is an important query schedule to save instantly on next tick

echo basalt
#

That doesn't need a timer because it's low volume

#

No one cares about server ticks in an async context

#

But yeah important data is better real time

#

High volume is better in batches

#

Make sure to always save when the player quits though

orchid gazelle
#

Yeah

echo basalt
#

And make sure the data is saved before trying to read it

orchid gazelle
#

Alright

fair plover
#

hi

orchid gazelle
echo basalt
#

In concurrent environments, like in super sharded instances it's nice to keep things synchronized

#

Even if it means sending an update request to the server that's "owning" that data to tell what data to modify

#

You either do that or keep all the data in a central cache like redis

#

But that comes with higher latency

orchid gazelle
#

Yeah ofc, stuff needs to get handled differently with a sharded setup or multi-server

echo basalt
#

yuh

orchid gazelle
pliant topaz
#

Guys, is there any other method for placing a block (which works when there's no block, as this doesn't work)?
replaceAirBlockPosBug.getBlock().setType(Material.RED_WOOL)

tribal valve
#

how does anti-ddos/anti-bot works

flint coyote
#

Do you want to know how it works in the background or how to use it?

echo basalt
#

??

#

.

flint coyote
#

I mean you just have to fill the parameters opf the function.

  1. Class<? extends Event> event, can be any event you'd usually use in a listener
  2. Listener listener is a class extending listener
  3. Priority is some priority
  4. Event executor is a class implementing EventExecutor
  5. Plugin is your plugin instance
#

Marco being wholesome right here. Never seen anyone ask that for code that is public in some discord chat.

#

Yeah I also had to do some weird stuff on my implementation

echo basalt
#

Yes. Spigot has a contributors section

ionic thicket
#

org.bukkit.Bukkit.broadcastMessage(String)
or
org.bukkit.Server.broadcastMessage(String)
?

young knoll
#

Same thing

young knoll
#

First one is static and calls the second

ionic thicket
river oracle
#

the first one does this ^

young knoll
#

Actually everything in org.bukkit.Bukkit is static and calls the server version

undone axleBOT
ionic thicket
young knoll
#

PlayerBucketEvent can’t be listened to

rustic nebula
#

not sure if i was supposed my message in here or help-server but if anyone could look at it and help that would b great

flint coyote
#

It's an Event with subclasses, you can listen to the subclasses

young knoll
#

It’s a parent event for the empty and fill event

flint coyote
#

I ran into this, too

young knoll
#

Any that don’t have handler lists

flint coyote
#

You can however treat them both as a BucketEvents obviously. Therefore you could register BucketEmpty and BucketFill Event and then delegate them to the same handler for BucketEvent if you like to

fervent robin
spare mason
#

how can i turn a vector into an eulerangle?

young knoll
#

Are you opening an inventory in the inventory open event

fervent robin
#

I only listen for InventoryClick and InventoryClose

#

I do open an inventory in the inventory close event if that somehow matters

young knoll
#

You are meant to delay it a tick iirc

chrome beacon
#

^^

young knoll
#

However opening an inventory in the close event is kinda wacky regardless

fervent robin
#

That fixed it thanks

fervent robin
young knoll
#

I normally just use buttons for that

#

Rather than waiting for the user to close the inventory

fervent robin
rustic nebula
#

my mc server im using killrewards and if i kill someone in the lobby they get the rewards but not in the actual minigames, do any of you guys know a fix for this

fluid cypress
# tender shard <@354114876526034944> Here I just threw this together, works fine if you got the...

something seems to not be right, i thought the uuid was correct, but actually its not. my uuid in the server is f62a41ae-4198-391b-ad68-6dbbc530da23, but that function returns f62a41ae-4198-391b-6d68-6dbbc530da23, which is the same, except the first character of the fourth piece, the ad68 part, the js function returns 6d68 instead.
ive been trying a few names, and they seem to be correct, except a few, another one i found that has a different character is duketo, ingame is 9c077d67-1ddc-3fcc-b295-d148b4d6cb4f, but the function returns 9c077d67-1ddc-3fcc-3295-d148b4d6cb4f. again the difference is in the first char of the fourth piece.
i guess it has something to do with the variant? whatever that is https://github.com/openjdk-mirror/jdk7u-jdk/blob/master/src/share/classes/java/util/UUID.java#L174

rustic nebula
#

ah

#

whats the difference

fervent robin
fluid cypress
# fluid cypress something seems to not be right, i thought the uuid was correct, but actually it...

yea, i just changed it a bit, in case you wanna know, now it works fine

export function getPlayerUUID(username: string) {
    const buffer = crypto.createHash('md5').update(`OfflinePlayer:${username}`).digest()

    buffer[6] = (buffer[6]! & 0x0f) | 0x30
    buffer[8] = (buffer[8]! & 0x3f) | 0x80

    const hash = buffer.toString('hex')

    return [hash.slice(0, 8), hash.slice(8, 12), hash.slice(12, 16), hash.slice(16, 20), hash.slice(20, 32)].join('-')
}
wise mesa
#

is there a way to get the size that's currently stored inside a SAVE structure block

#

or to get the structure name that's typed into it

worthy yarrow
echo basalt
#

Upload to git pls

worthy yarrow
#

I'm going to get shunned by you guys I swear!

olive lance
#

Anybody experienced with PAPI can answer this?
I just updated my papi extension (had to remake it cause i lost project files) but I basically just updated the onRequest function and thats it. Supposedly the end user is testing and only the old placeholder is working and the new one just displays the %% text he typed for the placeholder. Is there anything else needed for the new placeholder other than the onrequest function or is the user just not updating correctly?

wintry lynx
#

Sooooo... Does this look good to y'all?

#

Cuz I certainly cant get it to work lol

olive lance
#

i wish i could help idk what it is probably a maven or gradle thing

wintry lynx
olive lance
#

I dont understand gradle but every one uses it so im obviously just out of the loop

worthy yarrow
wintry lynx
rough oak
#

Good evening, after a lot of research, I can't find how to achieve what I want and I wonder if you know the answer:

How can we remove knockback from a player when they are attacked like with the iron goleme?

olive lance
#

i also dont understand maven

wintry lynx
olive lance
#

but ive never researched either so it makes sense

worthy yarrow
orchid gazelle
wintry lynx
olive lance
#

yall are confusing me i just add the spigot jar in the libraries

orchid gazelle
#

Honestly

#

Idk why people use gradle. Gradle only seems useful for like 1% of all devs here

#

Just unneccessarily slow and complicated

eternal night
orchid gazelle
#

Hi lynx

orchid gazelle
wintry lynx
rough oak
wintry lynx
orchid gazelle
#

Restart IDE, reload project and deps

fathom jay
#

rq question, anyone knowledgeable about Persistent Data Containers?

wintry lynx
wintry lynx
orchid gazelle
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!

fathom jay
river oracle
fathom jay
#

im asking this cuz im kind off a starter in plugin development and I was just thinking about it

river oracle
#

Vault is simply a standardized API most economy plugins implement

#

its one of the rare cases in spigot's monolithic amount of plugins that do the same we have agreed to atleast just use this one API

wintry lynx
#

It didnt work but then I Assembled it again and it worked. Really confused tbh. Did that like 8 times already

fathom jay
#

Yeah I know about that, but since I've never worked with extra APIs as Vault, I'm kinda scared to get into it and be very confused abt it idk if it makes sense, srry

#

but ty

remote swallow
worthy yarrow
#

I did haha

#

I'm just impatient

#

Are you in the thread?

#

Should post it there as to not let your response get cluttered by other messages here

echo basalt
#

don't trust cmarco he's ai generated

fervent robin
lost matrix
fervent robin
#

thanks

echo basalt
#

Fun fact: List.of, Arrays.asList and List.copyOf are your most common sources of immutable lists

astral scroll
#

i hate them

echo basalt
#

They are ok

astral scroll
#

why would you not let me add someone to the list

#

😭

echo basalt
#

Any exposed collections should be mutable

#

.

#

It prevents all kinds of funky issues

#

For example

young knoll
#

But what’s the overhead of Collections.unmodifiableX!!!111

echo basalt
#
public class MyManager {

  private final Map<UUID, MyData> registry = new HashMap<>();

  public MyData getData(UUID id) {
    Preconditions.checkNotNull(id);
    return registry.get(id);
  }

  public void insertData(UUID id, MyData data) {
    Preconditions.checkNotNull(id);
    Preconditions.checkNotNull(data);

    data.setDirty(true); // Some random method
    registry.put(id, data);
  }

  public Map<UUID, MyData> getRegistry() {
    return this.registry;
  }
}
#

Here's a non-compliant class

#

The problem arises if I do something like

#

myManager.getRegistry().put(myId, myData);

#

It modifies the registry collection while bypassing the insertData method entirely

#

Which not only hides code flow, it also bypasses all kinds of side effects the method might have

#

Which in this case is the setDirty(true) call

#

Basically you're allowing for 2 slightly different ways of doing the same thing

#

Except one's fully accounted for and the other one is not

#

How do we fix this? When exposing our collection (if absolutely necessary, it's not always needed to do so), we return a read-only copy

#
public Map<UUID, MyData> getRegistry() {
  return Map.copyOf(this.registry);
}
echo basalt
river oracle
young knoll
#

That’s doesn’t answer the question :(

worthy yarrow
#

What sort of mechanics would be fun for a mobcoins plugin? Currently I just have implemented a shop of sorts that will rotate the items every 12 hours (intention for a survival server so I'd want to implement config for the set of items that will be rotated through the shop (also the %chance for items to show up in shop should be configurable as well) and finally how often the shop will rotate)

echo basalt
#

perhap

#

I remember having an issue with it

river oracle
#

on which event should I load player data

#

like in the join cycle

slender elbow
#

it isn't resizeable but it's still mutable

#

just like an array, it just wraps it in a List

young knoll
fervent robin
fervent robin
#

Is it bad practice to do this? I thinks easier to read and looks better this way

private final Map<Inventory, InventoryHandler> activeInventories;

    public InventoryManager() {
        activeInventories = new HashMap<>();
    }```
instead of 

private final Map<Inventory, InventoryHandler> activeInventories = new HashMap<>();

river oracle
hazy parrot
#

Definetly not bad practice

river oracle
#

I'm sure someone here has some super ultra bytecode reason that its actually 2 nanoseconds slower

lost matrix
#

I find the former to be more clean. This is exactly the purpose of the constructor.

river oracle
#

but like who the fuck cares

fervent robin
#

some user is gonna complain abt that prob

river oracle
#

more importantly

#

do what makes you happy!

lost matrix
#

Its actually quite important because field are initialized before explicit constructor if you just init them on their declaration.
This can lead to dependency issues.

slender elbow
#

both compile to the same thing

#

in that exact case)

lost matrix
#

It will just create a default constructor and lets explicit ones call it first

worthy yarrow
#

Someome mind showing me how to upload a project to git with intellij?

river oracle
lost matrix
fervent robin
young knoll
#

Yeah uhh the first one actually compiles to one extra flarp instruction

#

Which is 26 CPU cycles

worthy yarrow
buoyant viper
#

hmm @jagged quail

quaint mantle
#

Hi guys

wet breach
#

If the map isnt needed right away or it isnt going to persist it may be wise. However if it will persist it is generally better to initialize the the variables you need as early as you can

quaint mantle
#

Is remaking any hypixel gamemode an advanced project?

#

like skywars but with the kits upgrades etc

wet breach
#

Or just make your own game modes.

#

But sometimes

quaint mantle
#

I mean yeah

lost matrix
quaint mantle
#

I'm trying to remake a gamemode right now and I'm seriously wondering how some bugs even exist

river oracle
#

Minigames are annoying

fervent robin
worthy yarrow
fervent robin
lost matrix
fervent robin
#

I see

slender elbow
lost matrix
wet breach
slender elbow
#

which makes sense if you only have one

lost matrix
worthy yarrow
#

Gotcha

fervent robin
lost matrix
#

You are using DI which is nice. Some of the access modifiers of your methods could use some refinement (most of them can be made private).
The cooldowns map should reside in a manager class. "CooldownManager" or something similar.
The general logic and application are ok.

young knoll
#

Public fields belong in the craftbukkit

lost matrix
# worthy yarrow Gotcha

But i can see potential with where you are going. Splitting the logic into several methods with meaningful names is not something
you see from new devs.

lost matrix
quaint mantle
#

If I'm making a big project, should a manager class just take in the main class in the constructor

young knoll
#

Im pretty sure we mostly do it in NMS since yknow

#

getters are a whole 3 line diff

lost matrix
slender elbow
#

they aren't mutually exclusive either :D

quaint mantle
#

I was just thinking about either sending a class that holds all the instances or all the instances needed

#

Like passing in the class MyPlugin
In comparison to passing in MyManagerOne, MyManagerTwo

worthy yarrow
fervent robin
#

Idk how his course teaches but I find it a lot easier to learn through projects

worthy yarrow
fervent robin
#

just think of something a project you think might be challenging and then try to do it

worthy yarrow
#

Well I sorta just load up his lectures for examples to be fair

#

It's nice to see how a function can be written cuz then you can play with different implementations

fervent robin
#

yeah im not saying its bad im just saying I would def try your own projects too

worthy yarrow
#

Oh well the one I posted is mine, it's something I'm trying to get working for this towny / geopol server

#

And every other project I'll probably be posting soon has been all things I've wanted to do for quite some time but just never got around to perfecting

opaque scarab
#

Yeah find something challenging but also enjoyable for you.

wintry lynx
#

How I snatch a specific structure from this. Preferably one that a player is standing in. I cant find out how to grab a specific structure from a map

opaque scarab
wintry lynx
#

hence the map

#

but the map has every structure in the chunk

#

So it might get the start of the mineshaft underneath and so on

young knoll
#

I believe there is a method to get the starts for a specific structure

wintry lynx
#

Like I can check if one is there with paper but I cant get a refrence to it

young knoll
#

After that, get the individual pieces and grab the first one, which should be the origin

#

Uhh I think the structures exist as constants in some class

#

Might be in Structure

#

Well, the vanilla ones

#

If you want a custom one you’ll need to get it from the registry

opaque scarab
young knoll
#

Loop over the map and check if the structures bounding box contains the players location

wintry lynx
young knoll
#

Yeah you gotta grab all the ones of that type in the chunk and then check via looping

worthy yarrow
#

https://github.com/NukeCaps/SilentSkyCore/tree/master

So this is something I have been working on for probably 2 months now? A couple issues: minion functions don't work also in the process of reworking them from zombie spawn egg to a neat looking armor stand, minions just kinda bugged haha. More issues just kinda relate to it being more so half written. Anyone have any suggestions or notes?

GitHub

Contribute to NukeCaps/SilentSkyCore development by creating an account on GitHub.

young knoll
#

Actually wait, it’s a map so you can just do map.get with your structure to get the start

#

No need to loop

wintry lynx
#

Cant really find a block method, world method or really any method at all

#

I also cant find out how to remap after build since all the things ive seen use maven and I use gradle.

young knoll
#

Ah wait that’s Bukkit registry

#

Well similar idea you just need the NMS registry

elder harness
young knoll
#

Seems like you need a lot of UUIDs from name

#

Curious as to why

wintry lynx
#

What in tarnations is a TagKey

young knoll
#

It’s for tags

wintry lynx
#

Structure struct = (Structure) world.getMinecraftWorld().findNearestMapStructure(TagKey<Registry.STRUCTURE.get(NamespacedKey.fromString("revamp:desert_pyramid"))>, new BlockPos(loc.getBlockX(), loc.getBlockY(), loc.getBlockZ()), 100, false);

young knoll
#

It needs a tag key?

#

Pretty sure it can just take a structure

#

Iirc it’s world.getServer().registryAccess().getRegistryOrThrow(Registries.STRUCTURE).get

#

Or something along those lines

wintry lynx
#

This is far too difficult for a "locateStructure"

young knoll
#

Im sure there’s on that doesn’t take a tag key

#

Maybe

wintry lynx
young knoll
#

Ah it’s in the structure manager of the world

wintry lynx
#

Now of course I cant figure out how to reobfuscate the mojang mappings :L

young knoll
#

There are some unofficial grade plugins to replace special source

#

There is also paperweight userdev

wintry lynx
tender shard
dry hazel
#

like what?

tender shard
#

paper

dry hazel
#

it is paper's software for developing against their software so

tender shard
#

yeah it's pretty annoying if you want to use spigot api

tender shard
devout cosmos
#

Is there a way to detect when a player's saturation has changed? Or at least get a player's saturation value after eating?

remote swallow
hushed spindle
#

do textdisplays have any property that make it display like a name tag? in that it rotates to be visible to the players looking at it

tender shard
#

BillBoard.CENTER

#

oh wait, name tags only rotate sideways, not up and down right?

#

in that case you need BIllBoard.HORIZONTAL or VERTICAL

hushed spindle
#

oh is that what the billboard setting does

#

epic

tender shard
#

yep

The billboard setting controls the automatic rotation of the entity to face the player.

hushed spindle
#

i should learn how to read

hybrid spoke
hushed spindle
#

agree

torn shuttle
#

they still won't read it

torn shuttle
hushed spindle
#

lmao yeah

#

had a guy insist i explain my shit to him even though there was documentation on exactly what he was asking

#

smh

kindred valley
#

how do i deal with inventory update guys

smoky anchor
kindred valley
#
public void eventProcess(Inventory i, ItemStack is, Game g, Player p, InventoryClickEvent e){
        p.sendMessage("1");
        ItemMeta meta = is.getItemMeta();
        System.out.println("A: "  + meta.getDisplayName());
        System.out.println("B: "  + g.getName());
        if(is.getItemMeta().getDisplayName().equals(g.getName())) {
            p.sendMessage("2");
            if(g.getIsEnabled() == 1 || g.getIsEnabled() == 2) {
                p.sendMessage("3");
                if(!(CaptureTheWool.isPlayerInLobby.get(p))) {
                    p.sendMessage("4");
                    addPlayerToGame(p, g);
                    CaptureTheWool.isPlayerInLobby.put(p, true);
                    e.setCurrentItem(g.getIs());
                    p.teleport(new Location(Bukkit.getWorld("world"), 0,78,0));
                }else {
                    p.sendMessage("Şu anda farklı bir lobidesiniz...");
                }
            }else{
                p.sendMessage("Sunucu şuan aktif değil veya dolu..");
            }
        }
    }```
smoky anchor
#

now we're getting somewhere

#

Please, name your variables descriptively
i, is, g, p and e are terrible

kindred valley
#

okay i keep that in my mind thanks.

#
public void quitFromTheGame(Player p, InventoryClickEvent e) {
        p = (Player) e.getWhoClicked();
        for(Game g: CaptureTheWool.getGames()){
            if(g.getPlayers().contains(p)) {
                g.getPlayers().remove(p);
                ItemMeta meta = g.getIs().getItemMeta();
                meta.setDisplayName("Game " + g.getRoomCode() +  " || " + g.getPlayers().size() + "/32");
                g.getIs().setItemMeta(meta);
                g.setName("Game " + g.getRoomCode() +  " || " + g.getPlayers().size() + "/32");
                e.setCurrentItem(g.getIs());
                System.out.println(g.getName());
                System.out.println(meta.getDisplayName());
            }
        }
    }```
kindred valley
#

and method adds player to room

smoky anchor
#

Use early return as well

if (!is.getItemMeta().getDisplayName().equals(g.getName())) return;

to avoid nesting, it improves code readability

kindred valley
smoky anchor
#

And what exactly happens that you do not want to happen ?
item itemstack you get from "g.getIs()" (what is "Is") is not updated ?

kindred valley
#

yes

#

System.out.println("A: " + meta.getDisplayName());
System.out.println("B: " + g.getName());

#

this lines

#
[12:16:26 INFO]: A: Game 1 || 1/32

[12:16:26 INFO]: B: Game 1 || 0/32```
#

they are returning like this

#
 System.out.println("A: "  + meta.getDisplayName());```
#

this returns 1/32

hybrid spoke
#

please, one simple sentence what you are trying to do, what have you tried and at what point you are + what actually happens

kindred valley
hybrid turret
#

Say I have a custom ban system. Is it good practice to save the bans to a map and saving that map to a file every x minutes instead of reading reading a file every time someone joins? Ig it def makes sense for performance but not really for security since problems with the server could lead to players accidentally being unbanned if the server crashes or sum?

torn shuttle
#

good practice would be to store it in a database

hybrid turret
#

yeah, eventually

hybrid spoke
hybrid turret
#

is sqlite recommended for this? i want to make this plugin as accessible as possible (also for beginners) and i feel like having to set up an sql server is kinda counter-productive

hybrid spoke
#

but for that you have the async prelogin event

kindred valley
hybrid spoke
#

where you can just query the database if the player is banned

torn shuttle
#

sqlite is still a file-based thing but tbh that's what I use

hybrid spoke
#

so you wont need to hold it in a cache

torn shuttle
#

though sqlite won't work for networked things

hybrid turret
#

uhmm

#

maybe i'll just stick with config.get() lmao

torn shuttle
#

sorry I have already expended this lifetime's discussion on that topic, go ask chatgpt

hybrid turret
#

what-

#

ngl that's the rudest help i got here

#

jesus

hybrid spoke
hybrid turret
#

maybe second rudest

#

but still ass

hybrid spoke
#

you've been answered

#

and no, not every database is file based

torn shuttle
#

did you get here yesterday?

hybrid turret
#

well, you could've replied to a message from me lol, i did not realize this was an reply to my question if all databases were file-based

#

anyway

torn shuttle
#

well let me establish a new rudeness record for you here, I think you're a moron for jumping the gun in the way you did and I think it points to a shocking degree of emotional instability if you thought that was rude, now you for sure have a benchmark to work with

hybrid turret
#

what the fuck are you saying?

torn shuttle
#

if you don't understand what I said copy paste it into chatgpt and have it explain it to you

hybrid turret
#

jeez, how can someone be such a piece of crap? It was a misunderstanding, and I implicitely stated that. So what r you calling me names for?

torn shuttle
#

maybe you shouldn't have called me rude to start with when I was helping you out

hybrid turret
#

as i said- that was a misunderstanding, lol

hybrid spoke