#help-development

1 messages ยท Page 1601 of 1

native nexus
#

I am on my phone

#

I can only see so much

maiden briar
#

player.getActivePotionEffects().clear(); does not remove any potion effects?

lost matrix
maiden briar
#

Oh I can just for-loop them and then call that method, ok

#
for(PotionEffect potionEffect : new ArrayList<>(onlinePlayer.getActivePotionEffects()))
    onlinePlayer.removePotionEffect(potionEffect.getType());
lost matrix
maiden briar
#

Ok, my method is also working, but thx

#

I made new ArrayList for safety

lost matrix
#

the new ArrayList<>( is obsolete

maiden briar
#

Yes, but it will remove the potion effects from the list, so I get CurrentModificationException

lost matrix
#

Probably not.

maiden briar
#

Ok

hoary knoll
#

anyone know anything about gradle?

maiden briar
#

Is it a clone then?

hardy swan
#

If it is not

hardy swan
maiden briar
#

No it does not work

#

so then it is a clone, right

hardy swan
#

Yes hence

#

It is a clone

ivory sleet
smoky oak
#

java.util.LinkedHashSet cannot be cast to class java.util.List
and what I'm trying to do is do getKeys on a config to use as a List<String> for a command tab complete

ivory sleet
#

yes well LinkedHashSet does not implement List

#

It implements Set

smoky oak
#

can i convert them?

ivory sleet
#

And some other stuff

#

Yeah sure

#

return new ArrayList<>(conf.getKeys(...)); probably or smtng

hoary knoll
#

@ivory sleet have you used the api for gradle plugins. My issue is that they have deprecated some classes that im using but have not said how to fix it

smoky oak
#

great it works

#

its just in a weird order now

#

well thats fine

hardy swan
ivory sleet
late nexus
#

Does anyone know the config things that should be changed to get nether spawning good because there are barely spawning any mobs in the nether on my spigot server

hoary knoll
ivory sleet
ivory sleet
#

Itโ€™s getKeys()

hardy swan
#

Ohh lol

ivory sleet
#

FileConfiguration#getKeys underlying implementation detail yeah

#

Or maybe just Configuration idk

ivory sleet
# hoary knoll yes

Hmm I can redirect you to someone who knows a bit about gradle plugins if youโ€™d allow me to

hardy swan
#

Then yea, getKeys then

ivory sleet
hardy swan
#

Google?

quaint mantle
#

im trying to recreate hypixel skyblock
i am currently working on abilities / mana (gets lowered when u use an ability)
but idk how i would make a mana regen system?

#

any help?

#

Map<Player,Long> (long as mana)

nocturne coral
#

how do i change the level of a fluid (eg. water)

lost matrix
quaint mantle
#

the thing is if id regen it over time it will always become higher than the limit atleast once

#

actually i could check that

#

and set it to the limit if its over it

tribal perch
#

Hello there!
I've got an issue with my code regarding sign updates in minecraft.

I have explained my issue in the following thread more explicitly and have given some code samples withing my explanation of the issue i've got:

https://www.spigotmc.org/threads/sign-is-not-updating.518192/#post-4226993

maiden briar
#

How can I kick players if they join without this error? (PlayerJoinEvent)

[14:10:11 WARN]: java.lang.Throwable: [ERROR] Illegal PlayerChunkMap::addEntity for world world: EntityPlayer['tvhee'/359, uuid='2376f1f9-2b5e-352e-b71c-c5000e29a885', l='ServerLevel[world]', x=-95.87, y=66.00, z=187.25, cpos=[-6, 11], tl=2823160, v=false, rR=UNLOADED_WITH_PLAYER](tvhee at -95.86867269427883,66.0,187.25093546288687)
[14:10:11 WARN]:     at net.minecraft.server.level.PlayerChunkMap.addEntity(PlayerChunkMap.java:1982)
[14:10:11 WARN]:     at net.minecraft.server.players.PlayerList.postChunkLoadJoin(PlayerList.java:393)
[14:10:11 WARN]:     at net.minecraft.server.players.PlayerList.lambda$placeNewPlayer$1(PlayerList.java:301)
[14:10:11 WARN]:     at net.minecraft.server.network.PlayerConnection.tick(PlayerConnection.java:307)
[14:10:11 WARN]:     at net.minecraft.network.NetworkManager.a(NetworkManager.java:399)
[14:10:11 WARN]:     at net.minecraft.server.network.ServerConnection.c(ServerConnection.java:196)
[14:10:11 WARN]:     at net.minecraft.server.MinecraftServer.b(MinecraftServer.java:1578)
[14:10:11 WARN]:     at net.minecraft.server.dedicated.DedicatedServer.b(DedicatedServer.java:479)
[14:10:11 WARN]:     at net.minecraft.server.MinecraftServer.a(MinecraftServer.java:1406)
[14:10:11 WARN]:     at net.minecraft.server.MinecraftServer.x(MinecraftServer.java:1188)
[14:10:11 WARN]:     at net.minecraft.server.MinecraftServer.lambda$spin$0(MinecraftServer.java:316)
[14:10:11 WARN]:     at java.base/java.lang.Thread.run(Thread.java:831)
tribal perch
#

wait

maiden briar
#

I do that, but get this error

#

Shall I listen to PlayerLoginEvent?

tribal perch
#

show some code, then i'll look if i can help you.
Because currently, all i've got are your errors and i can't really do anything with it except guessing

eternal oxide
maiden briar
#

Ah, but I want to kick them with a message

tribal perch
#

playerJoinEvent.getPlayer().kickPlayer("Some reason");

eternal oxide
#

sorry I was looking at wroing event

maiden briar
#

PlayerLoginEvent has a method like #setKickMessage, can't I use that?

eternal oxide
#

yes

maiden briar
#

And smth like #setResult, do I also need to set that?

eternal oxide
#

call disallow

#

it should kick them and you can provide the message in the call

maiden briar
#

Ok

#

But which Result do I need to provide?

maiden briar
#

KICK_OTHER then

#

Ok thx for the help!

old cloud
#

Hello, I have a very weird error:

        at java.base/java.lang.Thread.run(Thread.java:831) [?:?]
java.lang.NullPointerException: Cannot invoke "org.bukkit.command.PluginCommand.setExecutor(org.bukkit.command.CommandExecutor)" because the return value of "qf.Main.getCommand(String)" is null
        at qf.Main.onEnable(Main.java:15) ~[?:?]
        at org.bukkit.plugin.java.JavaPlugin.setEnabled(JavaPlugin.java:321) ~[testserver.jar:git-Spigot-db6de12-18fbb24]
        at org.bukkit.plugin.java.JavaPluginLoader.enablePlugin(JavaPluginLoader.java:340) [testserver.jar:git-Spigot-db6de12-18fbb24]
        at org.bukkit.plugin.SimplePluginManager.enablePlugin(SimplePluginManager.java:405) [testserver.jar:git-Spigot-db6de12-18fbb24]
        at org.bukkit.craftbukkit.v1_8_R3.CraftServer.loadPlugin(CraftServer.java:357) [testserver.jar:git-Spigot-db6de12-18fbb24]
        at org.bukkit.craftbukkit.v1_8_R3.CraftServer.enablePlugins(CraftServer.java:317) [testserver.jar:git-Spigot-db6de12-18fbb24]
        at org.bukkit.craftbukkit.v1_8_R3.CraftServer.reload(CraftServer.java:741) [testserver.jar:git-Spigot-db6de12-18fbb24]
        at org.bukkit.Bukkit.reload(Bukkit.java:535) [testserver.jar:git-Spigot-db6de12-18fbb24]
        at org.bukkit.command.defaults.ReloadCommand.execute(ReloadCommand.java:25) [testserver.jar:git-Spigot-db6de12-18fbb24]
        at org.bukkit.command.SimpleCommandMap.dispatch(SimpleCommandMap.java:141) [testserver.jar:git-Spigot-db6de12-18fbb24]
        at org.bukkit.craftbukkit.v1_8_R3.CraftServer.dispatchCommand(CraftServer.java:641) [testserver.jar:git-Spigot-db6de12-18fbb24]
        at org.bukkit.craftbukkit.v1_8_R3.CraftServer.dispatchServerCommand(CraftServer.java:627) [testserver.jar:git-Spigot-db6de12-18fbb24]
        at net.minecraft.server.v1_8_R3.DedicatedServer.aO(DedicatedServer.java:412) [testserver.jar:git-Spigot-db6de12-18fbb24]
        at net.minecraft.server.v1_8_R3.DedicatedServer.B(DedicatedServer.java:375) [testserver.jar:git-Spigot-db6de12-18fbb24]
        at net.minecraft.server.v1_8_R3.MinecraftServer.A(MinecraftServer.java:654) [testserver.jar:git-Spigot-db6de12-18fbb24]
        at net.minecraft.server.v1_8_R3.MinecraftServer.run(MinecraftServer.java:557) [testserver.jar:git-Spigot-db6de12-18fbb24]
```obviously caused by this little piece of code:
```java
package qf;

import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.bukkit.plugin.java.JavaPlugin;

import de.spinanddrain.jumpnrun.JumpAndRun;

public class Main extends JavaPlugin {

    @Override
    public void onEnable() {
        
        getCommand("jnr").setExecutor(this);
        
    }
    
    @Override
    public boolean onCommand(CommandSender arg0, Command arg1, String arg2, String[] arg3) {

        if(arg0 instanceof Player)
            JumpAndRun.getInstance().startJumpAndRun((Player) arg0);
        
        return false;
    }
    
}
```Plugin.yml is that:
```yml
name: QuickFixForJNR
version: 1.0
main: qf.Main
command:
  jnr:

Am I stupid?

maiden briar
#

@eternal oxide PlayerLeaveEvent won't get called if I kick in PlayerLoginEvent?

eternal oxide
#

no

old cloud
#

makes sense that getCommand returns null then

regal carbon
#

Hey, im trying to make a plugin that makes a new world everytime the server reopens, mostly for one-off minigames i guess, but everytime i do /stop, the next time i open the server the map isnt recreated, but if i close out of the server by the X button, it works perfectly. how could i make /stop work?

#

plugins loads on post world, if it matters

gleaming grove
#

if this file not exists maybe every server close create this file on your own

#

a guess Raid data is not important when it comes to Minigames

unique eagle
#

Hello ! I try to put the player in an armorstand when it is in gamemode 3 can you help me ? ๐Ÿ™‚

tacit storm
lost matrix
unique eagle
#

i'm french my english is so bad x)

lost matrix
lost matrix
# regal carbon Hey, im trying to make a plugin that makes a new world everytime the server reop...

This is just a quick example but it should work.

  public static void unloadAndDelete(final World world) {
    final String worldName = world.getName();
    final File worldFile = world.getWorldFolder();
    Bukkit.unloadWorld(world, false);
    CompletableFuture.runAsync(() -> {
      while (Bukkit.getWorld(worldName) != null) {
        try {
          Thread.sleep(100);
        } catch (final InterruptedException e) {
          e.printStackTrace();
        }
      }
      worldFile.delete();
    });
  }

If you want to delete the world when the server shuts down then you probably need to do the busy waiting sync.

unique eagle
#

@lost matrixi have a another question ๐Ÿ™‚ it's possible to move armorstand with velocity with a passenger ?

unique eagle
#

okay thanks ๐Ÿ™‚

honest iron
#

java.sql.SQLException: java.lang.ClassFormatError: Truncated class file
For some reason, i'm trying to connect to MySQL remotely and getting this error, but i don't get this error when i connect in the same server

quaint mantle
#

Its me again recreating hypixel skyblock.

#

How would i create like groups where mobs spawn

#

so they dont spawn entirely over the map

#

only on specific locations?

#

is that hard?

honest iron
quaint mantle
#

nah just creating the basic things first

#

like on the hub island

#

im done with the ability system i can just add items rn

#

@honest iron

honest iron
#

sounds cool

quaint mantle
#

Also how would i do this:
I wanna add a specific amount to my max mana when i equip an armor piece or hold an item but it also need to be removed from my max mana when i unequip the armor/item

honest iron
#

through runnable

quaint mantle
#

idk how tho xD

unreal quartz
#

?scheduling

undone axleBOT
quaint mantle
#

I just dont know how i would detect if i (un)equip an item to add the stat

lost matrix
# honest iron through runnable

Dont use a runnable for that pls. @quaint mantle
You need to listen for events like InventoryClickEvent, PlayerPickupItemEvent, PlayerCangeMainHandEvent and so on.

sacred schooner
lost matrix
sacred schooner
#

I'm pretty sure it gets called because the blocks are set to air by default and the blocks placed apart from x == 0 are also white

quaint mantle
lost matrix
quaint mantle
#

huh

dusk flicker
#

It's difficult to listen for armor updates lol

lost matrix
# quaint mantle huh

Every event that could possibly change the content of a players inventory needs to be checked.

quaint mantle
#

ahh

dusk flicker
#

Thats why if you are really going to be doing a lot of them its a good idea to make a custom patch for the server to introduce an event for it imo

quaint mantle
queen niche
#

Im probaly doing a noob move but I hope someone can help me

#

But I get the error JavaPlugin cannot be resolved to a type I have added spigot 1.17 jar to my module path in build path.

#

`package me.timtendo12.dcattractie;

import org.bukkit.plugin.java.JavaPlugin;

public class Main extends JavaPlugin {

}
`

#

and im using JDK-16.0.1

quaint mantle
unreal quartz
queen niche
#

Well its added. I can even see it in my referenced library

unreal quartz
#

send a screenshot of your libraries

queen niche
vivid temple
#

how do you put when opening an anvil gui an item in it?

unreal quartz
#

i have no idea what eclipse's "modulepath" refers to, try adding it to classpath instead

queen niche
#

Nope doesnt do it either

eternal oxide
#

I use Eclipse and have no idea what a module path is

queen niche
#

When creating the project I chose this:

#

instead of JavaSE-15 since im creating a 1.17 plugin

unreal quartz
#

that's not your problem

queen niche
#

Hmm okay

unreal quartz
#

you need to add spigot as an external jar library, but i have no idea how to do that in eclipse

quaint mantle
#

m a v e n

eternal oxide
#

is there a reason you didn't create a Maven project? Spigot is all setup for Maven

queen niche
#

I just followed a spigot plugin tutorial and this is how many of them set it up in eclipse.

#

I have maven installed on my jetbrain IDE.

eternal oxide
#

maven is in Eclipse too

#

however, to add an external Jar, Project -> properties -> Java Build Path -> Libraries -> add external Jars

queen niche
#

I know

#

I did that

#

it only shows add external jars at module path and class path

eternal oxide
#

what jar specifically did you add?

queen niche
#

1.17.1 fresh from BuildTools

eternal oxide
#

and you added it via the method I just showed?

queen niche
#

Yes

eternal oxide
#

then theres no reason for it to not see it

queen niche
#

Exactly

#

but one of a reason it doesnt

quaint mantle
#

use maven and you wont have this problem

vivid temple
#

so how do i put an item in my anvil i tried

Anvil.setItem(0, customAmount);

but that didnt work

eternal oxide
#

can you show an SS of your expanded project structure (left pane) with libraries?

fluid cypress
#

what is the best way to automatically update plugins that are not my own? is there any spigot public api to get info on version history or something? or ill have to do web scraping stuff

queen niche
dusk flicker
#

There spiget but it's not the greatest; Id recommend just not doing auto updating on plugins you don't control

quaint mantle
lusty cipher
#

@vivid templeAnvils require NMS, use something like AnvilGUI or another library, its a bit complicated.

fluid cypress
eternal oxide
fluid cypress
#

nice

quaint mantle
#

auto updating is kinda stupid anyways, you can break stuff doing that

dusk flicker
#

Id recommend not auto updating as an author could upload anything and it'd auto be in your server and some authors release beta vers on spigot which shouldent be on prod servers

fluid cypress
#

mmm

#

well

#

nvm, ill just keep updating manually

queen niche
opal juniper
#

heyyyyyy @eternal oxide you said you updated the pathfinder... can i have it please.

eternal oxide
#

?paste

undone axleBOT
unreal quartz
#

low low price of $299.95

opal juniper
#

๐Ÿ˜ณ

eternal oxide
opal juniper
#

๐Ÿ‘

queen niche
#

is requires spigot; a must have in my module-info.java? it seems to have fixed my problem

#

but it does give me the warning: Name of automatic module 'spigot' is unstable, it is derived from the module's file name. so im not sure if I should use it or not

lost matrix
eternal oxide
#
Eclipse does have a 'create module-info file' option in the new Java project wizard. Unfortunately it is hidden way on the second page of the wizard and is easy to miss. It defaults to creating the file. โ€“ greg-449 Aug 28 '19 at 14:55
#

I'd disable that

quaint mantle
#

How do i disable item durability change

@EventHandler
    public void onDurabilityChange(PlayerItemDamageEvent e) {
        e.setCancelled(true);
    }

have that
but it doesnt work

#

i want it for EVERYTHING

tacit storm
#

Did you register the Listener Class in your Main Class ?

quaint mantle
#

yea

tacit storm
#

Try printing out a Message to see if it even calls the Method ?

quaint mantle
#

i get the message

#

but cancelling doesnt work?

tacit storm
#

hmm

quaint mantle
#

it works now

tacit storm
#

o

quaint mantle
#

instead of cancelling

#

i just set de dmg to 0

tacit storm
#

Yeah that would've been my next suggestion

quaint mantle
lost matrix
quaint mantle
#

groups of mobs as locations

lost matrix
# quaint mantle groups of mobs as locations

Just take an object oriented approach.
For example:

Class SpawnLocation

Location location;
int currentActiveMobs;
long lastSpawnTime;

Class SpawnDomain

Map<UUID, SpawnLocation>

Class SpawnManager

Map<CustomMobType, SpawnDomain>

Then iterate over all SpawnLocation instances and spawn mobs when needed. (Using warmup and cooldown timers)

lost matrix
eternal oxide
#

pretty sure if you have no file it won;t use it

#

Most of my plugins have been compatible with java 8 and module-info.java came in java 9. More recently I moved to Maven which is a dependency manager, so again uses no module-info.java

#

but if you are stuck on basic Eclipse projects, that post says its hidden on the second page of new project wizard.

manic bison
#

hey, anyone knows how to fire code when player equips or unequips armor ? (like helmet). i'm stuck because the code i tested when searching on google simply doesnt work

lost matrix
#

Every event that could modify the players inventory.

manic bison
#

i'm basically trying this

    {
    Player player = event.getPlayer();
    ItemStack helmet = player.getInventory().getHelmet();

    if (helmet.getType() == Material.CHAINMAIL_HELMET)
    {
    player.sendMessage("you put on a helmet");
    }
    }```
#

armorequipevent is a library i found on google

lost matrix
lost matrix
#

Thats a rule you should follow: First search in the event for information.

tacit storm
manic bison
#

yep i saw the usage

lost matrix
tacit storm
#

So you should prob. use these Methods stated in there

manic bison
#

but didnt quite understand it

tacit storm
#

Basically

#

getNewArmorPiece >> What the Player changed the Slot to
getOldArmorPiece >> What it got changed from

#

Is how I'm understanding it

manic bison
#

ohhh

#

makes more sense

quaint mantle
#

how can i make this work

manic bison
#

thanks both, i'mma try this right away

tacit storm
lost matrix
quaint mantle
tacit storm
#

\\ *

lost matrix
#

Two times \

tacit storm
#

I dont have brain atm haha

quaint mantle
#

is it supposed to be orange?

#

xD

tacit storm
#

ye

lost matrix
willow oar
#

I've tried for a couple of days to make a door to break when right clicked and it always breaks in half

tacit storm
hardy swan
#

but one more \ is added to escape the \ behind during compilation

quaint mantle
lost matrix
quaint mantle
#

ye

eternal oxide
shadow gazelle
#

I'm trying to make a bedwars plugin and I want to stop people from breaking blocks that weren't placed during the match, anyone have an idea of how I could do this?

#

I found a post with someone asking the same thing, but it was with metadata

eternal oxide
#

add any Blocks placed to a Set<Block>, if the block is in the Set allow it to be broken and remove it

sand rune
#

Guys I'm making a rank sys , but when I change the num of rank , the rank don't change ,why ? Using player.yml config

eternal oxide
sand rune
#

Explain More

eternal oxide
#

It measn you literally gave zero information for anyone to work with

#

You may as well have just said "it doesn't work, why"

sand rune
#

I'm making a rank sys but the server don't detect the change of the rank var in the file @eternal oxide

eternal oxide
#

we'll start at teh beginning then... Is the server turned on?

sand rune
#

Yes

#

I reloaded the server , nothing happen

eternal oxide
#

You are going to have to show some code, any errors, what happens and what you expect to happen

smoky oak
#

also it might be possible you have issues with the config, do you read it correctly?

hardy swan
#

@sand rune I played minecraft half way and my plugin cannot load, you know why?

sand rune
lusty cipher
#

good point

hardy swan
#

yes i did, but the @Override is not needed just sayin

sand rune
#

Don't remove it to make the func work

hardy swan
#

ok im done

eternal oxide
#

I like to keep it as it can show up other errors if you do things like, forget to extend JavaPlugin

hardy swan
#

?learnjava

undone axleBOT
lusty cipher
sand rune
lusty cipher
#

๐Ÿค”

dense goblet
#

Without code we can't help

lusty cipher
dense goblet
#

It's like going to the dentist and refusing to open your mouth

dense goblet
hardy swan
#

at the very least even a link to entire remote repository helps

undone axleBOT
hardy swan
#

actually he gave some clues

#

reloaded server and nothing changed

eternal oxide
#

Server was running at least

#

Means he has electricity

hardy swan
#

after config file is changed

#

he probably not reading from plugin folder lol

#

and reading from the jar's resource

eternal oxide
#

I'd bet on not saving

hardy swan
#

or maybe he overwrites everytime the resource is loaded

#

how are stairs and trapdoor bisected

maiden briar
#

How can I catch this? io.netty.channel.AbstractChannel$AnnotatedConnectException: Connection refused: no further information: bungee

shadow gazelle
#

I've never used yaml before I started making plugins, should getConfigurationSection("itemshop.categories") get the categories section under itemshop?
YML structures:

itemshop:
  categories:
    category1:
shadow gazelle
#

Would that work even with another thing being above itemshop?

#

Sorry, should have added that

#
size: 54
itemshop:
  catergories:
eternal oxide
hardy swan
maiden briar
hardy swan
eternal oxide
#

oh

#

I was looking at door ๐Ÿ™‚

plain scroll
#

how can i add a "comment" in my config file? Because when it builds nothing that i write shows?

I use "// Message"

hardy swan
#

only door qualifies for bisected

plain scroll
#

ive also tryed #

hardy swan
#

it is #

plain scroll
#

hmm

eternal oxide
# hardy swan

oh trapdoor is if it it teh top half of the block or teh bottom

#

same block

#

stairs is the same, which way up

hardy swan
hardy swan
#

shit description then

lost herald
#

Hello everyone! I'm new to Bukkit and Java, so help me please. I posted on Bukkit.org, but the post has been awaiting moderation for 20 hours now, so i decided to ask for help here. My post:

I want to make some code run every 10 ticks in my Commands class (the trigger is in Commands, and i don't know how to move it to Main). I tried using runTaskTimer() and it says that the method is deprecated, although no errors found. Also, i need the task to cancel itself 10 minutes after start.
This is what i was trying to do:

Bukkit.getServer().getScheduler().runTaskTimer(Main.getPlugin(Main.class), new BukkitRunnable(){//some code//}, 0L, 10L)

Any help is appreciated, thanks.

grim ice
#

man

#

I need a idea

hasty prawn
lost herald
#

method runTaskTimer is deprecated

#

wait a sec im gonna check it

#

Maybe its because im using BukkitRunnable?

hasty prawn
#

Maybe, try using a lambda

grim ice
#

i used it just that day

#

It is not deprecated

lost herald
#

my IDE is loading

#

its IntelliJ by the way

undone axleBOT
lost herald
hasty prawn
#

I think it wants a Runnable instead of a BukkitRunnable

lost herald
lost herald
dense goblet
lost herald
#

Yeah i read the documentation, thanks!

dense goblet
#

IntelliJ simplifies it to some sort of lambda too idk, either way both work

#

Coolo!

lusty cipher
#

damn this is a neat feature

ivory sleet
#

๐Ÿ˜Œ

fluid cypress
lost herald
#

I tried to create a normal boolean but IDE says something about accessing from inner class and final

quaint mantle
lost herald
dense goblet
#

Is it fine for it to be static?

ivory sleet
lost herald
fluid cypress
dense goblet
lusty cipher
#

You don't have to scrape the website.

#

There's an API for downloading files (kinda)

dense goblet
#

OnGameFinished for example

quaint mantle
#

?paste since you cant use codeblocks correctly

undone axleBOT
dense goblet
#

Then pass the object with that method (e.g. GameManager), which should be final

#

In your runnable you can then call methods on the object

lost herald
#

Ok im gonna try that

dense goblet
#

Cool gl

fluid cypress
#

Bukkit.getPluginManager().isPluginEnabled("x") is it too early to do it in onEnable?

lusty cipher
ivory sleet
#

I guess Do not access the forums via automated mechanisms. @fluid cypress would be the rule

queen niche
ivory sleet
#

But yeah really questioning if thatโ€™s bannable myself

lusty cipher
quaint mantle
ivory sleet
#

^

lusty cipher
#

try what I sent. That works

spice sage
#

I want to put cooldown in a item but it doesn't work when before it works, can someone help me please?

queen niche
#

Is someone able to look at my issue?

dense goblet
#

Make a plugin with the jars for all other plugins and then extract them if enabled as modules

#

(/s)

lusty cipher
fluid cypress
#

how do i get the id? the numbers after the . in the link?

lusty cipher
#

yeah, just save that as a field somewhere in your plugin

queen niche
fluid cypress
#

i mean, just id

dense goblet
lusty cipher
fluid cypress
#

yea, the id key i mean

spice sage
#

can someone help me please?

fluid cypress
#

and how do i know how many pages there are

spice sage
lusty cipher
#

will have to guess that

#

or just continue searching until you find your desired version

fluid cypress
#

my desired version is the latest version

spice sage
#

@fluid cypress i have this, it works

quaint mantle
#

thats not what they want

spice sage
#

what they want?

quaint mantle
#

they want to actually download updates automatically

spice sage
#

i think its imposible to do

ivory sleet
#

sounds like a hassle

fluid cypress
quaint mantle
#

again scraping is against the rules

fluid cypress
#

what if i load a page once an hour

quaint mantle
#

are you automating it?

fluid cypress
#

i want to

shadow gazelle
#

?paste

undone axleBOT
quaint mantle
shadow gazelle
ivory sleet
#

what is line 87?

shadow gazelle
#

I sent what's on line 87 in the first paste

#

Wait

#

The material value isn't in a string in the yml

hybrid spoke
shadow gazelle
#

Changed nothing

hybrid spoke
#

not line 87

shadow gazelle
#

I sent line 87 and everything it does*

hybrid spoke
#

and on enable 39 is what?

shadow gazelle
#

Basically class.GUIInfo

fluid cypress
shadow gazelle
#

It worked for the GUI I did before

hybrid spoke
#

okay well

#

since your code isnt saying anything about your error

#

because you cant just sent those line alone

#

i need to guess

#

either its your itemShopConfig, your configuration section, anything within your config

shadow gazelle
hybrid spoke
#

Bedwars.itemShopConfig.getConfig().getConfigurationSection("itemshop.categories").getKeys(false).forEach(category -> {?

#

is this your line 87?

shadow gazelle
#

Yes, and that's what I sent before...

hybrid spoke
#

no you've sent a codeblock. not a single line. a codeblock

shadow gazelle
#

:/

proud basin
#

GodCipher being GodCipher againโ€ฆ

hybrid spoke
#

check if itemShopConfig is not null. check if the file exists, check if the configuration section is not null.

lost herald
#

Guys this is what console said when i loaded the plugin
Help me please, i don't understand whats wrong

[00:25:35] [Server thread/ERROR]: Could not load 'plugins\MobHunt.jar' in folder 'plugins'
org.bukkit.plugin.InvalidPluginException: Cannot find main class `com.giovolo.mobhunt.MobHunt'

lusty cipher
#

your plugin.yml has com.giovolo.mobhunt.MobHunt, but that class doesn't actually exist in your project

lost herald
#

but it does

lusty cipher
#

no it doesn't

grim ice
#

@lost herald check

#

if ur main class

#

is exact same

#

as in ur plugin yml

lost herald
#

Oh my god

#

Sorry guys im dumb

#

I fixed it first attempt but was building it in wrong folder

#

Thanks

grim ice
#

anyone has an idea of a plugin

ivory sleet
#

self destruct plugin

#

altho not particularly useful

fluid cypress
#

anyone knows if its possible to convert the encrypted authme passwords back to plain text somehow?

opal juniper
#

Well if it is encrypted you just need the key

#

But if it is hashed - not really no

#

Well

#

It is possible

fluid cypress
#

its hashed*

#

i think

opal juniper
#

Ok then no

#

The way it works is that you compare the output of the hash together

#

And you never store the password d

fluid cypress
#

yea i know but my question is more about, someone who knows about the plugin more than me, maybe there is a way idk, or at least i want to know what algorithm it uses or how does it do it, to use it in my own auth plugin. i want to change a couple of things, and also maybe use it to authenticate from somewhere else, a website for example. i also want the pw in plain text bc im tired of people forgetting it and believing that i can tell it to them somehow. but well, at least i could save the attempts before hashing it, and if the hashes match, save little by little the correct password of each user in plaintext or encrypted, instead of hashed, in case they forget it in the future

rose aspen
#

Someone here who has a good ProtocolLib knowledge ?

ivory sleet
#

just ask your question

iron condor
#

I want to make a formed cobble (lava cast) to air after 6 sec

    @EventHandler
    public void onBlockForm(BlockFormEvent event) {
        if (event.getBlock().equals(Material.COBBLESTONE)) {
            BukkitScheduler scheduler = Bukkit.getServer().getScheduler();
            scheduler.scheduleSyncDelayedTask(smpUtilities, new Runnable() {
                @Override
                public void run() {
                    event.getBlock().setType(Material.AIR);
                }
            }, 300);
        }
    }

this code doesnt work

ivory sleet
#

post it in one channel

next crater
#

sorry

ivory sleet
#

I think

iron condor
#

it doesnt set it to air

hybrid spoke
#

also compare enums with == not equals

#

any errors?

iron condor
#

nothing

ivory sleet
#

Block will never be equal to a Material

ivory sleet
iron condor
#

ohhhh right

#

getType

chrome beacon
#

Shouldn't your IDE warn you about that ๐Ÿ‘€

hybrid spoke
#

oh i didn't even saw that

iron condor
#

jk

hybrid spoke
shadow pulsar
#

Is there anyway to check if a block drops an item regardless if a player breaks it or not? For example, when the bottom of a sugar cane is broken, any other sugar cane will break and drop its item.

fluid cypress
#

my maven tab on the right of the screen disappeared for some reason, how can i put it back?

near crypt
#

is there an event that can give you the location where a snowball is breaked after its thrown?

tacit storm
#

ProjectileHitEvent

#

Check if e.getEntity instanceof Snowball

near crypt
#

okay and how can i get the location?

tacit storm
#

getHitBlock()
getHitEntity()

grim ice
#

How to get the value of a persistent data container

eternal oxide
#

?pdc

grim ice
#

Still cant figure it out

quaint mantle
eternal night
#

guess the tutorial was trash ๐Ÿ˜ข

quaint mantle
eternal night
#

thanks โค๏ธ

grim ice
quaint mantle
grim ice
#

you can set the value

#

but idk how to get the value

quaint mantle
grim ice
#

That will get the type>'

#

not the value

quaint mantle
#

uhh

#

huh?

grim ice
#

e.getPlayer().getPersistentDataContainer().set(new NamespacedKey(GenderColor.INSTANCE, "gender"), PersistentDataType.STRING, "E");

#

i wanna get E

quaint mantle
grim ice
#

oh ok

quaint mantle
#

Jesus christ

grim ice
#

sry i have corona

#

and stuff

#

i barely can even code lol

grim ice
#

if(e.getPlayer().getPersistentDataContainer().get(new NamespacedKey(GenderColor.INSTANCE, "gender"), PersistentDataType.STRING)){

undone axleBOT
grim ice
#

thx but that's not what im looking for

#

And Ive read those

near crypt
#

what is the easiest way to get the nearest block that is not air from a location?

quaint mantle
grim ice
#

then

#

?

quaint mantle
jade perch
grim ice
#

lol

quaint mantle
#

No way..

jade perch
#

You don't read them

#

You do them

quaint mantle
#

if (string)
^ this doesnt make sense

grim ice
#

im dumb

#

excuse me

cursive trellis
#

can any body help me

#

im trying to make my spigot server multiplayer and i did the port forwarding and i put my ipv4 in the server propeties i dont know what i did wrong

unreal quartz
#

not the channel

cursive trellis
#

sorry

#

do you know how i can link my server to a discord bot

dusk flicker
rotund pond
#

Hello !
Is there a way to simply translate hex color codes please ?
(Im using spigot 1.16)

#

I've found no method :/
I think I have to code it by myself

dusk flicker
#

What do you mean translate?

chrome beacon
#

You can use the vanilla style hex colors

grim ice
#

WAIY

#

WAITY

rotund pond
#

I mean, turns #123456 to a color code

grim ice
#

@eternal night YOU'RE WHO MADE THAT RESOURCE LMAO

#

THANKS LOL

#

i just realized when i was closing the tab

#

thanks very much

dusk flicker
rotund pond
dusk flicker
#

What do you mean

#

The bungee chat api is in spigot?...

rotund pond
#

ah ?

#

wait

#

OH WTF

#

I'm so dumb, sorry

#

Thanks for your help

quaint mantle
#

Is there anything wrong with this code? Yes, i am registering it to the plugin

#

You forgot the @EventHandler
@quaint mantle

#

...

#

im f-ing stupid

#

thanks for getting rid of my depression

vestal dome
#

I'm trying to find a way to obtain the mods of someone trying to proceed with the Forge handshaking, but having difficulties, does anyone here know how FML2 protocol works? and how to retrieve the mods?

#

i'm specifically looking for forge sending the mods and not trying to acquire the mods thru a bytebuf, yet.

chrome beacon
#

I think wiki.vg has some information but other than that I'm not sure if anyone here knows much about it

#

There is an open source plugin you can take a look at however

vestal dome
#

wiki.vg does not explain fml2 protocol....

#

it only explains fml1 protocol which is <1.12

chrome beacon
#

Oh you want the new one

#

I mean you could ask in the Forge discord or take a look at their github page

vestal dome
#

link me forge's discord,

#

in dms if you can

chrome beacon
#

Sent

queen niche
#

Hi! Is it possible to return a argument in a message.

So if I use /command example1 example2

It says:

[Info] Example1 has opened. Click to warp

Example2 will be used as arg the /warp command โ€ฆ).command, โ€œ/warp โ€œ + argument

#

If that makes any sense

chrome beacon
#

Sounds possible if I understand it correctly

dusk flicker
#

Im not sure exactly what you mean but like you want an arg in a message?

#

If so it's a string so you could just fine

eternal oxide
#

he wants a clickable message

dusk flicker
#

Oh I understand

eternal oxide
#

using arg[0] as the Example1 for the text, and arg[1] to be used in the /warp arg[1]

#

clickable text command

#

too busy here to tell him how to use text components though

iron condor
#
    @EventHandler
    public void onBlockForm(BlockFormEvent event) {
        if (event.getBlock().getType().equals(Material.COBBLESTONE)) {
            BukkitScheduler scheduler = Bukkit.getServer().getScheduler();
            scheduler.scheduleSyncDelayedTask(smpUtilities, () -> event.getBlock().setType(Material.AIR), 300);
        }
    }```
still doesnt wotk, I want to set cobble (caused by lava casting) to air after 6 seconds.
queen niche
eternal oxide
iron condor
#

thanks

#
    @EventHandler
    public void onBlockForm(BlockFormEvent event) {
        if (event.getBlock().getType().equals(Material.COBBLESTONE)) {
            Block block = event.getBlock();
            BukkitScheduler scheduler = Bukkit.getServer().getScheduler();
            scheduler.scheduleSyncDelayedTask(smpUtilities, () -> block.setType(Material.AIR), 300);
        }
    }```
this didnt work
lost matrix
iron condor
#
    @Override
    public void onEnable() {
        getServer().getPluginManager().registerEvents(new EventListener(this), this);
    }```
lost matrix
#

Try some debugging messages.

  1. Does the event get called when cobble is created
  2. Is the method executed later on
eternal oxide
#

make the Block variable final and add some sysout to make sure it all runs

limber dust
#

use ?paste

#

?paste

undone axleBOT
spice sage
lost matrix
#

Not the swing cd

spice sage
#

so, before it works, now no

lost matrix
#

lol...

spice sage
#

and i don't know how it has stopped working

limber dust
spice sage
# lost matrix

it is because if i dont put player != null if throws an error

lost matrix
#

This here is the most masochistic thing you can do in java coding. You are hiding all your errors. So if something stops working you have no idea why

spice sage
#

all works fine less cooldown

lost matrix
lost matrix
lost matrix
spice sage
#

what do you mean with IDE?

limber dust
#

code editor

#

eg, eclipes, intellij

lost matrix
#

Eclipse, Intellij, Netbeans.... Notepad

spice sage
#

eclipse

limber dust
#

notepad++

lost matrix
#

Then remove the try catch clause and the player null check.

spice sage
#

what it does?

lost matrix
#

Formats your code so its readable

onyx basin
#

Hi, is normal that first command argument is ignored, when command is too short?

lost matrix
spice sage
#

do you add the command in plugin.yml?

onyx basin
#

Yes

spice sage
#

register it in the method onEnable?

onyx basin
#

Yes

lost matrix
# onyx basin Yes

Please show your code and tell us what you expect it to do and what you observed it currently does.

spice sage
#

could you pass the code usin ?paste?

lost matrix
spice sage
lost matrix
spice sage
#

i pass entire code

#

?paste

undone axleBOT
spice sage
#

here is

lost matrix
#

-> @SuppressWarnings({ "deprecation" }) this should never occur in spigot code. If spigot deprecates a method then there is a cleaner alternative implemented.

lost matrix
# spice sage here is

Ok can you narrow down the problem to some lines that you suspect do cause the problem and also look out for errors in your console?

spice sage
#

so, if i delete it how can i do to detect if a player right click on a sword?

lost matrix
spice sage
#

when a player right click an iron sword that i give when join, it will be teleport to a coords that admin put, remove the inventory and put in the inventory a full iron armor, diamond sword bow and arrow and put in the diamond sword a cooldown to teleport back to the spawn when right click, before y change the messages to a file messages.yml the cooldown will stop work

somber hull
#

Im trying to save a item to a config, along with its NBT, lore, and name, etc. How do?

#

I have tried ItemStack.serialize()

#

but it doesnt fucking make sense

spice sage
eternal oxide
#

config.set("item", itemStack)

somber hull
lost matrix
eternal oxide
#

what doesn;t work about it?

somber hull
#

Let me try it

#

But i tried it a month ago

#

and took a break from the project

#

cause it made no sense

lost matrix
#

What spigot version are you on?

eternal oxide
#

its how to store ItemStacks. Always has been

somber hull
#

1.17

spice sage
#

1.13

lost matrix
#

Then you should have no problems just throwing that into a yml config

lost matrix
somber hull
#
[15:17:09] [Server thread/ERROR]: [SafeCheck] Exception while handling click event in inventory 'Blocks', slot=11, item=BLACK_STAINED_GLASS_PANE
java.lang.IllegalArgumentException: Cannot set to an empty path
spice sage
somber hull
#

at me.silentprogram.safecheck.inventory.GuiClass.lambda$createBlocksGui$10(GuiClass.java:188) ~[?:?]

#

plugin.getConfig().set("blocks." + item.getItemMeta().getDisplayName(), item);

lost matrix
somber hull
#

do items have a default display name?

#

Like

#

if i take a aok log

#

would its display name be Oak Log

lost matrix
#

The ItemMeta only contains a display name if it was set earlier

spice sage
somber hull
#

likle this

spice sage
#

thanks

lost matrix
somber hull
spice sage
#

no throws any error in console

#

only the cooldown doesn't work

#

is like the code jump the cooldown

lost matrix
spice sage
#

i don't understand why

somber hull
#

aight bet

#

wait

#

but

#

Hmm, what would the best way to do this

#

If i have blocks.NAME.item in my yml file

#

What should i put for name

lost matrix
cursive trellis
#

!help

#

?help

undone axleBOT
#
CafeBabe Help Menu
*Red V3*
**__Admin:__**

selfrole Add or remove a selfrole from yourself.

**__Cleanup:__**

cleanup Base command for deleting messages.

**__Core:__**

embedset Commands for toggling embeds on or off.
info Shows info about CafeBabe.
licenseinfo Get info about Red's licenses.
mydata Commands which interact with the data CafeBabe has about...
set Commands for changing CafeBabe's settings.
uptime Shows CafeBabe's uptime.

**__CustomCommands:__**

customcom Base command for Custom Commands management.

**__Downloader:__**

findcog Find which cog a command comes from.

**__Mod:__**

names Show previous names and nicknames of a member.

**__ModLog:__**

casesfor Display cases for the specified member.
listcases List cases for the specified member.
reason Specify a reason for a modlog case.

**__Permissions:__**

permissions Command permission management tools.

lost matrix
spice sage
onyx basin
#

When I use /gamemode, args are normal, but when I type /gm, it always shows args length as 1

lost matrix
somber hull
#
            List<ItemStack> items = (List<ItemStack>) plugin.getConfig().getList("blocks");
            items.add(item);
            plugin.getConfig().set("blocks", items);
#

@lost matrix

lost matrix
lost matrix
onyx basin
#

Doesn't matter what I type, using /gm it always shows 1 args

somber hull
#

Well this is in a click event

#

For a gui that has the items

lost matrix
somber hull
#

?

#

Why

lost matrix
#

Ah nvm. FileConfiguration is in memory anyways.

somber hull
#

alright

lost matrix
#

Thought you would load the File from disk again

somber hull
#

ItemStack i : plugin.getConfig().getList("blocks") how would i cast this list to an itemstack?

lost matrix
somber hull
#

im having some trouble

lost matrix
#

Just cast the List<?> to a List<ItemStack>

somber hull
#

I dont think that applys here

#

Leme send context

#
List<ItemStack> items = (List<ItemStack>)plugin.getConfig().getList("blocks");
items.add(item);
plugin.getConfig().set("blocks", items);

for (ItemStack i : plugin.getConfig().getList("blocks")) {
#

i just want to loop through the itemstack list i put in the config

lost matrix
#
List<ItemStack> items = (List<ItemStack>)plugin.getConfig().getList("blocks");
for (ItemStack item : items) {

}
somber hull
#

Oh alright

#

seems kinda dumb that i cant cast it inside the for loop

lost matrix
#

Or:

for (ItemStack item : (List<ItemStack>)plugin.getConfig().getList("blocks")) {

}
somber hull
#

Oh

#

OHHHHHH

onyx basin
somber hull
#

I was trying to cast to ItemStack ๐Ÿคฆโ€โ™‚๏ธ

lost matrix
somber hull
#

ooooo

#

wait

#

7smile

#

How do i remove a specific thing from a list?

lost matrix
#

List#remove(thing)

somber hull
#

Well doesnt it have to be a number?

lost matrix
#

It doesnt. If its an Object then the list will be iterated and for each Object in there .equals() will be called until a matching one is found

somber hull
#

Aweseome

lost matrix
#

I could now go about time complexities and how bad this method is, but i think for your case its fine. As long as the list doesnt contain like a thousand elements.

torn shuttle
#

this is a specific question but are there any people here who are experienced with creating fan wikis or wikis in general, so far I've consistently used the github wiki but it's starting to become clear that I need a different (and hopefully better) wiki for users specifically at this time

#

the only such system I know is wikia now known as fandom but I've never really used it, any other recommendations?

#

I don't have the time to make a website from scratch myself

lost matrix
torn shuttle
#

lol

#

have you tried fandom?

lost matrix
#

Nope. Im currently at the point where i got a udemy course for advanced React.js to just write my own wiki lib XD

torn shuttle
#

yeah I just don't have that kind of time rn

#

I started working on a react website but that thing is massive time sink

cold tartan
#

TNT exploding calls the EntityExplodeEvent, but how is the BlockExplodeEvent called?

torn shuttle
#

isn't that event for getting blocks that got blown up?

cold tartan
cold tartan
lost matrix
spice sage
#

event.getAction().equals(Action.RIGHT_CLICK_BLOCK) && player.getInventory().getItemInMainHand().getType().equals(diamond_sword1)

torn shuttle
spice sage
#

if i put like this should detect the item that the player right cliking no?

lost matrix
spice sage
onyx basin
#

Tested on clean server, without any other plugins

lost matrix
onyx basin
#
[00:44:51 INFO]: 1
[00:44:51 INFO]: asdf
[00:44:54 INFO]: Axer22 issued server command: /gamemode asdf asdf asdf
[00:44:54 INFO]: 3
[00:44:54 INFO]: asdf
[00:44:54 INFO]: asdf
[00:44:54 INFO]: asdf```
#

I can send jar

lost matrix
onyx basin
#

I will try

#

Same

#

Tested on the latest spigot

lost matrix
#

Weird

#

no idea then

#

Never had this issue

crude axle
#

When squaring a negative integer value in Kotlin, it seems like it returns a negative result. Does anyone else have that issue?

lost matrix
fading lake
#

like (-3)^2

crude axle
#

So basically I have code that does the following: ```kotlin
val dxSquared = (dx * dx)
val dzSquared = (dz * dz)

lost matrix
crude axle
#

In clear defiance of all mathematical rules

lost matrix
lost matrix
crude axle
#

Yes

#

All of them

lost matrix
#

I dont see how something like this is possible...

crude axle
#

Neither do I

#

And I have started to think if there could be a serious bug within Kotlin itself

lost matrix
#

Is the operator overloaded?

crude axle
#

What do you mean by "operator overloaded"?

lost matrix
#

Kotlin supports operator overloading

#

Try printing the type of dx pls

#

And also show some more code...

#

Is the resulting number correlated with the actual number that should result out of the equation? (Like same value just with a negative sign)

crude axle
#
val vec = Immutable2dVector.fromLocation(loc)
        val dx = loc.blockX - center.x
        val dz = loc.blockZ - center.z


        var newX : Int = vec.x
        var newZ : Int = vec.z
        Bukkit.broadcastMessage("centerX: ${center.x} centerZ: ${center.z}")
        Bukkit.broadcastMessage("targX: ${loc.blockX} targZ: ${loc.blockZ}")
        Bukkit.broadcastMessage("dx: $dx dz: $dz")
        if (ellipsoid) {
            val dxSquared = (dx * dx)
            val dzSquared = (dz * dz)
            Bukkit.broadcastMessage("dxSquared: $dxSquared dzSquared: $dzSquared")
            val dU = sqrt(dxSquared.toDouble() + dzSquared.toDouble())
            val dT = sqrt(dxSquared / xRadiusSquared + dzSquared / zRadiusSquared)
            val f = (1 / dT - 1 / dU)
            Bukkit.broadcastMessage("dU: $dU dT: $dT f: $f")
            newX = (loc.blockX + dx * f).roundToInt()
            newZ = (loc.blockZ + dz * f).roundToInt()
somber hull
#

?paste

undone axleBOT
somber hull
#
        for (ItemStack i : (List<ItemStack>) plugin.getConfig().getList("blocks")) {
            ItemStack item = new ItemStack(i);
            ItemMeta itemMeta = item.getItemMeta();
            List<String> lore = itemMeta.getLore();
            lore.add("");
lost matrix
somber hull
#

no

#

lore.add is line 208

eternal night
#

ItemMeta#getLore will not return an empty list if the item has no lore

#

it will return null

lost matrix
#

Ah i see. If the ItemMeta doesnt contain a lore then getLore just returns null

eternal night
#

this is documented in the javadocs

somber hull
#
blocks:
- ==: org.bukkit.inventory.ItemStack
  v: 2730
  type: TUFF
lost matrix
# somber hull ok

List<String> lore = itemMeta.hasLore() ? itemMeta.getLore() : new ArrayList<>();

eternal oxide
somber hull
#

AAAAAAAAA

#

now itemMeta is null

#

how do i fix that

#

because

#

lore is a arraylist but what is itemMeta

dusk flicker
#

itemMeta is an ItemMeta object

crude axle
#

Here is the output of each value: ```
[00:38:32] [Render thread/INFO]: [CHAT] centerX: 0 centerZ: 0
[00:38:33] [Render thread/INFO]: [CHAT] targX: 158 targZ: -895721
[00:38:33] [Render thread/INFO]: [CHAT] dx: 158 dz: -895721
[00:38:33] [Render thread/INFO]: [CHAT] dxSquared: 24964 dzSquared: -842774511
[00:38:33] [Render thread/INFO]: [CHAT] dU: NaN dT: NaN f: NaN

somber hull
#

ok

#

yea

#

that makes sense

crude axle
#

So bc dzSquared is negative, dU, dT and f are all NaN

somber hull
#

ItemMeta itemMeta = item.hasItemMeta() ? item.getItemMeta() : new ItemMeta();

#

?

lost matrix
crude axle
#

So I am dealing with an integer overflow?

somber hull
lost matrix
#

895721 * 895721 is way bigger than 2^31

lost matrix
somber hull
#

hmmmmmm

#

thats weird

#

?paste

undone axleBOT
somber hull
#

heres my error

lost matrix
crude axle
#

If I call toLong on both, that will fix it?

#

as long has greater range than Int

somber hull
#

wait

#

so how do i give it itemMeta

#

if it doesnt have any

lost matrix
lost matrix
somber hull
#

then why is it null..

lost matrix
#

Show some code

somber hull
#
        for (ItemStack i : (List<ItemStack>) plugin.getConfig().getList("blocks")) {
            ItemStack item = new ItemStack(i);
            ItemMeta itemMeta = item.getItemMeta();
            List<String> lore = itemMeta.hasLore() ? itemMeta.getLore() : new ArrayList<>();
            lore.add("");
            lore.add(ChatColor.RED + "" + ChatColor.BOLD + "Right-click to remove item.");
            itemMeta.setLore(lore);
            item.setItemMeta(itemMeta);

eternal oxide
#

lore will always be empty

lost matrix
#

ItemStack item = new ItemStack(i); <- What is this line supposed to do?

somber hull
#

i guesse

#

i could do .clone()

lost matrix
#

No. Use ItemStack#clone() for that.

eternal oxide
#

is your blocks in yoru config Materials?

somber hull
eternal oxide
#

ah k

lost matrix
somber hull
#

FUCK

#

why didnt i just check the config

proud basin
#

ElgarL any other way to store into a players object other than using nbt tag?

somber hull
#

It had air in the config...

eternal oxide
#

he's on 1.8

lost matrix
#

NBT is so 2014

#

Oh

#

Then update and use PersistentDataContainer ๐Ÿ˜„

somber hull
#
- ==: org.bukkit.inventory.ItemStack
  v: 2730
  type: GRASS_BLOCK
#

this is giving that itemmeta error

proud basin
eternal oxide
#

no

proud basin
#

ah

#

ok

#

time to work on this

quaint mantle
#

1.8 user PU_PeepoGiggle

lost matrix
proud basin
#

so I should probably use https://www.spigotmc.org/resources/nbt-api.7939/

lost matrix
proud basin
#

hm

#

yo this library is a bit confusing

hexed hatch
#

it's almost like working with near-decade old versions is a hassle

lost matrix
# proud basin yo this library is a bit confusing

Its literally:

ItemStack itemStack = ...;
NBTItem nbtitem = new NBTItem(itemStack);

nbtitem.setString("Stringtest", "Teststring");
nbtitem.setInteger("Inttest", 42);
nbtitem.setDouble("Doubletest", 1.5d);
nbtitem.setBoolean("Booleantest", true);

nbtitem.getString("Stringtest");
nbtitem.getInteger("Inttest");
nbtitem.getDouble("Doubletest");
nbtitem.getBoolean("Booleantest");
proud basin
#

That's not what I'm talking about

#

so does this save in a file or something?

dusk flicker
#

... it stores it as nbt

#

on the item

lost matrix
proud basin
#

so for what im doing it would save on the player

lost matrix
#

The data is written right into the ItemStack and then loaded/unloaded with where ever the ItemStack is stored. So Player invs, Chunks etc

#

Entities also have NBT data. So if you want to have player specific data then you should store it into the players NBT data. This one is saved when he logs of..

proud basin
#

so if I was gonna use this to make a cooldown i'd want to use a itemstack?

lost matrix
proud basin
#

and it would be separated for each player correct

#

or is that something i'd need to implement myself

lost matrix
proud basin
#

right

#

I believe one of them is restarting the server...

#

Since the data is temp

lost matrix
#

The NBT data is not temp

proud basin
#

I'm not talking about nbt data

proud basin
#

talking about the player

#

ima just figure this out later

#

just gonna have is set to a db for now

lost matrix
proud basin
#

their cooldowns

lost matrix
#

And you gonna check the cd each time they try to use the item then?

proud basin
#

I had set it up yesterday and then later on ElgarL mentioned that I can store it in the players object so it's faster

lost matrix
#

Using a db for life cooldown checks is one of the fastest ways to introduce synthetic crippling lag to your server.

proud basin
#

๐Ÿคท

#

hm

#

so would I use entity to save into a player?

lost matrix
#

keep it in memory and only save when the player quits. In a db or the nbt data.

proud basin
#

Let me make it clear what I'm trying to do

#

Currently I have a db that I store the players cooldown whenever they pick a kit

prisma needle
#

Is it possible to disable or modify join/leave messages from a bungeecord plugin?

lost matrix
prisma needle
#

Sorry, I don't quite get what you mean :P

lost matrix
prisma needle
#

Oh haha, I meant I am making a bungeecord plugin, and in that plugin am trying to modify/disable the vanilla join/leave messages

#

but can't figure out how :P

quaint mantle
#

obviously it depends how you use it

proud basin
#

well that's nice xD ava.sql.SQLTransientConnectionException: HikariPool-2 - Connection is not available, request timed out after 30000ms.

lost matrix
quaint mantle
#

you can store stuff in memory and out of memory when the players not on, definitely the quicker way

#

why would you ever do anything with the main thread with databases

proud basin
#

I believe I made mine on the main thread

quaint mantle
#

exactly

lost matrix
quaint mantle
#

then put it on another thread simple fix

proud basin
#

wait

#

hold up

#

how do you tell if it's on the main thread

#

Looking on how I did it. Doesn't look like it's on the main thread

quaint mantle
#

since you dont know

lost matrix
quaint mantle
#

iots probably on the main thread

lost matrix
#

I think there is a static method somewhere you can call to check if you are currently on the main thread...

proud basin
#

Thread.currentThread() ?

lost matrix
#

Probably a NMS method

quaint mantle
#

just use the bukkit scheduler

#

and run it async

proud basin
#

Yeah I'm not running it on the main thread

lost matrix
#

Or use completable futures. This way you have callbacks you can use.

quaint mantle
#

hes just gotta stick to the bukkit scheduler for now lol

lost matrix
#

Just make sure to sync with the main thread afterwards

proud basin
quaint mantle
#

what are you using to run it on another thread?

lost matrix
#

Java 7 be like

new Thread() {

}.start();

XD

proud basin
#

well I'm using System#currentTimeMillis

eternal oxide
eternal oxide
#

yep, I'm late reading

proud basin
#

All good!

eternal oxide
#

tells you if your current thread is running sync

proud basin
#

Where should I use it you think

#

getting the time left?

eternal oxide
#

You back to sql?

proud basin
#

Never set up the other thing

eternal oxide
#

k

lost matrix
#

Wait. I think i lost the thread (in terms of string)

eternal oxide
#

in that case, once the command comes in, instantly spawn off an async thread and return true (to consume) in the command

#

in your async thread you do all yoru sql query, then decide what you are going to do. Jump back sync to either tell them they are waiting on a timer, or perform the command.

#

easy to jump back sync, all you do is runTask

proud basin
#

so should I still use sql for it

eternal oxide
#

teh scheduler will run it on the next tick sync

#

where you store your data is upto you

lost matrix
eternal oxide
#

sql is slowest

#

true

#

do your timers persist between server starts?

#

do they need to?