#help-development

1 messages ยท Page 1551 of 1

wraith rapids
#

yes, and that is because they are the same thing internally

summer scroll
#

Maybe store everytime the player throw an enderpearl?

smoky oak
#

how would i know they didnt fall down 4 blocks before doing that

#

urgh dont tell me to implement pearls manually

#

wait

#

OnProjectileHitEvent?

#

i guess nevermind then

#

cancel pearl hit and pearl, teleport player, hit em for 5 hp

#

done

#

...nevermind again

#

that would make featherfalling stop working

#

uuurgh

subtle kite
#

huh

smoky oak
#

whats with that lousy reaction

real spear
#

How do I access the UUID of a player when it doesn't matter if they are online or offline? Right now I am using this:
Player target = (Player) Bukkit.getOfflinePlayer(args[0]);
Is there a better way of doing this?

smoky oak
#

try getting online player

#

if its null

#

get offline

real spear
#

Would I still cast it to a player? Or would I store it as an offline player?

smoky oak
#

you have to cast offfline player to player but can just do target = (Player) Bukkit..

eternal oxide
#

You can not cast an OfflinePlayer to Player. You use offlinePlayer.getPlayer()

wraith rapids
#

well, an offlineplayer could be a player, but there is no guarantee or sense in casting it

real spear
wraith rapids
#

if you need a Player, use Bukkit.getPlayer

#

if you need an offlineplayer, use Bukkit.getOfflinePlayer

#

very simple

eternal oxide
#

You can not cast to Player. Player extends OfflinePlayer not the other way around. You have to use getPlayer()

real spear
#

All I need to do is convert a name of a player to a UUID if they are online or not.

wraith rapids
#

then just call getUniqueId on the offlineplayer

real spear
wraith rapids
#

because online players are offline players

river spear
#

What is the name of the event when an anvil breaks?

real spear
#

then you can test if the block is an anvil

wraith rapids
#

that is for when players break blocks

river spear
#

But that is only triggered when the player removes it

real spear
#

Mb. You never specified. Idk then

river spear
#

If the anvil is used often, does it break itself, but there is no event for it?

wraith rapids
#

i'm sure there is but i don't remember off the top of my head what it's called

shadow gazelle
#

How would I iterate through every block above a broken block?

#

a for loop just makes IntelliJ complain

onyx shale
#

a way is either through blockface or through location

shadow gazelle
#

It wants to put a colon there lol

onyx shale
#

a simple for loop should be the ideal way

shadow gazelle
onyx shale
#

i mean there is a error why the for loop is not

#

working

#

wich usually the ide is rather explicit

shadow gazelle
#

It's just ; expected twice

onyx shale
#

show the for loop

dusty sphinx
#

What unit of time does Instant.compareTo return? Seconds or milliseconds?

shadow gazelle
#

I'm just stuck so don't be surprised if it's obv not gonna work lol

            for (block.getRelative(BlockFace.UP).getType() == Material.SUGAR_CANE) {
            }
#

Wait

onyx shale
#

you know what gettype returns right?

shadow gazelle
#

that obv won't work

onyx shale
#

also a for loop is...

#

for(start;condition;increment)

shadow gazelle
#

what

#

๐Ÿคฆ

onyx shale
#

good ol basics

#

however in your case a while would be better

#

but eh could get messy

onyx shale
shadow gazelle
#

What

onyx shale
#

do you want to go to infinity with it without care about stuff

shadow gazelle
#

I mean, kind of because you can make sugarcane as tall as you want

onyx shale
#

ah you want sugarcane

tardy delta
#

still didnt find how to damage a boat

onyx shale
#
 private int checkUpSugar(final Location loc) {
        final Location extra = loc.add(0.0, 1.0, 0.0);
        int toRet = 0;
        if (extra.getBlock().getType() == Material.SUGAR_CANE) {
            loc.getBlock().setType(Material.AIR);
            toRet = ++toRet + this.checkUpSugar(extra);
            return toRet;
        }
        return toRet;
    }
tardy delta
#

casting to livingentity does not work

dusty sphinx
#

Does BukkitTask.cancel() let the task finish it's current iteration before stopping or does it stop it right away

waxen plaza
#

Is there a page for documentation on the plugin.yml file and different level of permissions for accessing commands?

onyx shale
dusty sphinx
#

How can I let the task finish it's current iteration before cancelling it

onyx shale
#

call it only after the iteration?

#

like if you have a foreach loop just call it after

dusty sphinx
#

That would cause a recursion issue in my use case then

waxen plaza
shadow gazelle
dusty sphinx
#

Oh wait, my wording is messed up

#

If I schedule a task to be run

#

nvm

shadow gazelle
onyx shale
#

i mean the method.. returns a int..

#

that int is the amount..

#

however this method doesnt care about the first block

#

its basically you call the method on a block,then it checks everything only above it

shadow gazelle
#

Oh

onyx shale
#

so i guess you can put toRet = 1 at start,and also break the block where you started

real spear
#

How do I make a custom help menu? Like what hypixel has. The normal spigot help menu is gross and shows what plugins I use on the server to the players.

onyx shale
#

custom help menu? almost nobody from here even play on hypixel its unlikely to even know what ur talking about

real spear
#

Ok. So like when you type /help I want to be able to customize what comes up rather than the default list of commands that spigot brings up.

onyx shale
#

ah

#

thats just default command list

#

you can override it with ur own plugin

#

just call the command help and it should run yours

real spear
#

I.e. someone types /help sees msg welcome to server. go to link for info

onyx shale
#

from there its all about your creativity to make it look nice

real spear
#

That helps. thx

quaint mantle
#

Do I need to connect to disconnect from sqlite everytime i do some action?

iron condor
#

what dies that mean? java.lang.NullPointerException: Cannot invoke "org.bukkit.entity.Player.getName()" because "player" is null

tardy delta
#

for some reason it cant find it

iron condor
#
    UUID uuid = DiscordSRV.getPlugin().getAccountLinkManager().getUuid(event.getMember().getId());
            if (uuid != null){
                OfflinePlayer offlinePlayer = Bukkit.getOfflinePlayer(uuid);```
uuid is not null
#
String playerName = offlinePlayer.getName();```
wraith rapids
#

it means what it says

craggy cosmosBOT
tardy delta
#

hmmm

iron condor
wraith rapids
#

then it doesn't refer to the line of code you posted

#

to begin with, there is no variable by name of "player" in what you posted

#

google how to read a stack trace

iron condor
#

It's 100% from there

#

And I know how to read stack trace

wraith rapids
#

doesn't look like it if you're asking for help with a NPE

iron condor
#

Well it's says Player when I'm using offline player \

#

thats why Im confused

wraith rapids
#

paste the stack trace

iron condor
#
[17:57:31 ERROR]: [DiscordSRV] java.lang.NullPointerException: Cannot invoke "org.bukkit.entity.Player.getName()" because "player" is null
[17:57:31 ERROR]: [DiscordSRV]  at com.elunar.plugin.BitEconomy.getBalance(BitEconomy.java:201)
[17:57:31 ERROR]: [DiscordSRV]  at com.elunar.plugin.DiscordSRVListener.discordMessageReceived(DiscordSRVListener.java:31)
[17:57:31 ERROR]: [DiscordSRV]  at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[17:57:31 ERROR]: [DiscordSRV]  at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:78)
[17:57:31 ERROR]: [DiscordSRV]  at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
[17:57:31 ERROR]: [DiscordSRV]  at java.base/java.lang.reflect.Method.invoke(Method.java:567)
[17:57:31 ERROR]: [DiscordSRV]  at github.scarsz.discordsrv.api.ApiManager.callEvent(ApiManager.java:134)
#

its longer tho but I dont think that will be useful

wraith rapids
#

line 201 of BitEconomy class being

iron condor
#
    @Override
    public double getBalance(String playerName) {
        Player player = Bukkit.getPlayer(playerName);
        return getYamlPlayerBalance(player.getName());
    }```
wraith rapids
#

that is 5 lines

iron condor
#

return getYamlPlayerBalance(player.getName());

wraith rapids
#

player is null

#

you cannot invole player.getName() because player is null

iron condor
#

had to use @Override public double getBalance(OfflinePlayer player) { return getYamlPlayerBalance(player.getName()); }

opal juniper
#

seems like a simple fix

iron condor
#

my bad

#

forgot how my code works :/

smoky oak
#

wat.
Cannot invoke Object.equals(Object)" because "v1" is null

v1.equals(null)```
#

so how do i see if something is null THEN?!

wraith rapids
#

learn java

smoky oak
#

yeah but what the hell is the issue

smoky oak
#

i always test if a object is empty like that

wraith rapids
#

the issue is that you have no idea what you're doing

#

.equals is a method

#

methods exist on objects

#

null is not an object

#

you can not call .equals on null

smoky oak
#

v1 is a MetadataValue

wraith rapids
#

and what do we do to compare things that aren't objects

smoky oak
#

also you mean i have to use == ?

wraith rapids
#

v1 is not a metadatavalue if it is null

#

metadatavalue is the type of the variable; but the method is not called on the variable, it is called on the object in that variable

smoky oak
#

ah i see

wraith rapids
#

if the value of that variable is null, there is no object, and you can't call the method; a NPE is thrown

smoky oak
#

org.bukkit.event.EventException: null

wraith rapids
#

the variable, then, points at no object

#

it is a null-pointer

#

trying to invoke a method on it will throw a null-pointer exception

smoky oak
#

aah

dusk flicker
iron condor
#

why so?

#

nvm

#

players can change names

opal juniper
#

kinda

smoky oak
#

[Server thread/ERROR]: Could not pass event PlayerInteractEvent

Caused by: java.lang.IllegalArgumentException: Value cannot be null
at org.apache.commons.lang.Validate.notNull(Validate.java:192) ~[minecraft_server.jar:3161-Spigot-f773da8-f81f499]
at org.bukkit.metadata.MetadataStoreBase.setMetadata(MetadataStoreBase.java:40) ~[minecraft_server.jar:3161-Spigot-f773da8-f81f499]
at org.bukkit.craftbukkit.v1_17_R1.entity.CraftEntity.setMetadata(CraftEntity.java:769) ~[minecraft_server.jar:3161-Spigot-f773da8-f81f499]
at io.github.moterius.ofraces4.abilities.AbilityHandler.HandleRightClickThrowPearl(AbilityHandler.java:28) ~[?:?]```
That last method calls in that line the method below with a EnderPearl from `player.launchProjectile`, the key "nodamage_pearl" and the boolean value null.
```java
public static void setMetadata(Metadatable object, String key, Object value) {
          object.setMetadata(key, new FixedMetadataValue(e,value));}
//E is the plugin main class instance stored in a static variable

Thing is: The metadata gets stored and retrieved - and i can run checks on it. So what's the error stemming from?

wraith rapids
#

java.lang.IllegalArgumentException: Value cannot be null

#

setMetadata(MetadataStoreBase.java:40)

smoky oak
#

it isnt null

wraith rapids
#

it doesn't lie

#

if it says it's null, it's null

smoky oak
#

read the whole thin

#

i just said it still stores the metadata

eternal oxide
wraith rapids
#

the boolean value null.

#

java.lang.IllegalArgumentException: Value cannot be null

#

seeing an incongruity yet

smoky oak
#

errrr

#

wanted to say true

#

code says true

#

my brain gave up

#
EnderPearl pearl = player.launchProjectile(EnderPearl.class);
        Echo.setMetadata(pearl, "nodamage_pearl", true);
        pearl.setMetadata("EnderThrow", null);```
#

ah

#

forgot to delete that line

#

nevermind i said nothign

dusk flicker
#

Why is your main class instance stored in an e var

smoky oak
#

its a static variable in the main class for quick retriveal

dusk flicker
#

That has to break java conventions

smoky oak
#

since people told me to do that yesterday

wraith rapids
#

but why is it e

smoky oak
#

e short for Echo

#

name of my main class

wraith rapids
#

e short for "what is this"

dusk flicker
#

Use descriptive variables

wraith rapids
#

variable/field names should be descriptive

#

especially so when they store important things that are accessed in a lot of places

quiet ice
#

In this case e would be pretty ambigious

#

It already has a few meanings

smoky oak
#

true but since I'm always doing Echo.e and the only thing else stored in there is the FileConfiguration

#

it works fine for me

dusk flicker
#

Still not good

#

That's just a shitty coding practice

wraith rapids
#

use Echo.instance or if you absolutely need to shorten it, Echo.inst

#

nobody knows what Echo.e is

smoky oak
#

eh cant argue with that

earnest sonnet
#

^^

smoky oak
#

by the way

quiet ice
#

1-character field or method names are a no-go (except for like, Location.x, Location.y, etc)

smoky oak
#

is java public static Echo Instance() {return e;} slower or just as fast as Echo.e ?

wraith rapids
#

meet my 1 character localization method, public String _()

dusk flicker
#

Firstly should be lowercased instance

wraith rapids
#

no difference in performance

quiet ice
#

JIT will inline it

#

especially since it is static; if you were to make your class final then it has the highest chances of getting inlined

smoky oak
#

in english please?

wraith rapids
#

in english: don't worry about it

#

it doesn't matter

quiet ice
#

Java is just-in-time compiled and java (not javac - even if javac will optimise some things) will optimise this

smoky oak
#

what does java compile during runtime? Isn't it a VM running only java interpreting the alredy compiled code?

wraith rapids
#

whatever answer is given to you at this point will probably be misunderstood and won't help you achieve anything

#

don't worry about it yet

smoky oak
#

im just interested

#

sometimes i want to know the why instead of only the how

#

and that just isnt adding up

#

java gets compiled

#

you execute that compiled code

#

so where does JIT come in

quiet ice
#

javac compiles into JVM bytecode

#

JIT compiles it (the JVM bytecode) into magic, like machine code however

compact haven
#

๐Ÿ˜

quiet ice
#

Which is why I said the (except for)

compact haven
#

oh

#

im so fucking blind

earnest sonnet
#

JVM is capable of caching

waxen plaza
#

What's the most used api for adding permission/economy compatibily to my plugins?

smoky oak
#

aah i think i understand. Javac makes the code as ready as it can be generally then java throws it thorugh the jvm. Is that why you can still sort-of read .class files given you use anything that understands java?

quiet ice
#

The CPU can also do that and it results in a lot of exploits

waxen plaza
quiet ice
#

It is the main reason bukkit (and everything else) can exist in the first place

waxen plaza
#

I found vault but it doesn't seem to support 1.17 yet ๐Ÿ˜ฆ

quiet ice
#

Who the hell said that

#

I will scold him/her

earnest sonnet
#

2 of my plugins are using it

waxen plaza
quiet ice
#

fine, I'll link you to a issue

#

now could people finally understand that bukkit is not forge

waxen plaza
#

Thanks

wraith rapids
#

vault doesn't receive updates, not because it's abandoned, but because it's "complete"

earnest sonnet
#

Lmao you took it personally or it's my idea?

wraith rapids
#

that said, that is a fucking joke as it doesn't even have uuid support

quiet ice
#

I have to agree, vault is meh

wraith rapids
#

can we do a hostile takeover of it and update it by force

quiet ice
#

how is reserve looking? Last time it had quite a lot of issues

wraith rapids
#

still pretty fringe and implemented like shit afaik

waxen plaza
#

Is it hard to learn to implement the api? I'm new to making plugins not java

earnest sonnet
#

Did the author go MIA?

wraith rapids
#

to be honest I'm more concerned by the fact that reserve is the primary alternative

wraith rapids
#

with how horrible it is

quiet ice
#

The author just doesn't touch to codebase anymore

waxen plaza
quiet ice
#

And are there any other alternatives?

earnest sonnet
#

Eeeeh, even if there is, if it's not mainstream then it's going to cause "compatibility" issues with other plugins

quiet ice
#

then do it by force

earnest sonnet
#

How so?

quiet ice
#

pull requests everywhere

earnest sonnet
#

๐Ÿ˜‚ ๐Ÿ˜‚ ๐Ÿ˜‚

#

That's a solution to be fair

smoky oak
#

is the world.getTime() return analogous to the number of ticks passed in it?

#

since the docs only says 'analogous to hours *1000' and i dont know what that means

quiet ice
#

Then it isn't analogous to the amount of ticks

hardy swan
#

Lets fork vault

quiet ice
#

I assume that to obtain the day in the world you would need to do world.getTime() / 24000 based on that doc

#

I don't think that forking is much of an option

hardy swan
#

And continue by ourselves

quiet ice
#

It would need to have emitters, UUID support, removal of the depose/withdraw by name methods, actually proper bank support and much more

#

Forking would lead to nothing

waxen plaza
#

Is a player group another way of saying a player rank? I am confused whenever I see this.

hardy swan
#

Wait vault isnt open source?

#

Rip

quiet ice
#

Vault is open source

hardy swan
earnest sonnet
quiet ice
#

I would call them PermissionSet if I were to name it something

hardy swan
#

It is node

#

๐Ÿ˜‚

quiet ice
#

I could also live with that

#

But group and rank are too indescriptive

smoky oak
#

can you forward the entire console to a player?

quiet ice
#

probably yes

#

You could try to see whether abducting System.out works

hardy swan
smoky oak
#

ah ok

onyx shale
#

and forward it

quiet ice
#

I guess that is a better place

earnest sonnet
onyx shale
#

not sure it does what system out does,but it has a interface you can itneract with it at least

quiet ice
#

The issue is that paper uses another logging system

onyx shale
#

does it not use the classic 4logger

quiet ice
#

It may use it, but there is something added to it that may or may not change it

hardy swan
onyx shale
#

hmm i guess its a husttle then

quiet ice
#

I know that paper uses TCA and spigot not

earnest sonnet
onyx shale
#

in that case connecting to current java instance and pullin console out its best case

#

dont think bukkit or spigot has anything that can connect to the console itself

#

its more of a java instance problem

quiet ice
#

I think you could mess with the log4j configutations - but I don't think that it is possible at runtime

onyx shale
#

the only problem i can think with log4 is that it only registers certain things

#

you wont have full console

smoky oak
#

Caused by: java.lang.NullPointerException: Cannot invoke "org.bukkit.metadata.MetadataValue.asLong()" because the return value of "io.github.moterius.ofraces4.Echo.getMetadata(org.bukkit.metadata.Metadatable, String) is null"

//Function a:
long time = System.currentTimeMillis();
Echo.setMetadata(player, "this_call", time);

//Function b:
long current = Echo.getMetadata(player, "this_call").asLong();
//This ^ is the line with the error```
I did verify that the metadata getter/setter work, and that the player  variable refers to the same entity. So what's the issue here?
#

or rather why is it null when I'm clearly setting it just before

onyx shale
#

can you add a if check before getting it

quiet ice
#

did the server shut down in the meantime?

smoky oak
#

no

#

err

#

i could and it did not

#

i know that metadata gets lost on reboot

onyx shale
#

also Echo.

#

it might be he implementation itself being the error

smoky oak
#

Well the methods are those:

public static void setMetadata(Metadatable object, String key, Object value) {
          object.setMetadata(key, new FixedMetadataValue(echo_instance,value));
        }
    public static MetadataValue getMetadata(Metadatable object, String key) {
          List<MetadataValue> values = object.getMetadata(key);  
          for (MetadataValue value : values) {
             // Plugins are singleton objects, so using == is safe here
             if (value.getOwningPlugin() == echo_instance) {
                return value;
             }
          }
          return null;
        }```
But the key and the plugin variable are valid so it should alawys return a value
onyx shale
#

have you tried using the api way

#

and see if it has the same problem

smoky oak
#

not too sure what you mean

hybrid spoke
#

whats the error?

#

ah i see

#

make sure your list is not empty, make sure this is true value.getOwningPlugin() == echo_instance

smoky oak
#

okay thats weird

#

it worked before but now that check is false

#

Oooookay backup

#

THIS: Echo.setMetadata(pearl, "nodamage_pearl", true); works with MetadataValue v2 = null; v2 = Echo.getMetadata(pearl, "nodamage_pearl"); that. BUT!
THIS: long time = System.currentTimeMillis(); Echo.setMetadata(player, "this_call", time); does NOT work with THAT: long current = Echo.getMetadata(player, "this_call").asLong();

The first instance returns a 'true' for the owningPlugin check, the second a 'false'

#

and it got nothign to do with the boolean values if i save a boolean as metadata instead and try to retrieve it it also says null

#

Does metadata not work with players?

#

@hybrid spoke

onyx shale
#

should work

smoky oak
#

well it doesnt

granite stirrup
#

whats Echo?

#

shouldnt it just be player.getMetadata(String str)?

smoky oak
#

Echo is the class handling everything

#

look further up i posted the methods

granite stirrup
#

ok but why not just do player.getMetadata

#

lol

smoky oak
#

I'll try that

granite stirrup
#

same wth the setMetadata

#

player.setMetadata

#

player.getMetadata("this_call").asLong();
player.setMetadata("this_call",time);

tiny wolf
#

Hey, anyone know why me registering a listener class is returning:
java.lang.IllegalStateException: zip file closed

undone axleBOT
granite stirrup
#

are you using /reload

tiny wolf
#

no

#

this is on reboot

granite stirrup
#

oh i thought it was caused by listener already registered

sage swift
#

there are a lot of these errors since java 16, I've especially seen them happen on shutdown with network plugins

tiny wolf
#

odd

sage swift
#

plugins that utilize outside networking or async

tiny wolf
#

Im gonna update my server jar real quick

sage swift
#

like votifier, LibsDisguises

tiny wolf
#

Hmm

sage swift
#

but, on startup? haven't seen it.

granite stirrup
#

EodHud.java:22?

granite stirrup
#

can you post code tho

tiny wolf
#

this.getServer().getPluginManager().registerEvents(new Handler(), this);

granite stirrup
#

maybe you wont want to name something Handler

#

give it a better name

tiny wolf
#

lol why

#

its for my events..

granite stirrup
#

they might be something named Handler already

tiny wolf
#

Its my one

#

I know that for sure lol

granite stirrup
#

still name it something better like "EodHudEventHandler"

high pewter
#

I'm trying to give a player a smooth animation when they join the server by making them ride an armour stand and teleporting the armour stand (I tried teleporting the player but it was very janky and didn't allow the player to look around). For some reason, when my armour stand is invisible, the player remains sat where they started riding the armour stand until they press shift, but they aren't teleported with the armour stand. However, when the armour stand is visible, the player isn't made to ride it at all, though I can see the armour stand does the animation perfectly. Anybody got any ideas why? https://paste.pythondiscord.com/totacekavo.java

granite stirrup
#

teleporting players is janky and shit no fix for that

high pewter
#

The player to move with the armour stand

tiny wolf
granite stirrup
high pewter
#

Well, a few people recommended having them ride an entity and teleporting the entity as that removes jankiness for them

tiny wolf
#

I removed everything in it just to make sure it wasnt anything in there

granite stirrup
#

can you send full code in a paste then

high pewter
#

Who are you talking to?

granite stirrup
#

shmezi

high pewter
#

Alright

tiny wolf
granite stirrup
high pewter
#

Well, even if it's janky still, I know this will fix the rotation. But, at the moment, the player isn't moving at all

granite stirrup
#

so how do you know your class Handler is the only class named Handler

tiny wolf
sage swift
#

why are you disabling the fucking plugin in onEnable

granite stirrup
#

lol i see that now

sage swift
#

lmfao

tiny wolf
#

thats not the issue.

sage swift
#

yes, it is

#

lmao

tiny wolf
#

That was a mistake from the debugging lol

granite stirrup
#

yes it is

#

it is the issue

#

because you cant register a event when the plugin is disabled

tiny wolf
#

Probs was left from me trying to debug lol

granite stirrup
#

ok but remove it

#

and see if it works

tardy delta
#

how can i search further in a config option? lets say i want to get the individual lines of the scoreboard

granite stirrup
#

this took forever (responsive too :) )

tiny wolf
#

We never speak of this again ๐Ÿ™‚

granite stirrup
tiny wolf
#

I feel like an idiot, anyways thanks yall lol

granite stirrup
tardy delta
#

and what would be the path in this case?

#

something like this?

String name = plugin.getConfig().getConfigurationSection("scoreboards").get("1").toString();
#

to get the title

shy wolf
#

hi guys i need help
how i get who kill on PlayerDeathEvent?

#

i dont see and method for that

dusk flicker
#

You cant

#

Need to do on damage is gonna kill the player

shy wolf
dusk flicker
#

On the damage event

#

Check the health and delt damage, if it is gonna be enough to kill cancel it and run any code you need

digital plinth
#

damn my plugin uses crop state

#

and the server just starts initializing legacy suport out of nowhere

#

is there a way to like tell the server to initialize when it starts up

quaint mantle
#

Everytime I need to pull data or set do I need to connect to the database and disconnect? I'm using SQLite

#

They said it would be nice to keep a connection active, but when I remove the disconnect and connect option it returns null when pulling data.

digital plinth
#

hmmm

#

ShapelessRecipe rec = new ShapelessRecipe(new ItemStack(item));

#

:/

#

is shapelessrecipe is deprecated

#

whats the recommend then

#

ah nvm

granite stirrup
digital plinth
#

yea just realized it

#

new NamespacedKey(this,"BUKKIT")

#

this should fix it

#

ShapelessRecipe rec = new ShapelessRecipe(new NamespacedKey(this,"BUKKIT"),new ItemStack(item));

granite stirrup
#

do you know css?

#
    nav a::before {
        content: '';
        display: block;
        height: 5px;
        background-color: black;
        position: absolute;
        top: -.75em;
        left: 0;
        right: 0;
        transform: scale(0,1);
        transition: transform ease-in-out 250ms;
    }

    nav a:hover::before {
        transform: scale(1,1);
    }``` cuz the background-color on this isnt working ;-;
#

and i need help fixing it lol

digital plinth
#

nope

granite stirrup
#

f

rocky glacier
#

anyone knows a plugin to make custom model mobs on server?

digital plinth
#

mobs
custom models?

granite stirrup
digital plinth
#

i think the models only apply for items

ivory sleet
rocky glacier
#

w/ txtpack you cant do mobs

ivory sleet
#

U got it on GitHub?

granite stirrup
#

its 186 lines

#

the css

granite stirrup
toxic mesa
#

So i've used the connect thingy with a bungeecord channel

    public void connect(Player player, String server) {
        ByteArrayDataOutput out = ByteStreams.newDataOutput();
        out.writeUTF("Connect");
        out.writeUTF(server);
        player.sendPluginMessage(plugin, "BungeeCord", out.toByteArray());
    }

Now I don't believe it returns anything, is there any way I can detect if it has succeeded or failed for whatever reason

noble spire
#

What's the best method to use to figure out which dimension is a specific world is in?

Are there constants like Dimension.OVERWORLD etc..,

or do you need to use World#getName.contains("overworld") etc...

granite stirrup
ivory sleet
#

Damn so unused to css but yeah gimme a look

granite stirrup
#

lol

ivory sleet
#

Uh well I will try help once I get on pc

granite stirrup
#

oof

#

k

ivory sleet
#

Yeah dealing with css code is bound to unpleasant things which I canโ€™t handle right now lol

noble spire
ivory sleet
toxic mesa
#

So i've used the connect thingy with a bungeecord channel

    public void connect(Player player, String server) {
        ByteArrayDataOutput out = ByteStreams.newDataOutput();
        out.writeUTF("Connect");
        out.writeUTF(server);
        player.sendPluginMessage(plugin, "BungeeCord", out.toByteArray());
    }

Now I don't believe it returns anything, is there any way I can detect if it has succeeded or failed for whatever reason

tardy delta
#

will this point to "title"?

plugin.getConfig().getConfigurationSection("scoreboards").getString("title");

(ignore those red stripes)

#

i'm pretty bad at this

dusk flicker
#

I'd recommend you learn more about the yaml api and just standard practices

#

Considering that wouldn't work

tardy delta
#

uhu ๐Ÿฅบ

#

but

#

how can i cast a boat to craftboat?

eternal night
#

do you depend on the server implementation ?

tardy delta
#

uhh i just want to access the .damage() method

foggy bough
regal lake
#

@foggy bough you should learn how to read a stacktrace..

foggy bough
#

my main class and line 20?

regal lake
#

yes...

tardy delta
#

yes

foggy bough
regal lake
#

The Stacktrace dont lie ๐Ÿ˜„

#

Show us you class.

foggy bough
#

ok

tardy delta
#

maybe changed it

foggy bough
regal lake
#

Then you changed something, recompile the plugin and test it again..

foggy bough
#

ok

tardy delta
#

why don't you have an ondisable?

foggy bough
#
        at org.bukkit.plugin.java.JavaPluginLoader.loadPlugin(JavaPluginLoader.java:139) ~[spigot-1.16.5.jar:2991-Spigot-018b9a0-f3f3094]
        at org.bukkit.plugin.SimplePluginManager.loadPlugin(SimplePluginManager.java:394) ~[spigot-1.16.5.jar:2991-Spigot-018b9a0-f3f3094]
        at org.bukkit.plugin.SimplePluginManager.loadPlugins(SimplePluginManager.java:301) ~[spigot-1.16.5.jar:2991-Spigot-018b9a0-f3f3094]
        at org.bukkit.craftbukkit.v1_16_R3.CraftServer.loadPlugins(CraftServer.java:383) ~[spigot-1.16.5.jar:2991-Spigot-018b9a0-f3f3094]
        at org.bukkit.craftbukkit.v1_16_R3.CraftServer.reload(CraftServer.java:879) ~[spigot-1.16.5.jar:2991-Spigot-018b9a0-f3f3094]
        at org.bukkit.Bukkit.reload(Bukkit.java:651) ~[spigot-1.16.5.jar:2991-Spigot-018b9a0-f3f3094]```
#

I got this error again

regal lake
#

Please read the stacktrace, it clearly says what the error is ๐Ÿ˜…

foggy bough
#

is my plugin.yml ok? main: com.joelj.plugin.Main name: OPStuff version: 1.0 api-version: 1.16 commands: opstuff:

regal lake
#

If you're plugin.yml would be invalid you would get a other error message.
Please read the stacktrace (the first line...).

hoary knoll
#

does persistent data in an itemstack also appear in the block persistent data container if is is placed from that stack?

opal juniper
#

no

granite stirrup
#

@ivory sleet i got it working :)

hoary knoll
#

also, are there some blocks that cant have persistent metdata?

ivory sleet
#

Nice!

tender dirge
#

Do someone knows how to use kubernetes with bungeecord?
send dm

ivory sleet
#

Feels like a google question, something more specific you need assistance with?

hoary knoll
#

can you store custom data in placed blocks?

ivory sleet
#

TileEntities

granite stirrup
#

yea what it was is i was doing the pseudo elements on the a instead of the p

ivory sleet
#

Oo

granite stirrup
#

i have this now ```css
nav p {
opacity: 1;
position: relative;
}

nav p::before {
    content: '';
    display: block;
    height: 5px;
    background-color: var(--main-nav-text-hover-color);
    position: absolute;
    bottom: -.75em;
    left: 0;
    right: 0;
    transform: scale(0,1);
    transform-origin: center;
    transition: transform ease-in-out 250ms;
}

nav p:hover::before {
    transform: scale(1,1);
}```
#

when it wasnt working before it was with the a

#

i fixed a bug in it rn

#

when you where in the mobile mode and you open the burger menu when you went back into desktop mode it like moves the nav bar up and to the left more

#

fixed it by doing this ```css
@media screen and (max-width: 899px) {
.nav-toggle:checked ~ nav {
display: block;
transform: scale(1,1);
}

.nav-toggle:checked ~ nav a {
    opacity: 1;
    transition: opacity 250ms ease-in-out 250ms;
}

}```

#

instead of having it without @media screen and (max-width: 899px) {

ivory sleet
#

Oh well I use sass so kinda unused to the syntax but yeah sounds reasonable

granite stirrup
#

lol

#

this nav bar took me like 9-10 hours

#

xd

#
<?php
    include 'site/base/index.php';

    echo 
        '<meta property="og:site_name" content="Site">',
        '<meta property="og:title" content="Site">',
        '<meta property="og:description" content="Site">',
        '<meta property="og:image" content="/test/site/img/icon.png">';
?>

    <title>Site</title>

    <link rel="stylesheet" href="styles/main.css">
    <script src="js/main.js"></script>
<?php include 'site/inc/nav.php'; ?>
    <content class="content">
        <p>Test</p>
    </content>
</body>``` im using php :)
ivory sleet
#

๐Ÿฅถ

granite stirrup
#

lmao

granite stirrup
ivory sleet
#

Uh no newer versions of php is fine

#

I guess it kinda has a bad reputation for its notorious history

granite stirrup
#

im using php 8.0.7 lol

#

which is latest

#

i think

ivory sleet
#

I know for a fact a lot of php stuff back then didnโ€™t use prepared statement for instance

granite stirrup
#

?

ivory sleet
#

Yeah

#

They used normal sql statements which basically means sql injections

knotty valve
#

can someone help me with this error?

granite stirrup
#

i still dont know how prepared statement prevent sql injections

ivory sleet
#

Prepared statements prepare the statement such that it canโ€™t be changed, you can only set the params

wraith rapids
#

only druggie hobos do injections

#

DI is gay

#

not that it's related to this

ivory sleet
#

A normal statement can be changed so for instance you could comment out half of the statement and then write your own sql thing

wraith rapids
#

my toes hurt

ivory sleet
#

Though I guess this explanation isnโ€™t really whatโ€™s actually going on but myeah something like that

granite stirrup
wraith rapids
#

i don't know, nerve damage or something

ivory sleet
#

But you can still walk or no?

granite stirrup
#

f

dusk flicker
#

The only bones I break are my toes lol

#

I've broken so many toes

ivory sleet
#

Do you program with your toes instead of your fingers or how do you accomplish such misery?

dusk flicker
#

See I have an amazing skill of walking into walls or stubbing my toes randomly

#

First time I broke a toe was walking on smooth concrete that was wet

ivory sleet
#

๐Ÿ˜”

dusk flicker
#

Last few times was just walking into walls tho

#

That resulted in stubbing my toes

wraith rapids
#

it started back when I was in military

#

the doctor said it was like nerve damage or something, it was kind of unclear why things are as they are

#

too much marching ig

dusk flicker
#

How fucking old are you NNY

wraith rapids
#

older than 1.8

#

but only marginally

granite stirrup
#

5 years old?

#

1.8.8 is 5 years old

opal juniper
#

4

#

he is 4

granite stirrup
#

1.8 came out in September 2, 2014

#

so he is 7

granite stirrup
digital plinth
#

prove it

#

eg: voice recording

#

/face reveal

#

lol

torn shuttle
#

I have a really weird question but can firework rockets not be shot downwards?

granite stirrup
#

ยฏ_(ใƒ„)_/ยฏ

#

wat you can setOp on a firework

torn shuttle
#

you can set op on any entity

granite stirrup
#

but why on a firework

torn shuttle
#

you can make lightning op

granite stirrup
#

๐Ÿคฃ

#

wtf you can check if fireworks have permissions

chrome beacon
#

Well all entities can execute commands

torn shuttle
#

found it

#

firework#setShotAtAngle

#

yeah it wasn't going down without that

#

weird mechanic

granite stirrup
#

why do you need to shoot it down

#

xd

#

lol

granite stirrup
torn shuttle
#

simply setting the velocity would do that

granite stirrup
#

or maybe they lazy to set the velocity itself

#

or maybe its just there cuz why not

wraith rapids
#

they probably don't want the direction to be affected by stuff that'd otherwise modify the velocity

#

f.e pushing it with a piston, or explosions

granite stirrup
#

probs that

#

but couldnt they just make it not pushable?

wraith rapids
#

and have it phase into blocks instead?

granite stirrup
#

i really dont know why you cant extend more than 1 class in java but then now i think about it they might be a few conflicts or something

#

cursed

#

im selecting two things

#

lol im using tab for one and then hovering over another one

#

xd

dusk flicker
#

You just extend something that extends something else

granite stirrup
#

i mean i guess but then its kinda not really like extending two classes

torn shuttle
#

hm how can I prevent fireworks from firing?

#

by which I mean detonating

granite stirrup
#

cancel the event?

torn shuttle
#

afaik there is no even for it

granite stirrup
#

there is?

weak wasp
#

You can not guarantee in a generic sense that extending two classes will not create conflicts. So instead there is an interface system, which is more coding, but in generic sense guarantees any conflicts will be solved. You can implement essential as many interfaces as you want. https://docs.oracle.com/javase/tutorial/java/IandI/createinterface.html

torn shuttle
#

ah you can edit it in the fireworkmeta, I see now

granite stirrup
#

lol

wraith rapids
#

there are some languages that do allow multiple extension, but java doesn't do that

ivory sleet
#

I can smell constructor and instantiation conflicts

silver robin
#

How to send a player to another server (using bungeecord)? Like when the player types command /server event I want to do it server-side from a plugin (and forcing the player to use /server command is probably not good idea)

ivory sleet
#

Register your plugin as an outcoming channel

#

Then use the PluginMessageRecipient to send messages to the BungeeCord channel

silver robin
#

I already read a similar thread to this (from 2018) and first look at the code, it looked unstable, but since this one is official I guess there is no other way

#

Ty

ivory sleet
#

Itโ€™s not official, anyone can edit it however itโ€™s a good base

silver robin
#

Didn't know spigotmc wiki is public, but if its correct and it works, its good

dusk flicker
#

Nearly all of the wiki works just we keep it updated

ivory sleet
#

we

#

๐Ÿฅฒ

granite stirrup
#

I need to fix the burger

wraith rapids
#

i fucking hate burgers

granite stirrup
#

:)

#

Lol

wraith rapids
#

shittiest innovation of web design ever

granite stirrup
#

Btw this is all css

#

Well there's html

#

But yeah mostly css

#

lol

granite stirrup
#

Fuck I broke it

#

Fixed :)

cinder timber
#

the logo is my favourite

topaz moon
#

rofl

granite stirrup
#

lol

#

Logo

topaz moon
granite stirrup
topaz moon
#

oh ok

granite stirrup
#

it looks tiny on ipad pro

#

apparently

#

oh theres a bug if you turn around on a phone you cant scroll lmao

topaz moon
#

well, is there something to scroll for?

granite stirrup
#

ye

granite stirrup
#

I fixed it

#

I just made the navmenu smaller when your rotated the other way

#

But I realised why it didn't work

#

The navmenu was fixed xd

ivory sleet
#

React components ๐Ÿ˜Œ

granite stirrup
#

Coding something yourself gives you more control :)

wraith rapids
#

and worse results, generally

granite stirrup
granite stirrup
#

jpg is shit and i think my phone takes screenshots in it

#

#eww

#

but also my phone has a shit screen lol

#

i think

#

that jpg image looks better on my phone lmao

#

oh if i open original it looks better

#

is that just discord making it look shit

#

i found out that 5rem is smaller than 100px

#

on my screen

silver robin
dusty sphinx
#

How the hell does Location.getYaw() work? The Javadocs say that it will only output 0-360 but i seem to get -180 - 360

granite stirrup
#

i thought its meant to be -360 - 360

dusty sphinx
#

How does that work then?

granite stirrup
#

ยฏ_(ใƒ„)_/ยฏ

dusty sphinx
#

I've been trying to re-implement something like the compass into my UI and it's driving me insane

granite stirrup
#

wait isnt it meant to be -180 - 180

wraith rapids
#

if I access the value of a public static final field before it's assigned, does it explode or does it return null ๐Ÿค”

dusty sphinx
#

Thats how vanilla does it

#

but it doesnt seem to work for me

forest edge
#

I've got a question regarding unicodes and String conventions. I am have an int variable that I'd like to turn into a unicode to use as an emoji in game. This int is 0 <= x <= 31, and I combine it in a String using something like String unicode = "\\uEC" + num;. This gives me the correct unicode in a string format, but does not actually display the emoji that it should go with. If I were to manually write the unicode, like \uEC01 then it would work fine. Any ideas?

wraith rapids
#

one would think so yes

granite stirrup
#

is it possible in a lan world to get port 25565 ?

wraith rapids
#

create a char with the actual numerical value of the unicode code

#

that is, 0xEC01

#

use whatever method Integer provides to decode the hexadecimal string into an integer and cast it into a char

granite stirrup
#

NNY is it possible to get port 25565 in lan worlds

wraith rapids
#

how should I know

#

i don't run lan worlds, I'm not gay

granite stirrup
#

i have to cuz my brother only like them

dusty sphinx
#

i think it just tries to bind the port and catches the error if it doesnt work

#

i have literally never looked into the client

true jacinth
#

hey guys, how do I import CommandKit();?

granite stirrup
dusty sphinx
#

i sure hope it doesnt bind to 265565

#

why wouldn't you want it to bind to 25565 anyway

granite stirrup
#

25565*

silver robin
true jacinth
vale cradle
silver robin
vale cradle
true jacinth
vale cradle
#

ok, that's fine

#

your question will be answered when you start learning object oriented programming

forest edge
# vale cradle Are you looking to cast the int to a `char`?

Well I've got this code that will make a unicode with a given number, String emoji = "\\uEC" + (num < 10 ? "0" + num : num);, the only issue is that when sent in game it does not show an actual emoji, but rather the unicode (e.g. \uEC01 or \uEC31). If I were to actually write the unicode String emoji = "\uEC04" it would work and turn itself into an emoji

true jacinth
silver robin
#

General idea is : you can't create something that doesn't exist in this case CommandKit @true jacinth

dusty sphinx
#

what the hell

vale cradle
dusty sphinx
#

getYaw outputs signed AND unsigned floats?

#

its def -360 to 360

#

but how the fuck

forest edge
vale cradle
#

I know what you mean

#

but that's not the way that way works

#

you need to either replace existing characters with emojis or make them in a custom font

forest edge
#

I suppose the easiest solution would be to make a map with the corresponding unicode for the given number

#

but I am sure there is a solution where I could simply concatenate the number and other characters to form the unicode

vale cradle
forest edge
#

Yeah, my issue exactly. If I send the player a title using the /title command it works

vale cradle
#

What command you used?

forest edge
#

/title <player_name> actionbar {"text":"\uEC01"}

#

that displays an emoji to the player, and actually converts the given unicode to the emoji

granite stirrup
#

a

vale cradle
#

You used that command along with a custom texture pack?

forest edge
#

Yeah, displays the emoji fine

#

but I'd much prefer sending the player a message than using the command

#

additionally the command sends opped players a message

vale cradle
#

may I give a look to the texture pack?

forest edge
#

Texture pack is private, here's a snippet from the default.json in the font folder:

        {
            "type": "bitmap",
            "file": "minecraft:item/compass_29.png",
            "ascent": 8,
            "height": 9,
            "chars": ["\uEC29"]
        },
        {
            "type": "bitmap",
            "file": "minecraft:item/compass_30.png",
            "ascent": 8,
            "height": 9,
            "chars": ["\uEC30"]
        },
        {
            "type": "bitmap",
            "file": "minecraft:item/compass_31.png",
            "ascent": 8,
            "height": 9,
            "chars": ["\uEC31"]
        }
#

for context the given number is a direction that corresponds to a compass emoji

#

to direct a player to a given location

vale cradle
#

Have you tried sending the message to the player using Components?

forest edge
#

player.spigot().sendMessage(ChatMessageType.ACTION_BAR, new TextComponent(emoji));

#

where emoji is a unicode like I explained (\uEC01 or \uEC24 for example)

vale cradle
#

what minecraft version you are?

forest edge
#

1.16.5

#

Bear in mind if I were to explicitly type the unicode for example player.spigot().sendMessage(ChatMessageType.ACTION_BAR, new TextComponent("\uEC10")); it works fine

#

it is just how I am concatenating the string with String emoji = "\\uEC" + (num < 10 ? "0" + num : num); that does not convert it to an emoji

#

...something with how java works I suppose

vale cradle
#

Yes, I know what, you are using a literal to define a character using unicode numbers

forest edge
granite stirrup
forest edge
#

Yes

vale cradle
#

I mean, the unicode character gets changed all along when you write the complete sentence using the \u

#

If not, you will get a compile error, because I think that character is changed at compile time

granite stirrup
#

ah ok

vale cradle
granite stirrup
#

i was wondering what it was for

vale cradle
#

you need to find a way to get the character associated without using \u

forest edge
#

hmm

ivory sleet
#

MrTommy I am quite suspicious how you got that dot there

candid silo
#

what's the best way to store cords to be grabbed through server restart that can change based on the world loaded. Using this for marking objectives for a minigame that has multiple maps

dusty herald
#

You could always store the Location value in the config

candid silo
#

Would armorstands work?

ivory sleet
#

well

#

you would need to keep track of the armorstands then so that you can somehow retrieve them post restart

candid silo
#

yeah that is an issue

ivory sleet
#

just use a flatfile in the first place?

candid silo
#

wait there's a world.getentities() that I could sift through on startup. because it's a minigame world it's not like there are very many entities.

ivory sleet
#

ยฏ_(ใƒ„)_/ยฏ

#

sounds like an awkward solution

granite stirrup
#

what does it mean when the java edition on the logo in the launcher is gone sometimes or turns transparent or half of it is gone cuz thats what happening to my brother rn

candid silo
ivory sleet
#

just a yml file

ivory sleet
granite stirrup
#

he probs dont have enough memory

#

he has like 4gb ram

#

not a chrome book

ivory sleet
#

I have 8gb kek

granite stirrup
#

same

wraith rapids
#

world.getentities only returns loaded entities

candid silo
#

am I able to store a config file within the world folder?

wraith rapids
#

don't do that

candid silo
#

Realize I don't need to because I already have a different server folder for each map for world guard and stuff like that

turbid bolt
#

Is there a way to check if an entity with the given UUID exists even if it's unloaded? I don't necessarily need the Entity object, just need to check if it exists.

wraith rapids
#

there is not

#

and even if there were, it would be very, very slow

turbid bolt
#

Well in 1.16 world.getEntity(UUID) seemed to work fine even if the entities were unloaded (or I guess manually loading the chunk loaded the entity as well and I could therefore get it)

#

So I guess is there a way to force load an entity since loading the chunk the entity is in doesn't work any more

wraith rapids
#

if the API says the chunk is loaded, all of the entities in the chunk are also loaded

#

like blocks, entities also belong to chunks and load and unload with them

true jacinth
#

How do I fix this? I tried editing my plugin.yml so many times that idk know anymore what to do

true jacinth
#

oh my god...

granite stirrup
#

add description:

#

idk if you need it or not

unreal quartz
#

you donโ€™t need description

granite stirrup
#

i think you do

granite stirrup
unreal quartz
#

itโ€™s probably not packaged with the plugin

#

no

true jacinth
#

got the error again

unreal quartz
#

you just need the main path and name

#

and a version probably

granite stirrup
#

and author?

true jacinth
#

a version is already added, im gonna see about not packaged

#

i mean, if this is not packaged...

granite stirrup
#

open it up

true jacinth
granite stirrup
#

open it up in winrar

true jacinth
#

there are my classes here only

granite stirrup
#

that means your plugin.yml isnt getting packaged

true jacinth
#

hmmm ok

#

and how do i do that?

quaint mantle
#

yo, any sort of event listener specific to cartography tables? looked on the spigot javadoc and couldn't find any

granite stirrup
#

make sure its in src/main/resources

true jacinth
#

yea it is

granite stirrup
#

make sure ur using mvn package

#

for maven

true jacinth
granite stirrup
#

click the maven button in intellij

quaint mantle
#

yeah @true jacinth run mvn clean install in the terminal rq and package that way. Send over a screenshot if it gives you an error message

true jacinth
#

maven button? sorry im a beginner

granite stirrup
#

should be on the side

quaint mantle
#

top right

#

click on maven

true jacinth
quaint mantle
#

ah icic you're using gradle

granite stirrup
#

oh your using gradle

#

lol

true jacinth
#

XD

granite stirrup
#

welp idfk about gradle

quaint mantle
#

@true jacinth do you have gradle installed on your system or is it just added to intellij?

true jacinth
#

I tried doing this

dusty herald
#

kneez

#

click this:

dusty herald
#

then type gradle build

true jacinth
#

build successful

dusty herald
#

ใŠ—๏ธ

#

๐Ÿ˜–

#

wrong fucking emotes

#

๐ŸŽŠ

true jacinth
#

lmao im sorry for being dumb

dusty herald
#

no you're not dumb

quaint mantle
#

@true jacinth check to see if the plugin works now

turbid bolt
true jacinth
#

this is the full error i guess

quaint mantle
#

send a screenshot of your entire ide with the directory

unreal quartz
#

gradle build output is build/ not out/

#

make sure youโ€™re copying the correct jar

quaint mantle
#

^^^

true jacinth
#

oh, this?

unreal quartz
#

yes

true jacinth
#

omg

#

thanks guys

#

let me test it

#

compatibility?

unreal quartz
#

your main path is wrong

true jacinth
#

because it is not from plugins folder

unreal quartz
#

main points to your main class

true jacinth
#

I'm trying to find the main class but it seems I don't have one... but this seems wrong because I can build the project

wraith rapids
#

the compiler doesn't give a shit about having a "main class"

#

"main class" as we speak of it is purely a bukkit concept; the java language or compiler doesn't care

wild marten
true jacinth
#

perhaps is compatibility

quaint mantle
#

most of the time it can't enable for a reason

wild marten
true jacinth
wraith rapids
#

you're probably instantiating your main class somewhere

true jacinth
quaint mantle
#

send your code for MC_Kits.java

true jacinth
#

this is mc_kits java

#

idk if it is my main class

wild marten
#

it is according to your plugin.yml

true jacinth
#

i had to rename for this, instead of me.mystAnorak

wild marten
#

does it work now?

true jacinth
wild marten
#

send the error

true jacinth
unreal quartz
#

?learnjava

undone axleBOT
wild marten
#

so at the top after extends JavaPlugin add implements CommandExecutor

true jacinth
wild marten
#

your error is because new MC_Kits() doesnt return a CommandExecutor which the .setExecutor() is looking for

wraith rapids
#

if MC_Kits is your main class, you should not do new MC_Kits()

wraith rapids
#

you should not and you can not instantiate your main class

#

an instance of it is already created by bukkit, and it is expected to be a singleton

#

bukkit enforces this singleton property; if you try to make another instance, it explodes

wild marten
#

shoudnt they use this instead?

wraith rapids
#

yes

true jacinth
#

at start I edited from new CommandExecutor() to new MC_Kits() because I didn't wanted to add a new class just to add some lines of code when I could do in the same

#

but i guess its time to go back

wraith rapids
#

you should learn java

true jacinth
#

yea

wild marten
#

thats what is should be

#

(without imports cuz i dont know them off the top of my head)

subtle kite
#

this is my main class if this helps you out

true jacinth
#

hmmm thank you

subtle kite
#

also the plugin if needed

true jacinth
#

it is working guys

#

gg

wild marten
#

ok

digital plinth
#

a question

#

why does the math.random like

#

output the same value multiple times

#

on some oocasions

wild marten
#

cuz its random

digital plinth
#

no like

#

20 times

#

straight?

wild marten
#

thats how rng works

#

can u show me ur code

worldly ingot
#

The likelihood of it returning the same value 20 times in a row is slim to none

digital plinth
worldly ingot
#

Unless you're casting it as an int and get very unlucky

wild marten
#

how big is ur number range

digital plinth
#

๐Ÿคท

#

hmmmmmmmmmmmmmmmmmmmmmmmmm

#

so java random is broken

wild marten
#

why is it broken

ivory sleet
digital plinth
wild marten
#

ah

hardy swan
hardy swan
#

What i mean is I have never seen math.random

#

It has always been java.util.Random

tribal sparrow
#

                                    Fire fire = (Fire) block.getBlockData();
                                    System.out.println("block.getBlockData is instance of FIRE");
                                    fire.setAge(fire.getMaximumAge());
                                } else {
                                    System.out.println("Block data isnt instance of fire");
                                }``` is there a proper way to put out a fire without setting the block type to air? setting the age does nothing.
ivory sleet
wraith rapids
#

the reason why they give similar output is because random uses like the system time or something as a seed internally

#

so if you create two randoms at the same instant you get two identical randoms and thus two sequences of identical random numbers

ivory sleet
#

If u need something secure, SecureRandom does exist.

wraith rapids
#

myes

#

the util random should never be used for things like cryptography or things that need security

ivory sleet
#

indeed

quaint mantle
#

i'd be surprised if 2 randoms generated at the same time gives the same results

ivory sleet
#

I think JavaScripts Math.random() is time based like that Idk if the same deal goes for Java

quaint mantle
#
Random random = new Random();
Random random2 = new Random();
System.out.println(random.nextInt() + ", " + random2.nextInt());

Yeah this never gives me the same int

#

2 seconds looking at the seed generation explains why

ivory sleet
#

I believe Math::random uses a single random instance though

quaint mantle
#

likely

digital plinth
wraith rapids
#

yes

digital plinth
#

also you cant put fire on TOP of a block without setting the block on top to air

#

or fire on the side

#

since if you place a block on the side with fire

#

it gets extinguished

tribal sparrow
#

yes well it prints the debug message.

#

i set the fire with

                if(block != null) {
                    block.getRelative(BlockFace.UP).setType(Material.FIRE);```
digital plinth
#

why does that matter

#

it probably meant

#

that the fire got spawned

#

and extinguished

digital plinth
tribal sparrow
#

and it stays lit, but trying to extinguish the fire is my issue, im trying to do it without setting all the blocks to air.
i'm listening to the blockignite event and adding all blocks burning by that fire to a list. I'm trying to put out the fire after 15 seconds

digital plinth
#

and then the block's top face get lit on fire

#

waht does .getRelative return the block you click on or the block above it

wraith rapids
#

what's wrong with just setting it to air to extinguish it

digital plinth
#

the doc did a poor job of explaning

digital plinth
tribal sparrow
#

because thats removing all blocks that are currently on fire

digital plinth
#

wdym all blocks

tribal sparrow
#

after the 15 seconds im trying to extinguish the fire

digital plinth
#

only the block thats on fire?

wraith rapids
#

then just set the fire that you need to extonguish to air?

tribal sparrow
#

only the blocks that are on fire, if i set them all to air it works perfectly

#

but i'm trying to extinguish the fire instead after 15 seconds

digital plinth
#

...

#

runable

wraith rapids
#

then set it to air after 15 seconds

digital plinth
#

runnable*

#

.runTaskLater