#help-development

1 messages · Page 593 of 1

tender shard
#

PlayerInteractEvent != SignChangeEvent

timid hedge
#

How do i give a player an effect?
I am trying to give the player absorption for level 4
p.addPotionEffect(new PotionEffect(PotionEffectType.ABSORPTION), 4);
But this dosent work

upbeat fog
#
NamespacedKey isSheepHelmet = new NamespacedKey(HB.getInstance(), "isSheepHelmet");

 ItemStack rare = new ItemStack(Material.PLAYER_HEAD, 1);
        SkullMeta rareMeta = (SkullMeta) rare.getItemMeta();
        rareMeta.setOwnerProfile(pP);
        rareMeta.getPersistentDataContainer().set(isSheepHelmet, PersistentDataType.BOOLEAN, true);
        rareMeta.setDisplayName("§l§bSpecial Sheep Gear");
        rareMeta.addItemFlags(ItemFlag.HIDE_ENCHANTS);
        rareMeta.addEnchant(Enchantment.PROTECTION_ENVIRONMENTAL, 58, true);
        ArrayList<String> rareLore = new ArrayList<>();
        rareLore.add("§l§bProtection 58");
        rareLore.add("");
        rareLore.add("§3This item gives you");
        rareLore.add("§e10% §3chance to earn");
        rareLore.add("§e2x §3block drops.");
        rareLore.add("");
        rareLore.add("§o§8It also make you look cool. B)");
        rareMeta.setLore(rareLore);
        rare.setItemMeta(rareMeta);

 if(e.isCancelled()){
            return;
        }

        if(player.getInventory().getHelmet() == null){
            return;
        }

        if(player.getEquipment().getHelmet().getItemMeta().getPersistentDataContainer().has(isSheepHelmet,PersistentDataType.BOOLEAN)) {
            Block block = e.getBlock();
            Location bLoc = e.getBlock().getLocation();

            player.sendMessage("Mining with head");

               if (random_int < 11) {
                   block.getWorld().dropItem(bLoc,new ItemStack(block.getType(),1));
                   player.sendMessage("double drops");
               }
        }
undone axleBOT
#

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

tender shard
upbeat fog
#

wait maybe its cuz I forgot to get a new helmet

tender shard
#

oh yeah you need a new one ofc lol

upbeat fog
#

oh yeah now it registers that I mine with the helmet on

undone axleBOT
upbeat fog
#

thank you for the help

river oracle
#

Finally figured it out. My main issue is I actually had no fucking clue code wise where the corners were. So I figured it'd be easiest and rather inexpensive to run a check on every corner and calculate the distance between the 2 corners. The furthest edge should always be the edge I want therefore yielding me a good result without needing to now save the specific furthest apart points

timid hedge
echo basalt
#

corners are always just
minX = chunkX * 16
minZ = chunkZ * 16
maxX = minX + 15
maxZ = minZ + 15

tender shard
#

nowhere

#

you seem to lack basic java knowledge

#

you cannot just think like "oh, there's a method in class x. Let's just use it on class y"

#

getAction() is a method declared in PlayerInteractEvent. You cannot magically use it on a SignChangeEvent. It wouldnt make sense anyway

#

no, a SignChangeEvent simply has no "Action"

#

same like a Locatio ndoesn't have a getName() method but Players do

undone axleBOT
river oracle
tender shard
#

what's the purpose of the signchangeevent? normal players could also just create that sign by simply writing "ABSORPTION" into the second line

#

btw that's not even valid java syntax

#

your onInteract method's signature doesn't even have any symbol / "name" assigned to the PlayerInteractEvent param

#

?learnjava

undone axleBOT
worldly ingot
#

It's also nested inside the other method

tender shard
#

yeah, that too lol

#

let's imagine the second method wouldn't be inside the first one:

what is "e" supposed to be? I know you want the passed event to be called "e" but you didn't give it any name (so it wouldnt compile anyway)

#

same thing

#

same issues

rare rover
#

i got a question for y'all. Would making lots of BukkitRunnable's be wise. I do know a workaround (deques ofc)

#

i'm just too lazy to test myself

#

i'm guessing using 1 Bukkitrunnable is better lol

#

yeah true

#

more like 1000 but 1 looks way better than 1000 lmfao

#

deque would probably be the way to go

#

cuz im making a farming thing that regenerates the plant every 10 seconds after the player breaks it

#

actually

#

not sure how would do that with a deque

#

😓

#

i see

#

yeah i see it now

#

never knew that existed lol

#

yeah

#

but pretty simple

tender shard
#

no, everyone can place a sign and write ABSORPTION into the second line

rare rover
#

wait for the expiredmap

#

how would i make each value have a timer

#

and how would i check without lagging

#

alot

tender shard
#

who cares? you don't check for the other lines. and even if you did, I could just place a sign and write that exact text onto it

#

if you can't get signs, then why do you need a permission check for changing the sign's text

timid hedge
#

Okay and if im removing that it isnt still working

quaint tapir
#

Inventory pvpshopgui = Bukkit.createInventory(p,45, ChatColor.BLUE + "PvP Shop");
for creating inventories it requires a parameters of an owner but I want to store an inventory as a variable that I can use for many different players

tender shard
#

what exactly isn't working

quaint tapir
#

anyone know how?

tender shard
#

use null as holder

quaint tapir
#

but when I do p.openInventory(pvpshopgui)

#

it doesn't work

tender shard
#

?notworking

undone axleBOT
#

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

quaint tapir
#

the inventory doesn't open when I put the owner as null

tender shard
quaint tapir
#

i'll try again

#

so what exactly is the owner thing for

worldly ingot
#

tbf it really shouldn't be exposed

tender shard
#

well e.g. imagine someone opens a chest. you can listen to InventoryOpenEvent, then you can get the chest by doing Inventory#getHolder()

quaint tapir
#

i see

#

thanks

dry forum
#

how would i go about splitting an image/map so i can use it in multiple item frames (3x2)

echo basalt
#

aka splitting it into 128x128 chunks with m a g i c

dry forum
#

bbbbbbbbbbbbbruh

#

💀

#

is there no library for that?

echo basalt
#

it's literally just making an array

dry forum
#

ive never worked with maps before so i am clueless with this

echo basalt
#

Process is a bit finnicy

dry forum
#

that splits each image into 128x128 chunks?

echo basalt
#

YEah

#

Well

#

the setImageSupplier part does

#

The idea is to just loop through the image in 128x128 blocks (or less if you're at the last block)

#

You calculate the amount of blocks by dividing your width by your block size

#

So let's say that you have a 1000x500 image and you want to segment it in 128x128 blocks

#

It'd be

1000 / 128 blocks wide, and
500 / 128 blocks tall

dry forum
#

wait

#

maps are basically like blocks put into an image?

#

as in you can individually set each "block" on a map?

echo basalt
#

what I refer to "blocks" here are just segments of an image

#

Each frame suports a map item with a view attached

#

And that view renders 128x128 pixels

#

So if you want to render a 1000x1000 image you need 7.8 maps both in width and height

dry forum
#

ahh ok

#

ty

dry forum
echo basalt
#

mine

dry forum
#

if my image is 3840x2066 for example

that means it would take 30 images in width and 16 in height?

lime saffron
#

Hello, I need to convert a picture from the Internet into a minecraft map (as an item) and the server is on version "spigot 1.20.1".
Thank you for now.

high pewter
#

What determines if a block can be broken by water/lava? I'm guessing it's either isBuildable, isPassable or isReplaceable but they seem very similar so not sure which is actually accurate

dense shoal
#

Post more code

#

Let's see how the ItemMeta is being created too.

#

Set a breakpoint on the finished ItemStack too, does it all appear normal?

#

Also, 1% isn't a ton of difference to notice, have you tried anything more?

#

What do you mean?

#

So 200% is working?

#

OK, so it sounds like your code is at least partially working though, right?

#

Can you post more code?

#

What you've written looks fine, but maybe more background could help

zenith gate
#

you ever write an event listener then forget to register it, so then you wonder why its not working and spend 30 minutes debugging it?

#

You have to ask someone else man. I am no where near experienced enough to know what you need help with.

#

idek what that is.

orchid trout
strange rain
#

You think if you layer and stop and start diffrent minecraft sounds in perfect timing with perfect pitch and volume it could sound like a human voice?

#

With vanilla resources

orchid trout
#

thanks

quaint tapir
#

pvpshopnpc.getLocation().setYaw(90); pvpshopnpc.getLocation().setPitch(0);
For some reason this doesn't make the entity face straight forwards
pvpshopnpc is just a villager

#

anyone know why?

#

I spawn it at my location and it just faces the same direction im facing

#

public static void spawnOresShopNpc(Location location){ Villager pvpshopnpc = location.getWorld().spawn(location, Villager.class); pvpshopnpc.setCustomName(ChatColor.GREEN + "Minerals Shop" ); pvpshopnpc.setCustomNameVisible(true); pvpshopnpc.setAI(false); pvpshopnpc.setAdult(); pvpshopnpc.setInvulnerable(true); pvpshopnpc.setProfession(Villager.Profession.NONE); pvpshopnpc.setAware(false); pvpshopnpc.setRemoveWhenFarAway(false); pvpshopnpc.getLocation().setYaw(90); pvpshopnpc.getLocation().setPitch(0); pvpshopnpc.setSilent(true); oresshopvillager = pvpshopnpc; } }

#

here

zenith gate
#

I FINALLY GOT MY ARMOR SETS TO WORK!!!!

echo basalt
#

double it and give it to the next person

zenith gate
#

huh?

hazy parrot
#

Mysql will lock anyway, you don't need to worry about it

echo basalt
#

There's this funky concept called sharding

hazy parrot
#

Idk who told you that, but every major database should have table/row locking

echo basalt
#

Easier to do with mongo than sql but basically you can cluster out parts of your database into separate machines and they'll talk to each other and get your data fast

#

Helps with scalability :)

quaint tapir
#

I just cloned something from github and now I have over 200 errors
anyone know how I can fix this issue?

#

when I pull something from github it doesn't recognize it as a spigot plugin

#

It says module JDK is not defined

delicate fable
orchid trout
#

?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.

delicate fable
orchid trout
#

is variables a plugin?

delicate fable
#

So it's not in the /plugins folder but in /plugins/PluginName/Addons

quaint tapir
#

Guys I have a problem
I pulled something from github and my intelliJ says module JDK is not defined
does anyone know how to fix

orchid trout
#

project structure -> sdk (select an sdk)

delicate fable
#

I can't figure out for a few hours what the problem is.

zenith gate
#

if(playerContainer.get(new NamespacedKey(ToastsRPG.getPlugin(), "Voldemort"), PersistentDataType.INTEGER) == 4) {
            int currentMana = ManaManager.getMaxMana(event.getPlayer());
            playerContainer.set(new NamespacedKey(ToastsRPG.getPlugin(), "maxMana"), PersistentDataType.INTEGER, currentMana + 1000);
        }
        if(playerContainer.get(new NamespacedKey(ToastsRPG.getPlugin(), "Voldemort"), PersistentDataType.INTEGER) == 2) {
            int currentMana = ManaManager.getMaxMana(event.getPlayer());
            playerContainer.set(new NamespacedKey(ToastsRPG.getPlugin(), "maxMana"), PersistentDataType.INTEGER, currentMana + 500);
        }

How could I go about inverting this without the affects stacking?

eternal oxide
#

inverting?

#

first create your NamespacedKeys as fields so you only create them once.

#

second, use a switch on the value

rigid drum
#

Can I

#

run build tools

#

and somehow copy the decompiled stuff from work into spigot so I have full nms?

#

why this isn't the way it always is

#

boggles the mind, but whenever I do it manually there are little fiddly things and it takes an ass long time to fix them all

eternal oxide
#

Because Spigot is an API. nms is not a part of that API

#

?nms

rigid drum
#

does remapped

#

give you a spigot project with eveyr nms class in it

#

could care less which mappings are used, but I don't want to mapping back and forth and I doubt existing plugins would cope if I just compiled with mojang mappings

#

I just want to be able to power refactor nms

eternal oxide
#

Mojang mappings is what we use from 1.18+

rigid drum
#

Ok, then back to original question

#

how can I get a spigot project that contains all the nms classes

#

so I can convert to gradle

eternal oxide
#

Spigot is based on Maven as a build system

rigid drum
#

yes, I can make the change just need all the nms files

#

cannot get it to compile copying from BuildTools/work/decompiled-latest into Spigot-Server with maven either

eternal oxide
#

you won;t

#

?contribute

eternal oxide
#

there you will find all you need on building any custom spigot

rigid drum
#

Find the work/decompile-XXXXXX folder in your BuildTools folder.
Find the class you want to add in the net/minecraft/server folder and copy it.
Copy the selected file to the src/main/java/net/minecraft/server folder in CraftBukkit.
Implement changes.

#

but seemingly if I copy entire directory

#

it's full of fiddly little errors

#

The true true question is wouldn't the project just always have all of nms in it? Instead of the weird recursive depend on nms.jar

unborn sable
#

What would I do to store a villager's Profession and Trades in a Villager spawn egg?

eternal oxide
rigid drum
#

yeah?

#

But I need to rip and tear into nms and spigot to get it to not be too heavy for docker

#

otherwise it's going to cost like trillions a second to host a network in 1.19

#

but u can't refactor with only half the classes

eternal oxide
#

This is Spigot nothing to do with nms. nms is Mojang/Minecraft code. Spigot is an API

rigid drum
#

at the end of the day

#

spigot.jar contains nms compiled

#

so this is just demonstrably false

eternal oxide
#

argue with yourself., I've stated facts.

rigid drum
#

"
Find the work/decompile-XXXXXX folder in your BuildTools folder.
Find the class you want to add in the net/minecraft/server folder and copy it.
Copy the selected file to the src/main/java/net/minecraft/server folder in CraftBukkit.
Implement changes.
"
these steps, outdated or expected to contain errors after performing? If those steps are legit then this issue should be solvable without huge effort

young knoll
#

Are we talking compile errors

rigid drum
#

Yes

#
        List<Attribute> list = (List) stream.map(map::get).filter(Objects::nonNull).map((minecraftserverbeans_a) -> {
            return new Attribute(minecraftserverbeans_a.name, minecraftserverbeans_a.getter.get());
        }).collect(Collectors.toList());

getter cannot be resolved or is not a field

young knoll
#

Yes that’s expected

rigid drum
#

just a bunch of tiny things, I've gone through and fixed them all before in older versions

young knoll
#

The decompiler isn’t perfect

rigid drum
#

Okay, so have to go through and fix them by hand sadge

#

Why didn't one person just fix them all once and then call it a day?

unborn sable
#

Where would I set Villager trades on a villager spawn egg?

rigid drum
#

Then no cyclic depend and everyone is happy, ide works better, etc.

eternal oxide
#

its decompiled and changes so...

rigid drum
#

but it almost certianly takes weeks (maybe months) to update spigot anyway

eternal oxide
#

Spigot has fixes for teh nms it needs. Beyond that is not a part of the API so would be wasted time and effort

rigid drum
#

Huge communal L

eternal oxide
#

as I said Spigot is an API for plugin development, that does not include nms

young knoll
#

It does not take that long to update spigot

eternal oxide
#

using nms is on you.

young knoll
#

Well, depends on the version

#

But the past few haven’t seemed too bad

rigid drum
#

Even so, I mean I'll report back on how long this takes if I decide to do it for 1.20.1 but I've done it for 1.8.9 and 1.7.10 several times

#

it's a pain in the ass but like < 1 day pain in the ass

rigid drum
#

Also lets say I do this, would you all accept it so everyone else that wants to fork spigot can do so without exploding with rage?

young knoll
#

No

#

That would be a ton of patches for no real reason

rigid drum
#

What's wrong with that? buildtools already takes an eternity, would make the actually process of building faster probably without the cyclic stuff

echo basalt
#

oh hi exerosis

rigid drum
#

hey bud

echo basalt
#

So you want pure nms no spigot?

young knoll
#

Because they would have to be maintained

eternal oxide
#

If it were adding API functionality which would be useful to others, it might be accepted. If it's just to make your life easier, no.

young knoll
#

There’s no reason for spigot to fix the decompile errors in field it doesn’t need to modify

rigid drum
echo basalt
#

paper's doing that too but generally spigot only patches nms classes it needs to patch

eternal oxide
#

Which is of zero benefit to Spigot or it's users

rigid drum
#

there are networks all over the place, I can't imagine they are all willing to dedicate 5000 millicores to each container

#

How is someone forking not a user lol

eternal oxide
#

an exploiter

rigid drum
#

But yeah I mean ultimately not suprized here, spigot has always had the worst mindset on the internet from inception.

echo basalt
#

wait until you see paper

eternal oxide
#

does your fork push anythign back upsptream? In almost all cases, no.

rigid drum
#

I just don't see how I end up having to do this every time lol

echo basalt
#

damn you got friends?

rigid drum
#

lol

rigid drum
#

because by making mine compatable with spigot api and performant enough to run on a network

#

that enables plugin devs to sell resources (that you take a cut of) to network owners

eternal oxide
#

None of that is of any benefit to the Spigot API or its users.

rigid drum
#

Plus if we find some great performance optomization in theory you could just include it especially if it's been tested to not cause problems.

#

or if we make a banger API change

echo basalt
#

just switch to minestom at this point

rigid drum
#

I don't like minestom, but yeah I've got my own thing that I was working on.

#

But eyah the rewrites are more promising fs

buoyant viper
#

imagine still taking a cut from sellers in 2023

rigid drum
#

imagine taking a cut and then pretending that easier forking was not useful in 2023

blazing flare
#

How would I find out if the entity that killed another entity is a player? I know there's EntityDeathEvent but not sure regarding how to get the killer of said entity

eternal oxide
#

LivingEntity has a getKiller() method

blazing flare
#

Oh that's my issue, I'm just casting it to Entity. thanks

jolly forum
#

Hi, I can't import the Skin Restorer api into my plugin. It doesn't give me any errors.

jolly forum
#

wait pls

drowsy helm
#

and wdym "Cant"?

echo basalt
#

Should be

#

As that's defined by the server and not by your plugin

jolly forum
#

Hello, I can't compile SkinsRestorer API in my bungeeCord plugin that's why I tried to use shadow but it doesn't work either, could someone help me?

#

My build.gradle:

plugins {
    id 'com.github.johnrengelman.shadow' version '8.1.1'
    id 'java'
}

group = 'fr.zonedelta'
version = '1.0-SNAPSHOT'

repositories {
    mavenCentral()
    maven {
        name = "sonatype"
        url = "https://oss.sonatype.org/content/groups/public/"
    }
    maven {
        url 'https://repo.codemc.org/repository/maven-releases/'
    }
}


dependencies {
    compileOnly fileTree(dir: 'libs', include: ['*.jar'])
    compileOnly "net.md-5:bungeecord-api:1.12-SNAPSHOT"
    compileOnly "net.skinsrestorer:skinsrestorer-api:14.2.3"
}

def targetJavaVersion = 8
java {
    def javaVersion = JavaVersion.toVersion(targetJavaVersion)
    sourceCompatibility = javaVersion
    targetCompatibility = javaVersion
    if (JavaVersion.current() < javaVersion) {
        toolchain.languageVersion = JavaLanguageVersion.of(targetJavaVersion)
    }
}

tasks.withType(JavaCompile).configureEach {
    if (targetJavaVersion >= 10 || JavaVersion.current().isJava10Compatible()) {
        options.release = targetJavaVersion
    }
}

processResources {
    def props = [version: version]
    inputs.properties props
    expand props
    filteringCharset 'UTF-8'
    filesMatching('bungee.yml') {
        expand props
    }
}

shadowJar {
    configurations = [project.configurations.compileOnly]
}
#

Thanks in advance to anyone who can help me.

grizzled oasis
#

Hi i notest in some plugins is present JProfiler as a "profiling for java application and understand many other parts of your code that sucks", how they set it up for minecraft?

jolly forum
#

Help me

smoky anchor
#

bro your message is literally at the bottom, once someone who knows how to fix whatever problem you're having comes here, they will probably help you
just be patient

jolly forum
#

Okay

jolly forum
#

The error is patched but

quiet ice
#

Also shading the API is probably not what you want - you need to make sure the appropriate plugins are installed though

jolly forum
#

Another problem is that my skinrestorer api is not initializer.

#
package fr.zonedelta.bungee;

import fr.zonedelta.bungee.manager.Initialize;
import net.md_5.bungee.api.plugin.Plugin;
import net.skinsrestorer.api.SkinsRestorerAPI;

public final class ZoneDelta_Bungee extends Plugin {
    private static ZoneDelta_Bungee instance;
    private static Initialize initialize;
    private static SkinsRestorerAPI skinsRestorerAPI;

    @Override
    public void onEnable() {
        instance = this;
        initialize = new Initialize();
        getProxy().getLogger().info("Plugin Bungee of Zone-Delta is enabled");
        initialize.createEvent();

        skinsRestorerAPI = SkinsRestorerAPI.getApi();
    }

    @Override
    public void onDisable() {
        getProxy().getLogger().info("Plugin Bungee of Zone-Delta is disabled");
    }

    public static ZoneDelta_Bungee getInstance() {
        return instance;
    }

    public static SkinsRestorerAPI getSkinsRestorerAPI() {
        return skinsRestorerAPI;
    }
}
#

This my code

#
06:52:48 [WARNING] Exception encountered when loading plugin: ZoneDelta-Bungee
java.lang.IllegalStateException: SkinsRestorerAPI is not initialized yet!
    at net.skinsrestorer.api.SkinsRestorerAPI.getApi(SkinsRestorerAPI.java:65)
    at fr.zonedelta.bungee.ZoneDelta_Bungee.onEnable(ZoneDelta_Bungee.java:19)
    at net.md_5.bungee.api.plugin.PluginManager.enablePlugins(PluginManager.java:266)
    at net.md_5.bungee.BungeeCord.start(BungeeCord.java:295)
    at net.md_5.bungee.BungeeCordLauncher.main(BungeeCordLauncher.java:67)
    at net.md_5.bungee.Bootstrap.main(Bootstrap.java:15)
06:52:48 [INFO] Enabled plugin cmd_list version git:cmd_list:1.20-R0.1-SNAPSHOT:c7adcf9:1716 by SpigotMC
06:52:48 [INFO] Listening on /0.0.0.0:25565
06:52:48 [INFO] Started query on /0:0:0:0:0:0:0:0%0:25565
#

this my error

#

My error is a line skinsRestorerAPI = SkinsRestorerAPI.getApi();

#

Thanks in advance to anyone who can help me.

quaint mantle
#

?paste

undone axleBOT
jolly forum
#

Okay sorry

eternal oxide
jolly forum
#

??

#

Should I take it out of the onEnable?

eternal oxide
#

no

#

it should be in onEnable, but your plugin also needs a depend in plugin.yml for skins restorer

jolly forum
#

So I have to edit the plugin.yml?

#

I added this is correct?

eternal oxide
#

yes

jolly forum
#
depend:
  - SkinsRestorer
eternal oxide
#

your plugin must start after skin restorer

jolly forum
#

Thanks

#

but

#

I have a new error in my PostLoginEvent

#

this is my error

eternal oxide
#

LoginEvent.java:19

jolly forum
#

this is my code

#

According to my research it's supposed to be right but I've made a mistake I don't understand.

eternal oxide
#

getSkinsRestorerAPI() is returning null

jolly forum
#

but

#

On my class Main is not null

#

is retrurn to skinsRestorerApi

eternal oxide
#

move to the top of your onEnable skinsRestorerAPI = SkinsRestorerAPI.getApi();

jolly forum
#

Here is good ?

eternal oxide
#

yes

#

delete line 9, in that paste

jolly forum
#

Yes

#

I'm testing this

#

No, it doesn't work. On the contrary, it makes the same mistake as before.

quiet ice
#

And uh, are you shading it?

jolly forum
#

Yes

#

With the shadow plugin

quiet ice
#

Then don't. It should be compileOnly

jolly forum
#

Okay

#

Yes I cleared all error thanks

#

Oh

#

I have a new error 😭

#

My class

#

My error

quiet ice
#

Aaand?

jolly forum
#

My plugin should define a particular skin when connecting, but it gives me an error

quiet ice
#

User error pretty much

jolly forum
#

How do I fix it?

quiet ice
#

Use the correct player name?

silver viper
#

[SkinsRestorer] Error: Premium player with that name does not exist.

#

didnt you see that

jolly forum
#

Ah hell yes that's true but I'd have to get the skin at the url and not a player

rigid otter
#

I am trying to set a persistent data into a white wool block after placed. But during the check, it's not a tilestate, which I cannot set. Why?

eternal oxide
#

normal blocks have no pdc

rigid otter
#

So, are there any way to set a custom data into it?

eternal oxide
#

not on a normal block

rigid otter
#

sad

jolly forum
rigid otter
#

Wait, I see Block#setMetadata. Is it the alternative persistent data container?

eternal oxide
#

no

silver viper
rigid otter
shadow night
#

Wasn't there some lib that made it possible to kinda give blocks data?

eternal oxide
#

yes

#

by mfnalex

cobalt thorn
#

a request about something i remeber but not the name, i remeber this tool to test plugins with commands inside like /debug etc... to see what the plugins does, /rebuild and automaticaly reload when a new build is inside and was useful because you could see memo leaks etc

shadow night
orchid trout
#

using java 17 and 1.20 spigot

tender shard
#

show your pom.xml / build.gradle file

orchid trout
#

its not there

#

do i have to create it manually?

tender shard
#

are you not using maven or gradle?

orchid trout
#

probably not

tender shard
#

RIP

orchid trout
#

i just created java project

tender shard
#

did you manually add the dependency using eclipse?

orchid trout
#

yeah

tender shard
#

which one?

#

the one called spigot-api-1.20.1-R0.1-SNAPSHOT-shaded.jar?

orchid trout
#

spigot-api-1.20-R0.1-20230612.113428-32-shaded

tender shard
#

show a screenshot of your dependencies thingy pls

orchid trout
eternal oxide
#

just create a maven project, it's easier

tender shard
#

hm looks good. Well, I have no clue how eclipse meanwhile works, everyone should be using maven nowadays

orchid trout
#

oki

orchid trout
#

saviour

#

i couldnt find any updated tutorials

eternal oxide
orchid trout
#

why is there so much gunk

#

like what do the files even do bruh

tender shard
#

there is only one file, which is pom.xml

#

the rest are empty directories. you are supposed to put your classes into src/main/java

orchid trout
#

main.java

#

main.resources

tender shard
#

that are directories

#

btw because eclipse is confused it shows them as packages

#

because eclipse is not very smart. use a new project

orchid trout
#

oki

#

way ahead of you

tender shard
#

tbf eclipse's maven integration is really really bad. that's why I switched to IJ

orchid trout
#

i just wanted to switch to eclipse because why not

eternal oxide
#

I love Eclipse 😉

tender shard
#

yeah well for example the tab completion is bad, the auto-fixes suggest total bullshit sometimes, and as you see, the maven integration is also bad

smoky anchor
#

Why is geol not here rn, would be perfect

orchid trout
#

why can i create packages and folders

#

arent they the same

tender shard
#

no

orchid trout
#

ok

tawdry echo
#

first message in minecraft is send and why I don't have permission nor am I an operator later

tender shard
#

what are you even trying to do?

tawdry echo
#

block command process if player dont have permission and list from config dont contain that command and in send event retainAll by list from config

tender shard
#

But you dont do anything in your CommandPreProcessEvent

#

All you do is send a message

tawdry echo
#

i do

#

but i cut it

#

beacuse it dont return when i'm op

#

but i came up with idea to make list with ignored nicks

#

Yeah that worka

median magnet
#

How on earth can I get the side of a sign from PlayerInteractEvent? trying to check the sign side for dyeing / glowing

vast ledge
#

cast sign to the block

#

the get ur data

tender shard
#

probably you gotta check the clicked blockface, then check the sign's rotation, then manually check whether it must have been the front or back side

#

e.g. if the sign's front points to west, and the clicked block face is west too, it must have been the back side

median magnet
#

right, that's frustrating but makes most sense! Thank you

#

A little newer to bukkit dev, always happy to dig through the docs but seeing as you're here could you point me to where I can check rotation?

#

oh its in blockface?

tender shard
hazy parrot
#

You seem to misunderstand, connection pooling have nothing to do with async execution of queries

vital sandal
#

can any one help me a bit :l

grim ice
#

Hey

#

been a long time help-dev

#

anyway- does anyone know if its possible to get a user's cps inside a ui

eternal oxide
#

what UI?

tender shard
#

if the UI is an inventory, sure

agile anvil
#

Listen inventoryclick, count clicks but it's really not accurate

tender shard
#

if the UI is the escape menu, ofc not

smoky anchor
#

wait I misread lul

eternal oxide
#

I do that, a lot 😉

cobalt thorn
quaint mantle
#

How do I merge 2 inventories

#

1st inventory copy to 2nd inventory

desert tinsel
#

Any Idea how I can check if a player moves an item from his inventory into another one, cause InventoryMoveItemsEvent calls just for hoppers, and with InventoryClickEvent you cant check if an item is moved from an invetory to another one and with InventoryDragEvent doesnt work with shift + click. ig?

smoky anchor
#

InventoryDragEvent is/was for touchscreens iirc

desert tinsel
#

idk

#

then

smoky anchor
#

I guess there is no event for this, you'd have to implement some logic yourself

eternal oxide
#

dragevent fires when you drag a stack across multiple slots

smoky anchor
#

Oh that's a different one then

eternal oxide
#

inventory click will fire when you click a slot. drag fires when you move the mouse a pixel while clicked

desert tinsel
#

can I use InventoryClickEvent and check if player's opened inventory is a chest or an ender chest?

#

ig it should kinda work

karmic mural
desert tinsel
#

ye ik

timid onyx
#

hello, is there any way that I can get all possible BlockStates of a block using Spigot API?

storm granite
#

HOW can i send a hexcode of any colour in chat? i have no idea i sorry i new to this

eternal oxide
#

A BlockState is just a snapshot of a Block

storm granite
#

I already have a method for string to COLOR, but not CHAT color

frigid rock
#

how should i integrate spigotapi with my next.js app? rest api? are there better solutions?

timid onyx
eternal oxide
#

there is no such thing as a BlockState key

smoky anchor
storm granite
smoky anchor
#

yes

storm granite
#

hang on ill make a spigot accoutn so i can send images

smoky anchor
#

?img

undone axleBOT
storm granite
smoky anchor
#

What Color are you using ?

stuck notch
#

Yo

storm granite
smoky anchor
#

also, your "parseHexColor" is useless since you can just do Color.fromRGB(0x9aecdb)

#

Ok, what version are you making the plugin for ?

stuck notch
#

im new to java and mc plugin development how do i get the spigot api library sorry if im saying the name wrong im from c++ i dont know what libraries are called in java

storm granite
#

1.19.4

smoky anchor
#

oh ok, well I am sure there is a better way to do that but I am too lazy to think rn
I just think having the way I suggested in code is better

eternal night
smoky anchor
eternal night
#

both handle downloading the dependency for you

stuck notch
storm granite
eternal night
stuck notch
#

wait i think i have the maven source code

eternal night
#

if you want to follow a guide

smoky anchor
timid hedge
#

Can someone help me with this
Im trying to make so when you are clicking on a sign and if the second line is "ABSORPTION" you will get absorption by clicking on the sign
Code:

    @EventHandler
    public void onChange(SignChangeEvent e) {
        Player p = e.getPlayer();
        if ((e.getLine(0).equalsIgnoreCase("buffs"))) {
            if (isPlayerInGroup(p.getPlayer(), "admin") || isPlayerInGroup(p.getPlayer(), "h-admin")) {
                e.setLine(0, "---------");
                e.setLine(1, "ABSORPTION");
                e.setLine(2, "Click here");
                e.setLine(3, "---------");
            }
        }
        
    public void onInteract(PlayerInteractEvent e) {
            BlockState bs = e.getBlock().getState();
            if ((bs instanceof Sign)) {
                Sign sign = (Sign) bs;
                String line1 = sign.getLine(1);
                if(line1.equals("ABSORPTION")) {
                    p.addPotionEffect(new PotionEffect(PotionEffectType.ABSORPTION), 4);
            }
        }
    }

eternal night
#

beyond the fact that that isn'T valid java

#

e.getBlock().equals(Action.RIGHT_CLICK_BLOCK)

#

A block tends to never be a RIGHT_CLICK_BLOCK action

smoky anchor
#

if ((e.getLine(0).equalsIgnoreCase("buffs")))
Too many ()

#

omg you have it there two more times
And for one if you just don't put any....

timid hedge
#

Check now

eternal night
#

missing event handler annotation

timid hedge
#

But when i have @EventHandler
It says Annotations are not allowed here

eternal night
#

You are missing closing brackets kekw

#

you never close your onChange method

#

is your IDE not screaming at you ??

timid hedge
#

Nope

smoky anchor
#

What IDE are you using ?

#

literally anything should yell at you for having syntax errors

glossy venture
#

notepad

smoky anchor
stuck notch
#

are u kidding me

glossy venture
#

lmao

stuck notch
#

i need to rewrite huge chunks of code

#

because of maven

#

lol

eternal night
glossy venture
#

use gradle

eternal night
#

what the fuck would yield a rewrite of code because of a build tool

stuck notch
#

maven doesnt accept how i do

#

classes

timid hedge
#

I was just getting some erorors, nothing else

But this dosent still work
e.getPlayer().addPotionEffect(new PotionEffect(PotionEffectType.ABSORPTION), 4);

eternal night
stuck notch
#

and i have like 19 classes

smoky anchor
stuck notch
#

bro

#

i saw on the website

#

u sent me

eternal night
#

maven just calls the java compiler

stuck notch
#

then wtf is the website on abt

eternal night
#

what part are you talking about

smoky anchor
stuck notch
#

about public classes

eternal night
#

I mean

#

that is an example

#

your classes don't need to be public

#

lol

stuck notch
#

Oh k

#

god java is weird

#

c++ is alot easier

#

ngl

eternal night
timid hedge
smoky anchor
#

Ye, so you add those where they are expected

#

It literally holds your hand with syntax

timid hedge
#

Okay but its fixed now

Do you know why my potion effect is not working

smoky anchor
#

Is your IDE giving you an error of any kind ?

#

I assume it should

#

two maybe even

timid hedge
#

Its but i cant send photo and its very long

smoky anchor
#

?img

undone axleBOT
smoky anchor
#

it can't be that long

#

your parameters are wrong, it tells you that the constructor you are trying to call does not exist/has different arguments

#

@stuck notch I do not provide support in DMs

eternal night
flint coyote
timid hedge
#

Why dosent this work
e.getPlayer().addPotionEffect(PotionEffectType.ABSORPTION, 999999, 4);
Cannot resolve method áddPotionEffect(PotionEffectType, int, int)´

smoky anchor
eternal night
#

reading is hard

flint coyote
#

how are you supposed to help with a broken discord?

smoky anchor
#

just told them to restart
honestly can't do more

flint coyote
eternal night
#

the ✨ spicy ✨ addPotionEffect method

shadow night
#

Lol

#

What was it called when you can have multiple methods with one name but different arguments?

flint coyote
#

overloading

eternal night
#

overloading

timid hedge
#

Why does the lines on the sign not be setted?

    @EventHandler
    public void onChange(SignChangeEvent e) {
        Player p = e.getPlayer();
        if ((e.getLine(0).equalsIgnoreCase("buffs"))) {
            if (isPlayerInGroup(p.getPlayer(), "admin") || isPlayerInGroup(p.getPlayer(), "h-admin")) {
                e.setLine(0, "------");
                e.setLine(1, "ABSORPTION");
                e.setLine(2, "Click here");
                e.setLine(3, "------");
            }
        }
        if ((e.getLine(0).equalsIgnoreCase("heal"))) {
            if (isPlayerInGroup(p.getPlayer(), "admin") || isPlayerInGroup(p.getPlayer(), "h-admin")) {
                e.setLine(0, "------");
                e.setLine(1, "HEALTH");
                e.setLine(2, "Click here");
                e.setLine(3, "------");
            }
        }
    }

    @EventHandler
    public void onInteract(PlayerInteractEvent e) {
        Player player = e.getPlayer();
        BlockState bs = e.getClickedBlock().getState();
        if ((bs instanceof Sign)) {
            Sign sign = (Sign) bs;
            String line1 = sign.getLine(0);
            if(line1.equals("buffs")) {
                e.getPlayer().addPotionEffect(PotionEffectType.ABSORPTION.createEffect(999999, 4));
            }else if ((line1.equals("HEALTH"))) {
                e.getPlayer().setHealth(20);
            }
        }
    }
}
shadow night
#

That was it

eternal night
#

kekw fabsi was faster tho

shadow night
#

Internet speed be like

#

Any protocol lib experts here? Need to hide player armor

smoky anchor
#

I feel like I answered that yesterday

#

was it packet 0x55 ?

shadow night
#

Yeah

#

I just don't get how it's done

smoky anchor
#

you sent the packet to players so they don't see that players armor.

#

you want to hide one players armor from other players, right ?

shadow night
#

Yes

smoky anchor
#

So where exactly are you stuck ?

shadow night
#

At understanding how I have to do that

smoky anchor
#

So you don't know how to send packets to players with ProtocolLib

shadow night
#

No

#

I need to learn that

#

But I tried reading some stuff google told me, but I don't get any further

smoky anchor
#

I assume you have tried something like this then

shadow night
#

Something like that, but with PacketType.Play.Server.ENTITY_EQUIPMENT, so, now I have a PacketContainer and Idk what to write

smoky anchor
#

I believe you construct the packet based on this

#

container.getInts().write(??, entityId)

green plaza
#

Can i create custom ShapedRecipe when i have to add 5 blocks to each crafting slot without using CraftItemEvent?

shadow night
eternal night
#

The creation of the packet is the easier bit

onyx fjord
#

y is protocollib so low level 🤔

eternal night
#

you have to ensure to filter later packets too

shadow night
#

Yeah

#

But I have no idea how to do either

smoky anchor
green plaza
#

Any method to do this without events?

smoky anchor
eternal night
#

Well

#

the packet serves a lot of things

#

not just armor

#

also in hand item

smoky anchor
#

well that would be easy, just don't do anything if the equipment is-
nvm.. it's array -> you'd have to modify the packet to remove the armor part

eternal night
#

Yeaaaa kekw

ionic terrace
#

Does anyone know how to make items look enchanted? I'm trying to make a player head look enchanted but I can't find a way to do it

smoky anchor
#

give it an enchant, set itemHideFlag to hide enchantments

sterile breach
#

HI, i want print my cooldown comands in h/M/m
how to do (because my cooldown is in ms)

smoky anchor
sterile breach
#

i have alrady try

shadow night
upper hazel
#

what name can i give if it is a breed of team fortress game could there be copyright issues))

smoky anchor
#

Fortress Teams

upper hazel
#

is it the same no?

smoky anchor
#

I clearly switched the order of the words and added 's'
as the law* is concerned it is something completely different
*not an actual law advice

upper hazel
#

Ie in law this not one thing and, too,?

smoky anchor
#

w h a t
Where did your English go

upper hazel
#

bro i not engl i use traslate))

shadow night
#

English did /vanish

smoky anchor
shadow night
#

Ploho angliskiy v shkole uchil

upper hazel
#

So in a legal sense it's not the same thing?

smoky anchor
#

sounds Polish
HMM

smoky anchor
shadow night
#

Polish is jeden miliard siedemset dwadzieścia osiem miliardów sto sześćdziesiąt dwa miliony trzysta dwadzieścia tysięcy sto dwa.

#

(Pls don't ban me)

smoky anchor
#

just number innit

shadow night
#

Yes

#

How do you know?

smoky anchor
#

172817232102
or something idk

shadow night
#

Bruh

#

That was quick

smoky anchor
#

I mean you can guess how I can read this, should not be hard

shadow night
#

What about "jedno piwo proszätm"

smoky anchor
#

"one beer please"

shadow night
#

Yes

#

Nice

smoky anchor
#

note: I know no Polish

shadow night
#

So, when will my beer come?

smoky anchor
#

when you send a packet asking for it

shadow night
#

🗿

tribal valve
#

i get Could not pass event EntityDamageByEntityEvent
with this code:

@EventHandler
public void onPlayerDamage(EntityDamageByEntityEvent e) {
    if (e.getEntity() instanceof Player && e.getDamager() instanceof Zombie) {
        Player player = (Player) e.getEntity();
        //may add only add if damager is a player too (later/vote)
        this.cooldown.put(player.getUniqueId(), System.currentTimeMillis());
        BukkitRunnable task = new BukkitRunnable() {
            @Override
            public void run() {
                Long TimeLeft = (5000 - (System.currentTimeMillis() - cooldown.get(player.getUniqueId())));
                player.getPlayer().sendMessage(Long.toString(TimeLeft) + Boolean.toString(TimeLeft >= 1));
                if (TimeLeft >= 1) {
                    if (bossBars.get(player.getUniqueId()) == null) {
                        player.sendMessage("1");
                        String title = "ANTY-LOGOUT: " + Long.toString(System.currentTimeMillis() - cooldown.get(player.getUniqueId()));
                        BossBar bar = Bukkit.createBossBar(title, BarColor.RED, BarStyle.SEGMENTED_20);
                        bar.setProgress(TimeLeft);
                        bar.addPlayer(player);
                        bar.setVisible(true);
                    } else {
                        player.sendMessage("2");
                        BossBar selectedBossbar = bossBars.get(player.getUniqueId());
                        String title = "ANTY-LOGOUT: " + Long.toString(System.currentTimeMillis() - cooldown.get(player.getUniqueId()));
                        selectedBossbar.setProgress(TimeLeft);
                        selectedBossbar.setVisible(true);
                        selectedBossbar.setTitle(title);
                    }
                } else {
                    player.sendMessage("3");
                    cancel();
                }
            }
        };
        task.run();
    }
}
upper hazel
#

how is the plugin version usually written if it is a beta version for example "FortressTeam- 0.1" ?

smoky anchor
#

?paste

undone axleBOT
smoky anchor
tribal valve
#

oh wait, there's a cause

smoky anchor
#

Progress must be between 0.0 and 1.0 (5000.0)

upper hazel
#

hah

tribal valve
#

yea i saw it, but how i can do so that 5000 is 1.0, 4000 is 0.8 etc.

smoky anchor
#

/5000

#

devide by 5000.0

tribal valve
#

okay i'll try

smoky anchor
#

also, go back to school to learn basic math

#

(it will be really embarrasing if I am wrong lol)

upper hazel
tribal valve
#

bad at math tho

smoky anchor
#

clearly, just study more, you might get it one day

upper hazel
#

where the probabilities each have their own weight

tribal valve
#

i know probabilities

upper hazel
#

right there almost all the bukkit inhabitants?

#

Who knows what is the most difficult thing to do in projects?

upper hazel
tribal valve
#

i used chat gpt once to help with my math, i got an f

upper hazel
#

you have to ask the right questions

hazy parrot
#

What question can be "righter" then calculate me xy lol

sterile breach
# smoky anchor https://www.javatpoint.com/convert-milliseconds-to-date-in-java probably

i found that's

            long notime = System.currentTimeMillis() - cooldown.get(p.getUniqueId());

// Conversion en heures, minutes et secondes
long seconds = TimeUnit.MILLISECONDS.toSeconds(notime) % 60;
long minutes = TimeUnit.MILLISECONDS.toMinutes(notime) % 60;
long hours = TimeUnit.MILLISECONDS.toHours(notime);

            p.sendMessage("Vous pourrez utiliser la commande dans :");
            p.sendMessage(hours + "h " + minutes + "min " + seconds + "s");

but, is reversed

young knoll
#

I imagine wolfram alpha is better for math

smoky anchor
sterile breach
smoky anchor
#

I am guessing
cooldown.get(p.getUniqueId()) - System.currentTimeMillis()

sterile breach
#

i use this
System.currentTimeMillis() - cooldown.get(p.getUniqueId());

smoky anchor
#

yes, so use what I sent instead

sterile breach
#

i try it

sterile breach
tribal valve
#

how i can delete bossbars from player cuz i got them a lot and don't have them stored

ivory sleet
sterile breach
#

i check

ionic terrace
#

I'm still very confused on how to apply the enchanted glowing effect on other items that aren't enchanted books or potions. Any ideas on how to do this on something like player heads?

Couldn't you do something like this?

    ItemMeta itemMeta = item.getItemMeta();
    itemMeta.addEnchant(Enchantment.ARROW_INFINITE, 1, true);
    itemMeta.addItemFlags(ItemFlag.HIDE_ENCHANTS);
tribal valve
#

.addEnchantment() ig

ivory sleet
#

well the client applies the glint effect based if there's a specific nbt tag in the itemstack

ionic terrace
#

With NBTTagCompound?

sterile breach
ivory sleet
#

Duration implements TemporalAmount, which have the method get(TemporalUnit), and then u use ChronoUnit instead of TimeUnit since ChronoUnit implements TemporalUnit

young knoll
#

Some items just don’t render the enchantment glow

#

Heads are one of them

ionic terrace
#

Oh... that sucks

ivory sleet
#

@sterile breach but anyway, just storing a timestamp of the cooldown trigger should do the work, regardless of Instant or using currentTimeMillis

smoky anchor
tribal valve
#

how do i remove these, they are not declared, like in a list or sum

sterile breach
# ivory sleet <@718154719524159610> but anyway, just storing a timestamp of the cooldown trigg...

with a code like this?

            long notime = - System.currentTimeMillis() - cooldown.get(p.getUniqueId());

// Conversion en heures, minutes et secondes
long seconds = TimeUnit.MILLISECONDS.toSeconds(notime + cooldown.get(p.getUniqueId())) % 60;
long minutes = TimeUnit.MILLISECONDS.toMinutes(notime + cooldown.get(p.getUniqueId())) % 60;
long hours = TimeUnit.MILLISECONDS.toHours(notime + cooldown.get(p.getUniqueId()));

            p.sendMessage("Vous pourrez utiliser la commande dans :");
            p.sendMessage(hours + "h " + minutes + "min " + seconds + "s");
ivory sleet
ivory sleet
sterile breach
ivory sleet
#

that does not make sense at all

#

or well

#

maybe

timid hedge
ivory sleet
#

Delor

#

try

sterile breach
timid hedge
#

line 1 on sign is line 0 right?

ivory sleet
#

long cooldownTime = ...;
long notime = cooldownTime - cooldown.get(p.getUniqueId()) + System.currentTimeMillis()

sterile breach
#
  • System.currentTimeMillis()?
#

are you sure?

ivory sleet
timid hedge
#

Idk wgat is wrong with this
I dont get any errors and when im trying this im not getting the message

        if ((e.getLine(0).equalsIgnoreCase("buffs"))) {
            if (isPlayerInGroup(p.getPlayer(), "admin") || isPlayerInGroup(p.getPlayer(), "h-admin")) {
                p.sendMessage("ewadad");
sterile breach
ivory sleet
#

?

#

but anyway

#

its really cringe and awkward not to use Instant and Duration

sterile breach
#

so i can't add it no?

ivory sleet
#

idk why u're making it so hard for urself

sterile breach
#

ok i will try to add it then

sterile breach
#

yes

ivory sleet
sterile breach
ivory sleet
#

yes

sterile breach
ivory sleet
#

yes

sterile breach
#

ok ok I implement all this and I come back

torn shuttle
#

it would be a huge coincidence but has anyone else here run into an issue where slimes when mounting entities won't move?

#

as in the mounted entity won't move

#

it seemed to be working for 1.18.1 but at least testing 1.19.3 and 1.19.4 it looks like they're no longer moving

sterile breach
# ivory sleet yes

quesiton,

cooldownManager.setCooldown(p.getUniqueId(), Duration.ofSeconds(CooldownManager.DEFAULT_COOLDOWN));
with what i replace default cooldown?

ivory sleet
#

Duration.ofSeconds(CooldownManager.DEFAULT_COOLDOWN) --> Duration.ofSeconds(3)

#

that would be 3 seconds

#

u can use Duration.ofHours(4)

#

that'd be 4 hours

sterile breach
#

okay

sterile breach
# ivory sleet that would be 3 seconds

okay so, alrady what i place here?
long notime = System.currentTimeMillis() - cooldown.get(p.getUniqueId());
// 10 - 8 = 2000 -> 2
long seconds = notime / 1000;
long minutes = (seconds / 60) % 60;
long hours = (seconds / 3600) % 24;

            long remainingSeconds = 60 - (seconds % 60);
            long remainingMinutes = 60 - (minutes % 60);
            long remainingHours = hours;

            p.sendMessage("Vous pourrez utiliser la commande dans :");
            p.sendMessage(remainingHours + "h " + remainingMinutes + "min " + remainingSeconds + "s");
smoky anchor
#

I feel a 🥄 coming soon

ivory sleet
#

Duration cooldownTime = cooldownManager.getRemainingCooldown(p.getUniqueId());
if (cooldownTime.isPositive()) {
p.sendMessage("%sh %sm %ss".formatted(cooldownTime.toHoursPart(),cooldownTime.toMinutesPart(),cooldownTime.toSecondsPart()));
}

sterile breach
#

i try

sterile breach
smoky anchor
#

formatted

stuck notch
#

Oh my god

#

this org.bukkit

#

dependency

#

Hw

#

ive tried everything

upper hazel
#

is it possible to use the enum class for 2 different objects in terms of properties and structure? e.g. beam gun and bomb in bukkit api

sterile breach
#

yes, but it disturbs me the %sh%

ivory sleet
#

thats just string format

sterile breach
#

ah

ivory sleet
#

u can append the to...Part() if u want

#

(instead)

upper hazel
# sterile breach okay so, alrady what i place here? long notime = System.currentT...

use this private static final Map<Character, Integer> UNIT_SECONDS = new HashMap<>();

static {
    UNIT_SECONDS.put('s', 1);
    UNIT_SECONDS.put('m', 60);
    UNIT_SECONDS.put('h', 3600);
    UNIT_SECONDS.put('d', 86400);
}

public static long convertTime(String timeStr) {
    char unit = timeStr.charAt(timeStr.length() - 1);
    try {
        long value = Long.parseLong(timeStr.substring(0, timeStr.length() - 1));
        return value * UNIT_SECONDS.get(unit);
    }catch (NumberFormatException e){
        throw  new RuntimeException(ChatColor.RED + "неправильный формат времени",e);
    }
}
ivory sleet
#

na no need to

#

just use Duration lmao

eternal oxide
#

just learn to use Duration as Conclure said

upper hazel
#

line feed in time?

upper hazel
ivory sleet
#

yes but just because YOU dont want to doesnt mean you should go around just feeding ur code to others arrogantly

upper hazel
#

I have speeded up the process
)

eternal oxide
#

Instant and Duration are two of THE most useful classes in Java for managing times

ivory sleet
eternal oxide
#

every situation

ivory sleet
#

yeah sometimes u wanna use Period instead of Duration

#

but like thats it

eternal oxide
#

yeah

upper hazel
sterile breach
#

no probleme

ivory sleet
sterile breach
#

@ivory sleet you will find his beast but I can not understand where the error comes from
p.sendMessage("%sh %sm %ss".format(cooldownTime.toHoursPart(),cooldownTime.toMinutesPart(),cooldownTime.toSecondsPart()));

ivory sleet
#

.formatted(...)

upper hazel
#

my method is convenient as for me because you don’t need to mess with the format

ivory sleet
#

yes but I wouldn't trust ur method to cover all error cases

upper hazel
#

what you mean

ivory sleet
#

for instance

#

if i pass an empty string to ur method

#

it would break

upper hazel
# ivory sleet for instance

}catch (NumberFormatException e){
throw new RuntimeException(ChatColor.RED + "неправильный формат времени",e);
}

ivory sleet
#

thats outside lol

#

char unit = timeStr.charAt(timeStr.length() - 1);

sterile breach
#

good @ivory sleet that's work

thanks for your help it's been 5 hours that I was looking for how to do it

upper hazel
#

oh

upper hazel
#

it can be improved but i still think it depends on the situation.

ivory sleet
#

mye

#

well I just think u're reinventing the wheel

#

but if it works for u, then ye

upper hazel
#

it all depends on the seriousness of the relationship and the accuracy of the time

#

but this is bukkit api i think this not mistake

ivory sleet
#

ok

upper hazel
#

I don't take the bukkit api too seriously)

ivory sleet
#

lol ok

sterile breach
#

@ivory sleet last question, how is it that I have access to functions such as toHoursPart() which are not in coldownManager, it is integrated into the java time system?

ivory sleet
#

yes just like HashMap

#

these are classes from the java standard library

#

made for u to use :)

ivory sleet
upper hazel
ivory sleet
#

Im telling Delor

upper hazel
#

щл

#

Ok

ivory sleet
#

👍

sterile breach
ivory sleet
#

iirc toHoursPart goes from 0 to 24

#

if u get to 25 hours it'd be 1

#

toHours can go 24+

sterile breach
#

ah okay

sterile breach
ivory sleet
#

toMinutes() just

sterile breach
#

ah it detects on its own if the function is called before in the code?

ivory sleet
#

no

#

it basically uses modulo

sterile breach
#

ah okay

ivory sleet
#

so like the remainder of 90 divided by 60 is 30

sterile breach
#

but it still manages to detect if I call the function sooner

ivory sleet
#

therefore toMinutesPart() returns 30

#

waat

#

it has nothing to do with when u call it

flint coyote
#

to a block type as in material or a specific location?

eternal oxide
#

boundingbox

#

check for intersection

tribal valve
#

Range [0, 4) out of bounds for length 3 Line: 73
Line 73: String title = "ANTY-LOGOUT: " + Float.toString(TimeLeft.floatValue() / 1000).substring(0, 4);
Why, it works but gives this error
Code: https://paste.md-5.net/mitutuwume.cs

eternal oxide
#

Your Float toString doesn;t have 4 digits

tribal valve
#

yea i know but why, it gives just a few errors

#

7 to be exact

dire marsh
#

hmm, I'm adding a gradle dependency, and it gets "resolved" successfully, but it doesn't get added to external libraries in IntelliJ, and when I go check the cache, I can see it downloaded the .pom and .module, but not the jars, what would cause that to happen? I've tried invalidating caches, deleting .gradle, and restarting, but it still happens, I can only assume there's something wrong with that dependency as others are working fine

eternal oxide
#

you can;t subString longer than the original string

tribal valve
#

yea i know but it should give so many errors and it only gives 7, and i update the timer every tick

eternal oxide
#

it errors when your float doesn;t have enough digits

tribal valve
#

i'll try to catch the error

ivory sleet
#

use String::format else

#

String.format("%.4f",myFloat)

#

that will make it always have 4 decimals

#

else u have DecimalFormat

tribal valve
#
                String title;
                        try {
                            title = "ANTY-LOGOUT: " + Float.toString(TimeLeft.floatValue() / 1000).substring(0, 4);
                        } catch (StringIndexOutOfBoundsException e){
                            player.sendMessage("catched it, michel jorden ");
                            title = "ANTY-LOGOUT: " + Float.toString(TimeLeft.floatValue() / 1000).substring(0, Float.toString(TimeLeft.floatValue() / 1000).length());
                        }
``` i did this and it catches it, but i'll try to use your code
#

oh wait it gives error

#

but different

eternal oxide
#

length - 1

tribal valve
eternal oxide
#

yeah I didn't think before responding on that one

tribal valve
#
org.bukkit.event.EventException: null```
```Caused by: java.lang.NullPointerException: Cannot invoke "java.lang.Long.longValue()" because the return value of "java.util.HashMap.get(Object)" is null```
```if (System.currentTimeMillis() - cooldown.get(player.getUniqueId()) <= 5000)``` this is causing it
#

i think its because there's no player in the cooldown hashmap

eternal oxide
#

theres no cooldown for that player

delicate fable
eternal oxide
#

Not looked at your code as you are doing your own loading, but to access across plugins you are going to need your classes on the same ClassLoader

ivory sleet
#

It uses a lock

#

But not a classic lock

#

Its more likr AtomicReference

#

Where it guarantees atomicity

#

All or nothing

#

(ACID) atomicity, consistency, isolation and durability

#

And yes connection pooling has something to do with async execution of queries

#

They’re related to some degree

#

The point of connection pooling is first of all to not waste resources on invoking new connections all the time

#

Much like thread pool

#

But if u do everything synchronous it doesn’t really matter because you will only ever need 1 connection, and possibly cache it also for reuse

#

U know how compareAndSet works?

#

Didnt emily tell u that

#

Similarly, that’s what happens in databases

eternal night
#

cas 🥰

ivory sleet
#

^

#

Over a single connection all queries would run one after the other

#

But like in terms of implementation these databases try as much as possible to avoid large locking sessions

#

So if possible, it will run multiple queries at the same time (if received from 2 different connections)

#

And by if possible I mean normally pretty much

#

Tho in a lower level of abstraction it might be the case that CAS mechanics are implemented on individual operations

#

Basically u know when u run i++

#

Myes

#

There is usually a specification manual per database that talks about it

#

Since its implementation

#

Anyway in java using i++ is compiled into several operations, get the value of the variable i, increment it, set the value back to the variable

#

Now if 2 threads run i++ at the same time

#

There’s no guarantee that the order will follow:
thread1 get value
thread1 increment value
thread1 set value

thread2 get value
thread2 increment value
thread2 set value

#

It could vey much be the case that
thread1 get value
thread2 get value

#

yes

#

So even tho i++ ran twice

#

It only incremented once

#

Now compareAndSet is iirc sometimes even implemented in hardware

#

But in java it guarantees that the increment happened or not

#

There’s no indeterminacy

#

now java with AtomicReference will just endlessly loop compareAndSet until the value has been set (to make it consistent)

#

Anyway continuing with the connection pooling

#

Its good because connections are expensive

#

And it helps if u have access to concurrency since you can basically to some extent achieve parallel queries

#

(Concurrent is probably the better term)

#

it makes the 3 step process into just one

#

which is more expensive than the 3 step process

#

But it guarantees that the entire operation either succeeded or didnt at all

#

With hardware

#

Hardware has built in instructions

#

AtomicReference#getAndUpdate calls VarHandle#weakCompareAndSet or sth

#

And VarHandle at the end will delegate to low level hardware stuff

#

Yes

#

And its not bad at all

#

And connection pooling is usually what u want

#

Because it acts like a semaphore to save resources

#

Whilst not restricting the concurrency

#

Just don’t listen and trust everything that’s said in these help channels, sometimes people got it wrong, even me rarely

#

Heah

#

Yea

delicate fable
ivory sleet
#

Ask away

#

Depends

#

I mean is this a public plugin?

hazy parrot
#

What info are you storing

ivory sleet
#

LuckPerms has it so that u can have split storage

#

That is, users in 1 db, groups in 1 db

#

But like I’d probably use postgre for all my data

#

Except log data

shell robin
ivory sleet
#

I know ppl use mongo, but if my data scales I’d def want postgre

shut estuary
#

Has anyone gotten a jetty server with jsf to work on spigot?

hazy parrot
#

What issues are you having

shut estuary
#

A blank xhtml page.

hazy parrot
#

Thare may be that you have to temporary change classloader when setting up jetty

#

Enable jetty debug and see logs

#

It's probably missing dependency which can't be loaded with spigot classloader, had that issue before

shut estuary
#

There's just nothing in the logs. :/

hazy parrot
#

Have you enabled debugging

shut estuary
#

Yep.

jolly forum
#

Hi, how with SkinRestorer api can I set a skin that is present on a particular url?

quaint mantle
#

hello, how to get gradle access to craft bukkit and nms? It was possible in 1.19 with compileOnly 'org.spigotmc:spigot:1.19-R0.1-SNAPSHOT'
but now its not with newer versions

tribal valve
#

how i can change the title to be for example: 21.37 and 07.41 instead of 15.32 and 5.812
String title = "ANTY-LOGOUT: " + String.format("%.5f",(TimeLeft.floatValue() / 1000)).substring(0, 5);

distant wave
#

hey guys i have this in my playermove event and when player is swimming its speed multiplies alot, it doesnt seem to bve normal

#

even if its 1

tribal valve
#

you should do get velocity instead of get direction

#

direction is not the same as velocity

distant wave
#

then

#

if i use velocity

tribal valve
#

event.getVelocity()

distant wave
#

oh i used this

delicate fable
tribal valve
distant wave
tribal valve
#

maybe try player velocity event instead of move?? idk

#

in player velocity event you have .getVelocity

distant wave
#

ye i see

tribal valve
#

if you don't want player jumping out of the water you can store velocity as a variable and reset the z value

distant wave
tribal valve
#

what do you want to achive

distant wave
tribal valve
#

give him hidden dolphin potion

#

also try to multiply it by 0.3 or something, it can take floats

distant wave
#

obv the amplifier would change

#

but im not sure about the duration

tribal valve
#

you can do any duration and when player is not swimming just remove the effect

tender shard
#

oh no wait

#

other way around, so yeah, like this

tribal valve
#

ambient are sounds i think

distant wave
#

i still see the icon in inv for a short amount of time is it possible to remove it

tender shard
#

docs say ambient "Makes potion effect produce more, translucent, particles."

#

so yeah definitely set ambient, particles and icon to false, then it's basically "invisible"

distant wave
#

right

worldly ingot
#

Ambient just means the particles are semi-transparent

#

So if particles is false, obviously ambient isn't relevant because there are no particles

cinder abyss
#

Hello, how can I use multiple nms with maven ?

quaint mantle
#

hello there, I need some help with using spigot with gradle

chrome beacon
#

One module per nms version

cinder abyss
quaint mantle
#

why not gradle though

chrome beacon
#

There are a few

#

Or just develop against unmapped

#

That works fine too

delicate fable
rare rover
#

but it uses paper so

#

for gradle

chrome beacon
#

Paper has offical gradle tooling

quaint mantle
#

can I also get craftbukkit with paper?

tribal valve
#

how i can change the time of tnt explosion

rare rover
#

spigot is a fork of bukkit

#

therefore yes

quaint mantle
chrome beacon
rare rover
tribal valve
#

i have so much respect for the people who created skript, i can't even create a config file

chrome beacon
#

?configs

undone axleBOT
chrome beacon
torn shuttle
#

this sucks, I'm in so much pain from the gym that I can barely think about the code I'm supposed to be writing right now

tender shard
#

that's why prescription painkillers exist - to help you coding

torn shuttle
#

how's rehab alex

tender shard
#

I'm at home since may 9th

#

no wait

#

june 9th

sterile breach
#

Hi, i have 2 questions about gui.

I want made a page system. To know/get the player's page is make an int page in the event ?

Second question, i think, get a gui with the name can be dangereus. So, how to do ?

kind hatch
#

Instance checks solves all.

tender shard
#

store your currently open inventories in a Map<Inventory,YourInventoryData>. YourInventoryData is a class that contains all the information you need - current page, etc

torn shuttle
#

even better <player, CustomInventoryObject>

#

odds are players aren't meant to have more than one at a time anyhow

sterile breach
#

Ah i stock the player ?

torn shuttle
#

it's the easier way of doing it in my experience

hybrid spoke
#

what should happen

torn shuttle
#

use UUID not player object but it doesn't matter that much because your should be wiping the data properly on inv close anyhow

flint coyote
#

Player as key is fine as long as you clear it on disconnect

torn shuttle
#

only if you do it wrong