#help-development

1 messages ยท Page 494 of 1

remote swallow
#

package private be like?

tender shard
#

yes

regal scaffold
tender shard
#

people taught be about "encapsulation" and I was like "well then i tmust be in the same package"

regal scaffold
#

Yeah this is definitely the way

tender shard
#

and also, check the source code

#

comparing strings all the time

regal scaffold
#

I need 6 plotsquared hooks too

tender shard
#

I was a fucking noob

#

angelchest's code is also a huge mess

regal scaffold
#

It is

tender shard
#

just for fun, lemme know which class you'd like to see

#

I'll paste it completely

regal scaffold
#

I'm literally part of your repo

tender shard
#

(it's still the best ever death chest plugin out there ๐Ÿ˜› )

regal scaffold
#

I spent a night

#

Reading them all

tender shard
#

oh

#

then someone else must choose

regal scaffold
#

To see what you did

#

Your command system

#

Is poop

#

Straight poop

tender shard
#

see how friendly I can be? ๐Ÿ˜›

#

I even add random beginners to my private repos

regal scaffold
#

acf + bukkit

#

๐Ÿ˜ฆ

tender shard
#

never change a running system

regal scaffold
#

I'm not random nor beginner anymore!!

#

You added acf half way

remote swallow
#

can i have MagicMaterial.java

tender shard
#

sure

#

?paste

undone axleBOT
tender shard
#

look at young mfnalex using Main.getInstance()

remote swallow
#

why not just use @Data

tender shard
#

I don't remember if there was any reason

#

maybe, maybe not

#

but also, you gotta note

#

you chose the only class that was completely commented out

#

because MagicMaterial is it's own lib since at least 2 years now

remote swallow
#

lmao

#

it had a funky icon

tender shard
#

choose another class pls

#

I wanna show off how weird my source can be but still achieve 1000+ buyers lol

remote swallow
#

ill take ItemManager

tender shard
#

that one's decent IIRC,. but sure

remote swallow
tender shard
#

oh I gotta add that this is AngelChest 4, so it's like 2 years old

remote swallow
#

just crashed my server with mysql

#

go me

tender shard
#

frostalf would have seen it coming 5 seconds ago

#

you're a bad driver

remote swallow
#

i cant even drive

tender shard
#

see?

#

lmao

slim wigeon
#

How do I get the Lodestone Location? This code throws a error public Location getLocation(ItemStack item) { CompassMeta meta = (CompassMeta) item.getItemMeta(); return meta.getLodestone().getBlock().getLocation(); }

tender shard
#

?notworking

undone axleBOT
#

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

tender shard
#

there are many issues with that

#
  1. Maybe the itemstack "item" is null
#
  1. maybe it's not a compass, so you cannot just cast it
#
  1. maybe getLodestone() is null
remote swallow
#

thats fun

tender shard
#
  1. many more possible problems
sullen marlin
#

Also lodestone is a location

remote swallow
#

mysql cant connect anymore

sullen marlin
#

So location.getblock.getlocation is pointless

remote swallow
#

actually

#

my vps died

tender shard
#

and that too, although this would not throw any errors, but it's pretty pointless ^

slim wigeon
#

How I set the lodestone location and its still null? public void setLocation(ItemStack item, Location location) { CompassMeta meta = (CompassMeta) item.getItemMeta(); meta.setLodestoneTracked(true); meta.setLodestone(location); item.setItemMeta(meta); }

remote swallow
#

i love that i just crashed my vps

#

how did i crask it

tender shard
#

nobody said the location is null

#

we just said it could be

remote swallow
#

thats fucking fun

tender shard
#

and that we don't know if you do not share the whole stacktrace

tender shard
undone axleBOT
tender shard
remote swallow
tender shard
#

lucky you

#

could have been an abuse message lol

slim wigeon
#

Wait, it said the location is null. How when it detects a lodestone location? public boolean isLodestone(ItemStack item) { CompassMeta meta = (CompassMeta) item.getItemMeta(); return meta.isLodestoneTracked(); }

remote swallow
#

well fuck you too oracle

tender shard
sullen marlin
#

Just run a VM on your computer

remote swallow
#

cant

sullen marlin
#

Or use wsl

remote swallow
#

pc wont ever be online constantly

sullen marlin
#

Does it need to be

tender shard
remote swallow
#

yes

#

i had other stuff on the vps

tender shard
#

and you didn't back them up?

remote swallow
#

i backed them up like 2 weeks ago

tender shard
#

then you can go back there

remote swallow
#

i only lost the survival that i made with my friends a few days ago

tender shard
tender shard
#

then it cannot happen again

#

I lost like 500gb of pictures and videos of young me once, since then I know that "no backups = no mercy" is always true

#

you can be glad it was only a minecraft server

remote swallow
#

why cant they have a way to remove resources from an instance

slim wigeon
#

I said that above, I just wanted to set the lodestone location and get that location

tender shard
#

you got it for free

remote swallow
#

wouldnt they want the resources back?

tender shard
#

they got it back, now that they kicked you out

tender shard
slim wigeon
#
                    ItemStack item = player.getInventory().getItemInMainHand();
                    ItemStack itemOff = player.getInventory().getItemInOffHand();
                    
                    if( item != null && compass.isItemValid(item) ) {
                        if( compass.isLodestone(item) ) { location = compass.getLocation(item); }
                        player.spigot().sendMessage(ChatMessageType.ACTION_BAR, TextComponent.fromLegacyText(String.join(" ", Arrays.asList(
                            ChatColor.AQUA+"[Tracking Compass]",
                            ChatColor.GRAY+"World: " + ChatColor.WHITE + location.getWorld().getEnvironment(),
                            ChatColor.GRAY+"X: " + ChatColor.WHITE + ((int) location.getX()),
                            ChatColor.GRAY+"Y: " + ChatColor.WHITE + ((int) location.getY()),
                            ChatColor.GRAY+"Z: " + ChatColor.WHITE + ((int) location.getZ())
                        )) ));
                    }```
tender shard
#

also what's the purpose in "setting in it, then getting it"? If yu set the location, why would you need to get it again?

tender shard
#

which one is line 48?

slim wigeon
#

getEnvironment()

tender shard
#

you mean the one where you output ChatColor.GRAY + "World" ?

slim wigeon
#

Yes

tender shard
#

as I said, "location" is null

#

what even is "compass"?

#

I don't see you declaring it anywhere

remote swallow
#

why did they turn it off at 7 am tho

#

i dont get that

tender shard
#

epic, get over it. you made no backups off the VPS you got for free for 4 weeks

remote swallow
#

i think it was the free credits i got

slim wigeon
#

Its declared, just not in view due to being at top of the main under onEnable

tender shard
#

yes, oracle is confusing

tender shard
#

but I cannot see it

#

so I cannot help you

remote swallow
#

ill set it up again later today or tomorrow

tender shard
#

unless you show it

remote swallow
#

most likely on 2 instances bc thats what they give

#

maybe ill manage to not fuckup perms this time

tender shard
#

why don't you just pay like 5โ‚ฌ per month for a proper VPS

remote swallow
#

i dont have the money to spend on it

tender shard
#

yeah well ok

#

anyway, you now learnt your lesson. You need backups. all the time

remote swallow
slim wigeon
#

Well, lets say this. When I get the item using compass.getItem(), the compass works with the cords display and no errors. But soon as I run compass.setLocation(item), the display stops showing and my current log file floods

slim wigeon
tender shard
#

a) that's why you do it automatically
b) a terabyte is much
c) if you cannot handle to do backups, and cannot even pay 5โ‚ฌ per month for a proper VPS, then you just are not able to host a VPS. maybe go work a bit in your free time. sorry, but what am I supposed to say?

#

only love is free ๐Ÿฅฒ

remote swallow
#

how would i automate local host backups tho, also too young to work, i could pay for a vps for a while i just have to get the cash onto my card

tender shard
# slim wigeon Well, lets say this. When I get the item using compass.getItem(), the compass wo...

no, sorry but I'm tired of helping you. your "location" is cleary null. you haven't managed to tell me what "compass" is, although I asked that twice. it also took me three attempts for me to ask before you sent the original stack trace. I don't have time to ask thousand questions all the time. If I ask you "show code" or "send stacktrace", you should immediately send that, or not expect help from me. maybe someone else can help you, I hope you got a splendid day nonetheless โœจ

#

okay last chance, send your WHOLE main class now

#

?paste

undone axleBOT
sullen marlin
#

โœจ

tender shard
#

but yeah I know, backups are annoying

slim wigeon
tender shard
#

you just gotta set it up once and then you're fine, rsync, borg, rsnapshot, there's many ways

tender shard
tender shard
remote swallow
#

is it possible to like have 2 "instances" but access them and use them like its 1, im guessing its like 2 vms

tender shard
#

I only see that you access "compass.getLocation()" but I never see you declaring any location - you just create a new "TrackingCOmpass", that's it

slim wigeon
topaz atlas
#
    public void blockBreak(BlockBreakEvent event)  {
        if (event.getBlock().getState() instanceof Sign) {
            Sign sign = (Sign)event.getBlock().getState();
            if (sign.getLine(0).equalsIgnoreCase(ChatColor.DARK_BLUE +"[Player2]") || sign.getLine(0).equalsIgnoreCase(ChatColor.DARK_BLUE +"[Player1]")){
                try {
                    TimeUnit.SECONDS.sleep(1);
                } catch (InterruptedException e) {
                    // TODO Auto-generated catch block
                    e.printStackTrace();
                }
                Block block = event.getBlock();
                block.setType(Material.OAK_SIGN);
                //((Sign) block.getState()).setLine(0, ChatColor.RED + "LOCKED");
                block.getState().update();
                event.setCancelled(true);
            }
        }
    }```

Since sign change event does not work for server created signs, how can I change the text for the newly created sign?
tender shard
#

so it's ofc null

#

what did you expect the location to be?

remote swallow
#

how can i get the 0xAA0000 from this for example

wet breach
tender shard
tender shard
#

sorry but what is that

#
        if( Arrays.asList(Action.RIGHT_CLICK_AIR,Action.RIGHT_CLICK_BLOCK).contains(event.getAction()) && compass.isItemValid(item) ) {
            compass.setLocation(item, player.getLocation());
        }
    }
#

why are you creating a new list in every PlayerInteractEvent?

remote swallow
tender shard
#

yeah anyway, are you sure that it ever gets called?

#

does compass.isItemValid(item) ever return true?

tender shard
slim wigeon
#

Its being called, I know. Like I said, on calling compass.setLocation(). Display stops showing and log file get flooded

tender shard
#

how do you know it gets called?

remote swallow
#

the ChatColor class is bungee, the Color class in that is java.awt

tender shard
#

otherwise it wouldn't be possible that it's null

#

it's also cleary obvious

#

is not the same "compass" that you instantiated in your other class

#

it's two different TrackingCompasses

tender shard
slim wigeon
#

I don't know if I can upload videos to this channel

tender shard
#

you can if you get verified

#

!verify

undone axleBOT
#

Usage: !verify <forums username>

tender shard
#

it only takes like 20 seconds

remote swallow
tender shard
#

ok lemme see

#

ok since every bungee chatcolor has an awt toColor() mnethod, I'll only look at that

#

gimme a sec

#
String hex = String.format("#%02x%02x%02x", r, g, b);  
#

this shuold work fine

#

r, g,b is obviously the color's getR() etc

#

another, maybe fancier solution would to bitmask, or hwever it's called, it:

String hex = Integer.toHexString(color.getRGB() & 0xffffff);
#

doesn't matter whether the 0xffffff constant is left or right, btw

#

could also throw that into String.format("%6x" or sth btw

tender shard
slim wigeon
#

Lightning Strikes public void setLocation(ItemStack item, Location location) { CompassMeta meta = (CompassMeta) item.getItemMeta(); meta.setLodestoneTracked(true); meta.setLodestone(location); item.setItemMeta(meta); location.getWorld().strikeLightning(location); }

#

Its being called

tender shard
#

wait, I can try to break it down a bit, but that requires you to already know a bit of things I doubt you already know

tender shard
#

wait, lemme do it the other way around. I will try to give you an example, then maybe we can break it down t o10 minutes

slim wigeon
#

What you mean? I made the plugins[01:43:33] [Server thread/INFO]: Plugins (6): MGN-FarmRod, MGN-PortableChests, MGN-Hammer, MGN-TimberAxe, MGN-Staging, MGN-Excavator

tender shard
#

Please listen for 5 minutes

#

Imagine you have the following class:

public class Person {
    
    public String name;
    
    public Person(String name) {
        this.name = name;
    }
    
}

#

Now, you can always do new Person("mfnalex") to create a new person, that you probably already now, right?

slim wigeon
#

I know, its like a Object

wet breach
remote swallow
#

already answered lol

#

managed to do it with string.format and Color#getRed/Blue/Green

tender shard
#

now imagine you have a class called "MyFirstClass" and you do this:

public class MyFirstClass {
    
    private Person mfnalex = new Person("mfnalex");
}

you created a new Person there, his name is "mfnalex".

Now, you create a second clas, called "MyOtherClass":

public class MyOtherClass {
    private Person mfnalex = new Person("mfnalex");
}

the "mfnalex" in MyOtherClass is a TOTALLY different person from the one you created in MyFistClass - do you undertsand this, and do you understand why this is the case?

#

ofc both have the "field name" mfnalex, and both the parameter "mfnalex" passed, but it's still two different objects - as you can see, it's also a "new" Person, hence the keywoard "new"

#

do you understand so far?

wet breach
remote swallow
#

wat

wet breach
#

it converts 32bit colors to 8bit colors

wet breach
slim wigeon
#

Wait, the location is not being set on the compass in game

tender shard
#
Person mfnalex1 = new Person("mfnalex");
Person frostalf = new Person("frostalf");
mfnalex1.kill();
// Frostalf is still alive
#

Do you understand this?

#

I mean, yo uhaven't really answered my question before

#

which is actually much more important

wet breach
tender shard
#

that's too much for them rn

#

gotta start with the basics

wet breach
#

lol

tender shard
#

I'm not making fun of them, everyone started one day lol

slim wigeon
#

I do, I been programming since 2010. I still can detect what is in the DataContainer class due to ItemMeta

wet breach
tender shard
#

I have tried to break things down for you, and asked you simple questions, you have not replied to any of them

#

you are on your own now - or at least, without me

#

I have spent like 20 minutes of my time to try to explain it to you, but you struggle to answer basic questions

#

I will block you now and wish you a nice day

#

oh and

#

?learnjava

undone axleBOT
tender shard
#

I really dislike blocking people here but if you don't even answr my questions like "did you understand this", then I just cannot help

#

it seems like you have not understand basic principles about OOP yet, just read one of the tutorials listed above

topaz atlas
raven warren
#

The ShapedRecipe#setIngredient method requires a shape to be already set, because it checks for the validity of the key.
This is currently not part of the javadocs of that class.
Where do i suggest that it should be added or should i just add it myself and make a pull request?
(Ping me in reply)

slim wigeon
#

@tender shard You might not see this message but I wanted to tell you that setting setLodestoneTracked(false) from setLodestoneTracked(true) has worked. Same setup

tender shard
#

?jira

undone axleBOT
tender shard
#

if you wanna it yourself:

#

?stash

undone axleBOT
tender shard
#

?contribute

topaz atlas
#

Anyone avalible to help?

#

im asking to ask because i dont want to repost a bunch of times as its annoying and redundant

tender shard
#

yes but

#

?ask

undone axleBOT
#

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

tender shard
#

that is where did you call that method on?

#

on one random object, that the other class has no clue about

#

the principle is the same, though

topaz atlas
#

I gave my reason lol

#

anyways

#

ima come back later

worn tundra
#

An ass reason

topaz atlas
#

ima come back later anyways

slim wigeon
#

Well, its working now. And I know about that. If I be doing other stuff that does not involve ItemMetas like config objects, they be stored in the Main class and that will be accessed from any class. Like this line in my FarmRod source code ```public class Main extends JavaPlugin {
public List<FarmRod> farms = new ArrayList<FarmRod>(); public DataManager data;

public void onEnable(){
    // Commands
    //getCommand("test").setExecutor(new CommandTest());
    new CommandManager("farmRod",Arrays.asList(
        new CommandCrops(), new CommandAnimals()
    ));```
tender shard
#

that's fine, but you also haven't read any of the java tutorials I sent you

#

and that's not so good

#

that's like trying to fly a plane without having understood how a plane works

#

you will be able to steer around a bit with an already flying plane, but you won't be able to even start the engines, nor will you ever be able to land one safely, unless you go through hours of reading

#

I'm a bit tired of trying to help people who just want an easy solution, without knowing the basics. It cannot work

#

the issue you have is obvious and I explained it to your many times, but you don't get it. But you also refuse to try to understand it and well then all we gotta is wait until you're a bit more desperate. If you're desperate enough, you'll learn the basics, then once you tried, feel free to hmu again

slim wigeon
#

Well, setting setLodestoneTracked to false fixed my issue. You might be new to that method but if someone would tell me it needs to be false. I do know what you mean about planes, I learned all my programming from YouTube and Google. HTML, CSS, JavaScript, Jade/Pug, Less and all that I learned in the 10+ years

undone axleBOT
slim wigeon
#

No, its not. Just me trying to replace my minimap mod to a waypoint plugin system

tender shard
topaz atlas
#

in one sentence

slim wigeon
#

Yes, that is what I making. I don't need you to make or redirect any plugin. Yes, I talking about that plugin. My brother had the mod installed and it was slowing his computer down. Also, he would disappear from my minimap sometimes

topaz atlas
slim wigeon
#

I don't need help with the mod, this server is only for spigot plugins as you know

topaz atlas
slim wigeon
#

Well, I know what to do. I don't know what is with that person but lets say he did not tell me what method to use and tell me its my class when I know its not

topaz atlas
#

maybe someone else will help you in the meantime

slim wigeon
#

The issue is resolved

topaz atlas
#

ill try and hopefully remember to get back to you

topaz atlas
slim wigeon
topaz atlas
#
    public void blockBreak(BlockBreakEvent event)  {
        if (event.getBlock().getState() instanceof Sign) {
            Sign sign = (Sign)event.getBlock().getState();
            if (sign.getLine(0).equalsIgnoreCase(ChatColor.DARK_BLUE +"[Player2]") || sign.getLine(0).equalsIgnoreCase(ChatColor.DARK_BLUE +"[Player1]")){
                try {
                    TimeUnit.SECONDS.sleep(1);
                } catch (InterruptedException e) {
                    // TODO Auto-generated catch block
                    e.printStackTrace();
                }
                Block block = event.getBlock();
                block.setType(Material.OAK_SIGN);
                //((Sign) block.getState()).setLine(0, ChatColor.RED + "LOCKED");
                block.getState().update();
                event.setCancelled(true);
            }
        }
    }```
The sign text is not changed when its recreated, its whatever the text was when you broke it
#

and no, the sign changed event wont work because it takes a really specific input

#

How do I get a sign at that position?

#

Oh, i think i know why

#

it gets the block data from the previous sign when it was deleted

#

but how do I get the updated sign?

#

i tried find block at position

#

I was told to do that by someone here, it for some reason recreates the sign when its deleted, i mean its a keystone for the code to work

#

^ here

#

Isnt that a item? im talking about it placing a block at that position

#

the position the sign was deleted

#

that part works, but the text change acts weird

topaz atlas
#

I ran the block.update

#

But how do i get the updated one

somber night
#

i have 2 issues i havent been able to solve, furnace recipes wont work, not sure why (line 740) and unable to disable recipes for items with specific namespaced keys (line 705)
https://paste.md-5.net/abumotasak.cs

#

any information on why that might be can help

#

new to this, i know its very messy

small timber
#

https://paste.md-5.net/igeqofokop.cs

I have a problem. I have a method which saves some data to a yaml file, and when I sout the data, config.getString, or send the message to the player of the data, it sends the correct data, but in the yml file, it is written as ''

#

what can be the cause of this?

topaz atlas
#

Idk

#

That's why I asked

small timber
wet breach
#

after your done with your changes

#

should fix your problem

small timber
#

of course

#

my bad

crisp mountain
#
class org.bukkit.craftbukkit.v1_19_R3.block.CraftChest cannot be cast to class org.bukkit.block.DoubleChest 
#
public class DeathEvent implements Listener {
    @EventHandler
    public void onPlayerDeath(PlayerDeathEvent event) {
        Player player = event.getEntity().getPlayer();

        Location blockLocation = new Location(player.getWorld(), player.getLocation().getX(), player.getLocation().getY(), player.getLocation().getZ());
        Location blockLocation2 = new Location(player.getWorld(), player.getLocation().getX() + 1, player.getLocation().getY(), player.getLocation().getZ());

        Block block = blockLocation.getBlock();
        Block block2 = blockLocation2.getBlock();

        block.setType(Material.CHEST);
        block2.setType(Material.CHEST);

        Chest chest = (Chest) block.getState();
        DoubleChest doubleChest = (DoubleChest) chest.getInventory().getHolder();

        org.bukkit.block.data.type.Chest blockData = (org.bukkit.block.data.type.Chest) block.getBlockData();
        org.bukkit.block.data.type.Chest blockData2 = (org.bukkit.block.data.type.Chest) block.getBlockData();

        blockData.setType(org.bukkit.block.data.type.Chest.Type.LEFT);
        blockData.setFacing(BlockFace.NORTH);

        blockData2.setType(org.bukkit.block.data.type.Chest.Type.RIGHT);
        blockData2.setFacing(BlockFace.NORTH);

        block.setBlockData(blockData);
        block2.setBlockData(blockData2);


        List<ItemStack> inventory = event.getDrops();
        ItemStack[] inventory2 = inventory.toArray(new ItemStack[0]);

        doubleChest.getInventory().addItem(inventory2);

        event.getDrops().clear();
    }
}
#
import org.bukkit.block.Chest;
import org.bukkit.block.DoubleChest;
wet breach
fierce whale
#

How can I use ItemCrack particle?

#

idk what object to put in data argument

crisp mountain
#

I'm trying to put the item drops on the double chest because if I only use Chest some of the items will be gone

wet breach
#

that doesn't explain the unnecessary casts

crisp mountain
#

which parts are not required

wet breach
#

pretty much all of it

crisp mountain
#

I only got the problem when I tried to cast Chest to DoubleChest

#

(org.bukkit.block.data.type.Chest) these are necessary

#

since they are from different chest classes

wet breach
#

You can't just cast the Chest instance to a doublechest if it isn't a double chest to begin with

crisp mountain
#

oh wait, I'll try to cast after it becomes a doublechest

wet breach
#

but, if it is a double chest to begin with, then start with doublechest

crisp mountain
#

it works now

fluid river
#

jree

fierce whale
#

Is there a way to spawn ITEMCRACK particle? I don't know how to set material of particle

fluid river
#

packets ig

#

or maybe smth like

fierce whale
#

Nms?

fluid river
#

Particle p = Particle.ITEM_CRACK;
p.getDataType().something();

#

and then spawn it

#

i did it with packets

#

ages ago

fierce whale
#

Wow how can I learn nms

fluid river
#

idk how it goes now

fierce whale
#

Its challenging

fluid river
#

?nms

fierce whale
#

Thx let me check ๐Ÿซก

fluid river
fierce whale
#

Okay let me try

#

Yeah I heard nms can make me so painful lol

small timber
#

what is the alternative for itemMeta.setDisplayName as it's deprecated

brave sparrow
#

Youโ€™re probably using paper, so you should ask them

small timber
#

oh fine

#

is using deprecated methods a massive problem?

brave sparrow
#

Nope

quiet ice
#

If you intend for it to work on spigot - they contrary

#

Using the non-deprecated alternative would be a massive problem then

#

Though at that point you should be asking yourself what you are doing with the paper api

fluid river
#

cuz it's not in Spigot

small timber
#

thanks

#

and also, how can I check if the event.getClickedInventory() is the inventory I want? like a custom gui?

#

because getTitle doesnt exist anymore

brave sparrow
#

Important to note that if you make that change your plugin will no longer be compatible with spigot servers

fluid river
#

or inv view

#

or use the spigot resource

small timber
#

nvm I think I know

fluid river
#

Inv#getView()

#

bruh

#

hey guys

#

i once tried to make a lib for location maths

#

what can i actually add to it

#

for example i have a flatDistance method, which basically returns distance between two locations ignoring Y difference

#

can there be like any use to this shit

#

if not then what can i add instead

#

also should that be a Location wrapper class or a static util class or a class which extends Location

topaz atlas
#
    public void blockBreak(BlockBreakEvent event)  {
        if (event.getBlock().getState() instanceof Sign) {
            Sign sign = (Sign)event.getBlock().getState();
            if (sign.getLine(0).equalsIgnoreCase(ChatColor.DARK_BLUE +"[Player2]") || sign.getLine(0).equalsIgnoreCase(ChatColor.DARK_BLUE +"[Player1]")){
                try {
                    TimeUnit.SECONDS.sleep(1);
                } catch (InterruptedException e) {
                    // TODO Auto-generated catch block
                    e.printStackTrace();
                }
                Block block = event.getBlock();
                block.setType(Material.OAK_SIGN);
                //((Sign) block.getState()).setLine(0, ChatColor.RED + "LOCKED");
                block.getState().update();
                event.setCancelled(true);
            }
        }
    }

The sign text is not changed when its recreated, its whatever the text was when you broke it

Sorry for posting this here so much, if i should stop for awhile i can

fluid river
#

why do you use sleep

topaz atlas
#

i tried with and without it

#

still have the issue

fluid river
#

just erase it

#

try to cancel the event and run a task of state updating

#

after that

topaz atlas
fluid river
#

try catch block

topaz atlas
# fluid river try catch block

I'd have to erase the sleep thing too, I know it runs even with sleep because I had a debug log after sleep and tried it, and it worjed

fluid river
#
@EventHandler
public void onBreak(BlockBreakEvent event) {
    Block block = event.getBlock();
    if (!(block.getState() instanceof Sign sign)) return;
    if (!sign.getLine(0).matches("text1|text2")) return;
    event.setCancelled(true);
    Bukkit.getScheduler().runTask(instancePointer, () -> {
        block.setType(Material.OAK_SIGN);
        // sign = (Sign) block.getState(); i don't know if this line is actually needed
        sign.setLine(0, "text");
        // sign.update(); and this one too
    }, 1L);
}```
fluid river
#

?

topaz atlas
#

ima try it

topaz atlas
fluid river
#

your main class(extends JavaPlugin) instance

topaz atlas
fluid river
#

the one which extends JavaPlugin

#

i told ya

#

if you code everything in one class

#

then just use this keyword

topaz atlas
fluid river
#

yeah

#

or at least singleton ๐Ÿ’ฉ

topaz atlas
#

even though the events are run in the event class

fluid river
#

free java lessons

topaz atlas
#

whats the type for a this

#

"Plugin this"

fluid river
#

?

topaz atlas
#

as a argument for DI

fluid river
#

i don't rlly understand what you mean

#

can you show or stream

#

this always returns instance it's connected to(called in)

topaz atlas
#

What would the third argument look like

#

for DI

fluid river
#

YourMainClassName randomVariableName

#

this.instance = randomVariableName;

#

i hate how this looks omg

#

yup

fluid river
topaz atlas
#

wdym ik di

fluid river
#

and pls never call sleep on bukkit's main thread

topaz atlas
#

Read the chat

fluid river
#

well, asking for the type of variable is kinda sussy

topaz atlas
fluid river
#

and making variable name a keyword also sucks

topaz atlas
#

Well im no expert in java, actually, im a beginner

fluid river
#
public SignEvents(YourMainClass inst) {
    this.inst = inst;
    this.config = inst.getConfig();
    this.logger = inst.getServer().getLogger();
}```
topaz atlas
#

Ok

#
            block.setType(Material.OAK_SIGN);
            sign = (Sign) block.getState();```
fluid river
#

and you actually don't know parameter passing

topaz atlas
#

this.instance.plugin ?

fluid river
#

just this.instance

topaz atlas
fluid river
#

there is no .plugin field bruh

fluid river
#

i guess i messed up order of params

#

?jd-s

undone axleBOT
fluid river
#

coding from memory

#

oh

#

you don't need 1L in the end

#

i'm dumb

#

i used runTask and not runTaskLater

#

i'm a ๐Ÿ’ฉ sometimes

#

free "how to forget spigot" lessons

#

zacken you want some

#

sheit

#

@topaz atlas is it wokin' now

topaz atlas
# fluid river <@609490386238308352> is it wokin' now
[ERROR] /C:/Users/(censored)/eclipse-workspace/onutillities/src/main/java/com/onutillities/Main.java:[19,40] constructor SignEvents in class com.onutillities.SignEvents cannot be applied to given types;
[ERROR]   required: org.bukkit.configuration.file.FileConfiguration,org.bukkit.plugin.PluginLogger,com.onutillities.Main
[ERROR]   found:    org.bukkit.configuration.file.FileConfiguration,org.bukkit.plugin.PluginLogger
[ERROR]   reason: actual and formal argument lists differ in length```
#

I cant compile

#

due to a error

fluid river
#

call me

#

and stream

#

you probably have errors in ide which you don't look at ig

topaz atlas
#

general 1

fluid river
#

you cant stream here tho

topaz atlas
topaz atlas
fluid river
#

can you explain better

#

you want player to stop dropping his items with Q?

velvet pine
#

hi guys i am new

Location pos1 = new Location(Bukkit.getWorld("world"), 154, 95, 84);
Location pos2 = new Location(Bukkit.getWorld("world"), 152, 95, 86);

World world = pos1.getWorld();
Collection<Entity> entities = world.getNearbyEntities(pos2, pos2.getX() - pos1.getX()-1, pos2.getY() - pos1.getY()+0.5, pos2.getZ() - pos1.getZ());

I need to get all the entities present between these coordinates, (the function is located a repetitive task) the method I used doesn't work very well in fact I had to fix it myself, how do I do it?

mossy marlin
#

anyone have an idea to hide 'Inventaire' txt with texture pack

currently i have set this texture on my menu

#

{
    "providers": [
        {
            "type": "ttf",
            "file": "minecraft:negative_spaces.ttf",
            "shift": [0.0, 0.0],
            "size":10.0,
            "oversample":1.0
        },
        {
            "type": "bitmap",
            "file": "minecraft:font/menu.png",
            "ascent" : 13,
            "height" : 221,
            "chars": [
                "\ue300"
            ]
        }
    ]
}

it's my font to add my menu

velvet pine
fluid river
#
BoundingBox box = new BoundingBox(loc1, loc2);```
eternal oxide
fluid river
#
List<Entity> entitiesInBox = world.getNearbyEntities(box);```
eternal oxide
#

Thats more a cuboid than between two points

fluid river
#

he said between two coordinates

eternal oxide
#

I assumed he wanted more of a ray

fluid river
#

they are really between in every way

eternal oxide
#

than a defined AABB

fluid river
#

๐Ÿ™‚

topaz atlas
#

@fluid river if I shouldnt use sleep in my code, how else can I have a delay?

eternal oxide
#

is an entity 100 blocks above the lower point really "between" A and B?

fluid river
#

Bukkit.getScheduler()#runTask(javaPluginInstance, () -> {})/runTaskLater(javaPluginInstance, () -> {}, delayInTicks)/runTaskTimer(javaPluginInstance, () -> {}, delayInTicks, repeatEachXTicks);

topaz atlas
fluid river
#

you had a TimeUnit.SECONDS.sleep()

#

that's not a bukkit timer

velvet pine
fluid river
#

that's just java stuff

topaz atlas
#

?

fluid river
topaz atlas
#

The method runTask(Plugin, Runnable) in the type BukkitScheduler is not applicable for the arguments (Main, Runnable, int

fluid river
eternal oxide
fluid river
#

there is a runTaskTimer method()

fluid river
#
BoundingBox box = new BoudingBox(loc1.getX(), loc1.getY(), loc1.getZ(), loc2.getX(), loc2.getY(), loc2.getZ());
List<Entity> entitiesInBox = loc1.getWorld().getNearbyEntities(box);```
topaz atlas
fluid river
#

yes, for delaying tasks on more than 1 tick

#

cuz runTask delays on 1 tick afair

#

runTaskTimer is repeating the same piece of code each X ticks until you explicitly define a stop clause

#

and has initial delay(delay before code is executed first time and the timer actually starts repeating)

velvet pine
fluid river
#

oh

#

there was an of method

#

i'm extra dumb today

#

sorry

#

you probably don't need to use Collection

#

Set or List implementations would be alright

velvet pine
# fluid river sorry

However, you have been very helpful; I don't think I would have found this solution on my own.

fluid river
#

you can also add a filter to that method and use Stream.map() after all operations

fluid river
#

you just type ?jd-s

#

and search for interesting things

#

all sollutions are there

fluid river
#

@eternal oxide are you free rn

fluid river
#

i need an advice

eternal oxide
somber night
#

is there a way to make a custom furnace recipe only work if an item has a specific namespaced key? as well as disable one?

fluid river
velvet pine
#

sorry for the ping, but it still doesn't go as it should, the rectangle is always shifted a bit and doesn't get the area well, this is the picture of the area:

I have to get the corners and get all the players inside, if they are there teleport them if not return

#

@fluid river

fluid river
#

your loc1 and loc2 might be set wrong ig

#

can you describe what you actually trying to achieve

#

and attach some code

velvet pine
#
Location pos1 = new Location(Bukkit.getWorld("world"), 154, 95+0.5, 84);

Location pos2 = new Location(Bukkit.getWorld("world"), 152, 95+0.5, 86);

World world = pos1.getWorld();
BoundingBox box = BoundingBox.of(pos1, pos2);
Collection<Entity> entities = world.getNearbyEntities(box);

if (entities.isEmpty()) {
  return;
}

for (Entity entity : entities) {
  if (!(entity.getType()).equals(EntityType.PLAYER)) {
      continue;
}
eternal oxide
#

.700?

#

0.0 is one corner of a block, 0.5 is middle and 0.9 is the other side.

velvet pine
#

I saw that it wasn't working and wanted to try specifying as much as possible but to no avail

#

oh i'm sorry, i paste the worng code

fluid river
#

where are next lines

#

after continue;

velvet pine
eternal oxide
#

you are moving all entities -3 blocks from where they already are on the Z axis

velvet pine
eternal oxide
#

what exactly are you trying to do? I can see you are finding all entities in an area (2 blocks)

velvet pine
#

rectangle selection is always moved 1 block further to the right or left and I don't understand why

eternal oxide
#

your selected area (BoundingBox) is a 2x2

#

your screenshot inside that box is a 3x3

velvet pine
#

is it possible? i took the positions of the corners

eternal oxide
#
Location pos1 = new Location(Bukkit.getWorld("world"), 154, 95+0.5, 84);

Location pos2 = new Location(Bukkit.getWorld("world"), 152, 95+0.5, 86);```
#

2x2

#

you also don;t want to be adding 0.5 to y

velvet pine
#

then I guess I didn't understand its operation,

I took the coordianates of the corners should take the whole 3x3

eternal oxide
#
Location pos1 = new Location(Bukkit.getWorld("world"), 152, 95, 84);

Location pos2 = new Location(Bukkit.getWorld("world"), 154.9, 95.9, 86.9);```
velvet pine
#

Specifically, the corners of the 3x3 black

eternal oxide
#

remember that 154 is the very corner. Doesn't cover the block

velvet pine
eternal oxide
#

each location is the corner of a Block. it doesn;t cover teh blocks entire surface

#

so 152 to 154 is actually 2 blocks + 1 pixel

#

152 to 154.9 is 3 blocks

#

or close enough

velvet pine
#

then 152 is just the angle, why didn't you add the .9?

eternal oxide
#

the small value shoudl be small, no adjustment

#

the larger value you add 0.9

velvet pine
#

in other words, pos1 does not need adjustment, pos2 does

eternal oxide
#

yes, pos2 should represent the far right of a block. pos1 represents the far left

flint coyote
#

Why does Bukkit.getOnlinePlayers() return a Collection<? extends Player> and not Collection<Player>? Are there any classes extending Player I should be aware of?

velvet pine
#

Okay, thank you, really helpful

topaz atlas
#

?paste

undone axleBOT
topaz atlas
topaz atlas
flint coyote
#

I see

topaz atlas
#

@fluid river Are you avalible?

fluid river
#

probably

eternal oxide
#

you will find your String comparison is failing

topaz atlas
#

No errors

#

it just isnt changing the sign

eternal oxide
#

do you get teh message "You are now going to fight" ?

eternal oxide
#

you get it when player 2 clicks?

topaz atlas
#

ooh

#

IM DUMB

eternal oxide
#

You are improving, 2 days ago you were even worse ๐Ÿ˜›

topaz atlas
#

CHILL

#

jesus

#

Im used to other languages

#

which is even worse than just starting out

#

why is java like this

eternal oxide
#

Java is love

topaz atlas
# eternal oxide Java is love
            Sign newSign = (Sign) block.getState();
            newSign.setLine(0, ChatColor.RED + "[Locked]");
             newSign.update();```
How do I set the signs orintation to be what it was before it was destroied
#

Wait ima send the whole function

#
    public void onBreak(BlockBreakEvent event) {
        Block block = event.getBlock();
        if (!(block.getState() instanceof Sign sign)) return;
        if (!sign.getLine(0).equalsIgnoreCase(ChatColor.DARK_BLUE + "[Player1 Click]") && !sign.getLine(0).equalsIgnoreCase(ChatColor.DARK_BLUE + "[Player2 Click]")) return;
        event.setCancelled(true);
        Bukkit.getScheduler().runTaskLater(this.instance, () -> {
            block.setType(Material.OAK_SIGN);
            Sign newSign = (Sign) block.getState();
            newSign.setLine(0, ChatColor.RED + "[Locked]");
             newSign.update();
        }, 2);
        Bukkit.getScheduler().runTaskLater(this.instance, () -> {
            Sign newSign = (Sign) block.getState();
            newSign.setLine(0, ChatColor.DARK_BLUE + "[Player1 Click]");
             newSign.update();
        }, 64);
     }```
slate mortar
#

any ideas what could cause this on plugin messages? (the prefix/suffix character, no idea what that is, but causes issues)

#

appears on nearly all messages

eternal oxide
#

its either rotatable or Directional

#

see which works

night verge
#

I'm making custom recipes but it didn't work.
What's wrong with my code?

#

This is a part of it.

            ItemStack board = Items.boards("board");
            int boards_count = 0;
            int boards_count2 = 0;
            List<ItemStack> props = new ArrayList<>();
            switch (x) {
                case 1:
                    props.add(new ItemStack(Material.BRICK));
                    break;
                case 2:
                    props.add(new ItemStack(Material.STICK));
                    break;
                case 3:
                    props.add(new ItemStack(Material.STONE_BUTTON));
                    props.add(new ItemStack(Material.POLISHED_BLACKSTONE_BUTTON));
                    break;
                case 4:
                    props.add(new ItemStack(Material.STONE_PICKAXE));
                    break;
            }
            for (ItemStack p : props) {
                for (int i = 0; i < 1; i++) {
                    for (int j = 0; j < 2; j++) {
                        if (i == j) {continue;}
                        ShapedRecipe boards_recipe = new ShapedRecipe(new NamespacedKey(plugin, Items.boards.get(x) + "-" + boards_count2 + "-" + boards_count), board);
                        String[] s = {"   ", "   ", "   "};
                        s[i / 3] = s[i / 3].substring(0, i % 3) + 'B' + s[i / 3].substring(i % 3 + 1);
                        s[j / 3] = s[j / 3].substring(0, j % 3) + 'P' + s[j / 3].substring(j % 3 + 1);
                        boards_recipe.shape(s[0], s[1], s[2]);
                        boards_recipe.setIngredient('B', new RecipeChoice.MaterialChoice.ExactChoice(board));
                        boards_recipe.setIngredient('P', new RecipeChoice.MaterialChoice.ExactChoice(p));
                        Bukkit.addRecipe(boards_recipe);
                        boards_count += 1;
                    }
                }
                boards_count2 += 1;
            }
        }
worn tundra
#

The recipe isn't added? Wrong result?

#

What

night verge
#

I put the material in the crafting table but nothing comes out.

night verge
worn tundra
#

?paste

undone axleBOT
worn tundra
#

Can you paste it here please

#

The whole class

#

preferably

eternal oxide
#

you current code props will only ever have one ItemStack in it

cinder abyss
#

Hello, I don't know why my code isn't working :
I want to implement 1.13-1.16 support to my generation code, but it doesn't generate any block :
https://paste.md-5.net/aginiziloy.java
GenNoteBlock :java public void GenNoteBlock(Block block, Instrument instrument, int octave, Note.Tone tone){ block.setType(Material.NOTE_BLOCK, false); try { NoteBlock nblock = (NoteBlock) block.getBlockData(); nblock.setInstrument(instrument); nblock.setNote(Note.flat(octave, tone)); block.setBlockData(nblock); getLogger().info(block.getX() + " " + block.getY() + " " + block.getZ()); } catch(ClassCastException err) { getLogger().info("Erreur de cast"); } }Registering :java event.getWorld().getPopulators().add(new OreGenLegacy(this, 1, 35, 10));

eternal oxide
#

stop spamming

cinder abyss
#

(I use for my coding spigot 1.19.4)

eternal oxide
#

?paste

undone axleBOT
worn tundra
cinder abyss
worn tundra
#

Are you sure the code runs?

cinder abyss
#

the code runs

#

but the generator doesn't work

worn tundra
night verge
cinder abyss
worn tundra
#

Could just put a few sysouts here and there between if checks & loops

worn tundra
#

(What you're trying to do)

night verge
worn tundra
#

What's a board?

night verge
# worn tundra What's a board?

Items.board is a List<String> including the names of the boards.
Items.board(int) is a function that returns an ItemStack of the board itself.

cinder abyss
night verge
#

And these items are something for further plugin functions.

worn tundra
#

So

#

Okay not sure I understand a 100 percent

#

But shouldn't you just be making this a shapeless recipe?

#

Since you're (I assume) making variations of the board

#

which can be mixed with a prop

#

to make another board

night verge
#

I am trying to a shapeless recipe, but I assume shapeless recipe doesn't accept custom items as the materials right?

cinder abyss
#

so it doesn't

eternal oxide
#

shapeless can take a custom ItemStack

worn tundra
#

Not sure if adding all possible permutations of the craft is a good idea
(it isn't)

worn tundra
#

Instead, listen to the craft event

#

and compare the items in the crafting grid to those required by your recipes

eternal oxide
#

I had not noticed that

worn tundra
#

Yup

eternal oxide
#

I'd try it though

worn tundra
#

Doesn't work

eternal oxide
#

Why would a ShapelessRecipe have an option to add a RecipeChoice if it can't use half of the options

worn tundra
#

For funsies

fluid finch
#

what's the oncursor item

worn tundra
#

When you click on an item in the inventory

fluid finch
#

and pickitt up with your mosue?

worn tundra
#

and you "hold" it in your cursor

#

yea

fluid finch
#

aight

night verge
#

Does shpedrecipe have an amount limitation?

worn tundra
#

No, but for your recipes to support all possible permutations

#

would take up

#

let's see

#

about 72 different recipes

#

to account for all possible shapes in a 3x3 grid

night verge
#

and there's 8 kinds of it for now.

tender shard
night verge
eternal oxide
#

yes

#

change to a shaped recipe so you can use ExactChoice

tender shard
#

pretty sure that for inputs, it always only uses 1 item

eternal oxide
#

it does, there is no method to set a quantity

#

other than multiple items of the same type

worn tundra
night verge
rotund ravine
#

Then you did it wrongly.

cobalt thorn
#
java.lang.SecurityException: Invalid signature file digest for Manifest main attributes
    at java.base/sun.security.util.SignatureFileVerifier.processImpl(SignatureFileVerifier.java:317)
    at java.base/sun.security.util.SignatureFileVerifier.process(SignatureFileVerifier.java:259)
    at java.base/java.util.jar.JarVerifier.processEntry(JarVerifier.java:321)
    at java.base/java.util.jar.JarVerifier.update(JarVerifier.java:234)
    at java.base/java.util.jar.JarFile.initializeVerifier(JarFile.java:767)
    at java.base/java.util.jar.JarFile.getInputStream(JarFile.java:852)
    at org.bukkit.plugin.java.JavaPluginLoader.getPluginDescription(JavaPluginLoader.java:153)
    at org.bukkit.plugin.SimplePluginManager.loadPlugins(SimplePluginManager.java:136)
    at org.bukkit.craftbukkit.v1_19_R1.CraftServer.loadPlugins(CraftServer.java:318)
    at net.minecraft.server.v1_19_R1.DedicatedServer.init(DedicatedServer.java:222)
    at net.minecraft.server.v1_19_R1.MinecraftServer.run(MinecraftServer.java:616)
    at java.base/java.lang.Thread.run(Thread.java:829)

Hi, im having this problem if i put my plugin

fluid river
#

??

cobalt thorn
fluid river
#

when does it happen

cobalt thorn
#

when i start the server

#

and then crash

#

nothing else

fluid river
#

is your plugin crashing

#

or the server itself

cobalt thorn
#

no the server

fluid river
#

so without your plugin server works fine?

cobalt thorn
quaint mantle
#

Can someone please help me?
Im trying to make a message when a player joines for the first time and the message should be in 3 lines, but the message is never getting send when a new player is joining the server

    public void OnJoin(PlayerJoinEvent e){

        Player player = e.getPlayer();
        if (player.hasPlayedBefore()) {
            e.setJoinMessage(ChatColor.DARK_GRAY + "[" + ChatColor.GREEN + "+" + ChatColor.DARK_GRAY + "] " + ChatColor.GRAY + player.getDisplayName());

        }else{
            e.setJoinMessage(ChatColor.DARK_GRAY + "[" + ChatColor.GREEN + "+" + ChatColor.DARK_GRAY + "] " + ChatColor.GRAY + player.getDisplayName());
            e.setJoinMessage(ChatColor.WHITE + "NY" + ChatColor.BLUE + "SPILLER");
            e.setJoinMessage(ChatColor.WHITE + "Velkommen" + ChatColor.BLUE + player.getDisplayName() + ChatColor.WHITE + "Du er nummer" + ChatColor.BLUE + "1" + ChatColor.WHITE + "Pรฅ serveren");
        }

    }```
cobalt thorn
fluid river
#

you are replacing the same message three times

#

you'd better set join message to null

#

and instead do Bukkit.broadcastMessage()

cobalt thorn
quaint mantle
fluid river
#

e.setJoinMessage(null);

cobalt thorn
fluid river
#

in your else {} block

cobalt thorn
#

and use Bukkit.broadcastMessage(...)

quaint mantle
#

And i should also replace setJoinMessage to Bukkit.broadcastMessage right?

fluid river
#

and then java Bukkit.broadcastMessage("ChatColor.DARK_GRAY + "[" + ChatColor.GREEN + "+" + ChatColor.DARK_GRAY + "] " + ChatColor.GRAY + player.getDisplayName()");

fluid river
#
if (player.hasPlayedBefore()) {
    e.setJoinMessage(ChatColor.DARK_GRAY + "[" + ChatColor.GREEN + "+" + ChatColor.DARK_GRAY + "] " + ChatColor.GRAY + player.getDisplayName());
} else {
    e.setJoinMessage(null);
    Bukkit.broadcastMessage("");
    Bukkit.broadcastMessage("");
    Bukkit.broadcastMessage("");
}```
quaint mantle
#

This is the else, is it right now?
}e.setJoinMessage(null);{

#

Oh okay, thanks

rotund ravine
fluid river
#

idk lol

#

but the guy just used setJoinMessage three times

#

that definitely doesn't work)

night verge
quaint mantle
fluid river
#

import it

#

?learnjava

undone axleBOT
quaint mantle
#

I know i need to import it but i dont know what i should import? i have tried to import org.bukkit.event.broadcastMessage;

desert tinsel
#

is there any way to remove all namespacedkeys from player's persistentcontainer that is from a specific plugin?

quaint mantle
eternal oxide
#

Eclipse? CTRL + SHIFT + O

quaint mantle
#

Thanks

quaint mantle
# fluid river ```java if (player.hasPlayedBefore()) { e.setJoinMessage(ChatColor.DARK_GRAY...

Im sorry for mentioning you
But its not working, when a player joines for the first time its not getting broadcasted
Code:

import org.bukkit.Bukkit;

    @EventHandler
    public void OnJoin(PlayerJoinEvent e){

        Player player = e.getPlayer();
        if (player.hasPlayedBefore()) {
            e.setJoinMessage(ChatColor.DARK_GRAY + "[" + ChatColor.GREEN + "+" + ChatColor.DARK_GRAY + "] " + ChatColor.GRAY + player.getDisplayName());


            if (player.hasPlayedBefore()) {
                e.setJoinMessage(ChatColor.DARK_GRAY + "[" + ChatColor.GREEN + "+" + ChatColor.DARK_GRAY + "] " + ChatColor.GRAY + player.getDisplayName());
            } else {
                e.setJoinMessage(null);
                Bukkit.broadcastMessage(ChatColor.DARK_GRAY + "[" + ChatColor.GREEN + "+" + ChatColor.DARK_GRAY + "] " + ChatColor.GRAY + player.getDisplayName());
                Bukkit.broadcastMessage(ChatColor.WHITE + "NY" + ChatColor.BLUE + "SPILLER");
                Bukkit.broadcastMessage(ChatColor.WHITE + "Velkommen" + ChatColor.BLUE + player.getDisplayName() + ChatColor.WHITE + "Du er nummer" + ChatColor.BLUE + "1" + ChatColor.WHITE + "Pรฅ serveren");
            }
        }

    }
rotund ravine
#

Dit else statement vil aldrig blive kรธrt fordi du tjekker om spilleren har spillet fรธr du tjekker igen.

#

Tjek dine scopes (brackets)

quaint mantle
#

Sry fatter det ikke helt, hvad er det jeg skal รฆndre ved else?

river oracle
#

Oh man good thing optic isn't on or you guys would be dead

rotund ravine
rotund ravine
undone axleBOT
regal scaffold
#

Anyone have the auto-upload sftp gradle script

rotund ravine
#

Smh

river oracle
#

No hablo Ingles que es reglas

eternal oxide
#

My typing often wouldn't qualify as English

river oracle
#

Ahg

cinder abyss
#

Hello, I want to store custom data in a block.
I made this, but it's not the correct syntax.
I followed the guide and I don't understand ๐Ÿคทโ€โ™‚๏ธ

PersistentDataContainer customBlockData = new CustomBlockData(block, this);
NamespacedKey key = new NamespacedKey(this, instrument + " " + octave + " " + tone);
customBlockData.set(key, PersistentDataType.STRING, Math.PI);```
remote swallow
#

you create the key, so "data", then asign the instrument + octave + tone to it on the string

cinder abyss
remote swallow
#

becuase math.pi is not a string

#

its a double

cinder abyss
#

thanks

#

now it's working

cinder abyss
# remote swallow becuase math.pi is not a string

I made thisjava PersistentDataContainer customBlockData = new CustomBlockData(block, this); NamespacedKey key = new NamespacedKey(this, "instrument"); customBlockData.set(key, PersistentDataType.STRING, instrument + " " + octave + " " + tone);

weak meteor
#

Hmm

#

im missing something

#

-.-

remote swallow
#

are those valid placeholders

regal scaffold
#

I made a class extend BukkitRunnable, what's the non-deprecated

cobalt thorn
#

How can i pass the onDisable to a method that requires PluginDisableEvent?

cobalt thorn
regal scaffold
#

I am aware of that

#

But if it requires a Comsumer<BukkitTask> how do I provide it a class

eternal oxide
#

use a lambda

regal scaffold
#

What if my runnable is too big

#

I thought it was better to make a class

cobalt thorn
regal scaffold
#

Oh

#

So instead of extends BukkitRunnable I implement BukkitTask?

cobalt thorn
#

and then it should ask to create a
@Override
public void run() {}

regal scaffold
#

Yes

#

I have that

#

I'm probably messing up in the new Task(mineType)

ivory sleet
#

either u implement Consumer<BukkitTask>

cobalt thorn
# regal scaffold Yes

then just do this on where you need it
ClassName class = new ClassName().runTaskTimer() or what you need

ivory sleet
#

or u extend what ZeroTwo said

regal scaffold
#

Ohhhh

#

Ok yeah

cobalt thorn
regal scaffold
#

Any preference ?

ivory sleet
#

BukkitRunnable

cobalt thorn
ivory sleet
#

imperatively gonna be more usable for u

#

async if its needed

regal scaffold
#

Alright cool

#

So BukkitRunnable and async

#

Thanks!

sterile token
#

Is posible to do placeholders which allow params let say, im trying to create them using Papi

#

At the momment none can explain what i really want

sterile token
#

Yes im using it, but i dont know how to create placeholders which require arguments

cobalt thorn
#

if you want i can give you a code that uses a parameter like %help_idk_Playerinpt%

sterile token
#

I want this

#

%user_{param}_info% - Which require a player name let say

cobalt thorn
#

oh ok let me grab it

ivory sleet
#

only async if needed

#

dont use async for the sake of async

sterile token
ivory sleet
#

thats gonna end up breaking shit

regal scaffold
#

Yes yes

#

I know

#

So if I need bukkit API calls

regal scaffold
#

I sync that section

ivory sleet
#

yes but problem is

#

async does not ever imply inherently better performance

sterile token
regal scaffold
#

Yup

ivory sleet
#

naa

regal scaffold
#

I've seen that happen

ivory sleet
#

naa

regal scaffold
#

Alright, thanks a lot

ivory sleet
#

u can await the result

#

in a blocking fashion

eternal night
sterile token
regal scaffold
#

๐ŸŒŒ

sterile token
#

I mean is there any await system simpler as Javascript one?

ivory sleet
#

but its quite the same as Promises in js

sterile token
cobalt thorn
# sterile token %user_{param}_info% - Which require a player name let say
       String[] strings = s.split("\\}_", 2);
        strings[0] = strings[0].substring(1);
        strings[1] = strings[1].substring(1, strings[1].length() - 1);
        String user = PlaceholderAPI.setPlaceholders(p, "%" + strings[0] + "%");
        OfflinePlayer player = user.contains("%") ? Bukkit.getOfflinePlayer(strings[0]) : Bukkit.getOfflinePlayer(user);
        String placeholder = PlaceholderAPI.setPlaceholders(player, "%" + strings[1] + "%");
        if (placeholder.startsWith("%") && placeholder.endsWith("%")) {
            placeholder = strings[1];
        }

        String Placeholder = PlaceholderAPI.setPlaceholders(player, placeholder);
        if(Placeholder.equals("gang_name")) {
            return "No Gang";
        }

        return Placeholder;

%bo_{ajlb_lb_gang_value_1_alltime_name}_{gang_name}%
This is what i made

sterile token
cobalt thorn
sterile token
#

Creating placeholders which require arguments, for them returning some data - exatly what u hv sent

sterile token
cobalt thorn
#

How can i pass the onDisable to a method that requires PluginDisableEvent? if someone knows the answer because im loosing my mind

ivory sleet
#

like java sdk

eternal oxide
sterile token
ivory sleet
#

na

#

sure its not that simple to get a robust design

mossy marlin
#

i repost my problem
i have that on my texture anyone have an idea to remove or hide it please ?

sterile token
#

yeah thats the thing, doesnt someone already created that? So you dont lost hours of shity java async and use plug-in thing to lost less time?

cobalt thorn
cobalt thorn
eternal oxide
#

Plugin disable event is an event which runs when a plugin gets disabled, you don;t call it from onDisable

eternal oxide
#

your logic goes in onDisable

mossy marlin
eternal oxide
#

which you can call from anywhere

cobalt thorn
ivory sleet
#

verano

#

generally java needs more work since its a bit less abstract than js

#

regarding os threads, mem modeling and stuff

mossy marlin
# cobalt thorn no only your custom gui, if you are using one

it does not come from the mistletoe itself I will not know how to explain it basically there is the inventory to create 54 slots and inside there is the name of the global inventory

and player inventory

but the title of this player inventory is not editable

mossy marlin
#

๐Ÿ˜ฎ thank you

#

in ALL minecraft languages T-T

cobalt thorn
sterile token
mossy marlin
cobalt thorn
#

I thought was for a gui, not for the player inventory

sterile token
#

Something similar to how JDA works, where the things are async just adding the .queue() at the end of the method let say

// For example
webhook.send().queue(); 

@ivory sleet

flint carbon
#

does anyone know the best resource for mysql/hikaricp?

sterile token
flint carbon
sterile token
#

Also mysql and hikariCP are different things, HikariCP is a database pooling thing

flint carbon
#

i know i mean to use them together

sterile token
#

oh right, i mention because most people refer them as the same thing

regal scaffold
#

Anyone here worked with massivecore

sterile token
regal scaffold
#

How can I make a gradle task run another task before but the previous task isn't explicitly added in build.gradle

zealous scroll
#

Does anyone know how to update a player's position internally using ProtocolLib? I'm currently sending a ENTITY_TELEPORT packet to all nearby players to indicate that my entity has moved, but I also want the server to reflect these changes. I can't use Bukkit's API because I'm doing it outside of a server's tick.

remote swallow
eternal oxide
#

if you are moving outside the tick the client and servers idea of where the entity is will always be out of sync

cinder abyss
#

Hello, when I use this method, I never get the text in the console (getLogger().info(block.getX() + " " + block.getY() + " " + block.getZ());)
Is there something wrong ?

public void GenNoteBlock(Block block, Instrument instrument, int octave, Note.Tone tone){
        block.setType(Material.NOTE_BLOCK, false);
        NoteBlock nblock = (NoteBlock) block.getBlockData();
        nblock.setInstrument(instrument);
        nblock.setNote(Note.flat(octave, tone));
        PersistentDataContainer customBlockData = new CustomBlockData(block, this);
        customBlockData.set(new NamespacedKey(this, "instrument"), PersistentDataType.STRING, instrument.toString());
        customBlockData.set(new NamespacedKey(this, "octave"), PersistentDataType.INTEGER, octave);
        customBlockData.set(new NamespacedKey(this, "tone"), PersistentDataType.STRING, tone.toString());
        block.setBlockData(nblock);
        getLogger().info(block.getX() + " " + block.getY() + " " + block.getZ());
}```
thin frost
#

Any way to flag so that a Minecart does not derail no matter angle/velocity?

zealous scroll
pseudo hazel
pseudo hazel
thin frost
pseudo hazel
#

I see

#

like it just derails at the turn?

#

im afraid there is nothing built-in that can help you

#

if you just boosted the minecart velocity, you are on your own as that is pretty much undefined behavior

thin frost
#

Yeah exactly, hence why I'm reaching out for help. Thanks though, then I have it confirmed!

pseudo hazel
#

okay

#

have you checked if the function rusn at all?

#

overworld_materials probably doesnt contain what you need

cinder abyss
pseudo hazel
#

oh

quaint mantle
#

How do i get the total of all joined player's?
I want to make so when a new player joines for the first times it says You are number (number of all joined player's) joined on this server

rigid otter
#

From what version, we get deobfucation?

pseudo hazel
#

maybe try Bukkit.getLogger instead?

cinder abyss
pseudo hazel
#

yes just type Bukkit.getLogger

cinder abyss
#

From interface: org.bukkit.plugin.Plugin

cinder abyss
#
customBlockData.set(new NamespacedKey(this, "instrument"), PersistentDataType.STRING, instrument.toString());
        customBlockData.set(new NamespacedKey(this, "octave"), PersistentDataType.INTEGER, octave);
        customBlockData.set(new NamespacedKey(this, "tone"), PersistentDataType.STRING, tone.toString());```
#

when I added this, my code stopped working (for the method)

#

0 errors

pseudo hazel
#

well that wouldnt prevent the text from logging I assume

cinder abyss
pseudo hazel
#

hmm weird

#

idk whats wrong sorry

cinder abyss
pseudo hazel
#

I assume the data also doesnt get set?

cinder abyss
#

because the method doesn't work

tender shard
pseudo hazel
#

also no warnings?

cinder abyss
#

no errors

cinder abyss
tender shard
#

btw, first of all "GenNoteBlock" is a bad method name. Second, when/where do you even call this method?

cinder abyss
#

the method doesn't work when I add java PersistentDataContainer customBlockData = new CustomBlockData(block, this); customBlockData.set(new NamespacedKey(this, "instrument"), PersistentDataType.STRING, instrument.toString()); customBlockData.set(new NamespacedKey(this, "octave"), PersistentDataType.INTEGER, octave); customBlockData.set(new NamespacedKey(this, "tone"), PersistentDataType.STRING, tone.toString());

tender shard
#

that can't be, unless you got some error that you ignored

cinder abyss
#

who is registered with this :java @EventHandler public void onWorldInit(WorldInitEvent event) { getLogger().info("World init"); event.getWorld().getPopulators().add(new OreGen(this, 1, 40, 15)); }

#

the problem come from GenNoteBlock

#

@tender shard

tender shard
#

paste your whole log please. I can't believe that you don't get any error message

cinder abyss
#

okay

tender shard
#

weird. you should get an IllegalStateException when calling getBlock() on the blockstate

tender shard
#

wdym

cinder abyss
#

but it doesn't work when I add the code

cinder abyss
tender shard
#

print out what it returns in the line directly before the one you use new CustomBlockData(...) in

cinder abyss
#

I added getLogger().info(String.valueOf(block));

#

I relaunch my internal server

lunar forge
#

are players potion effects saved during restarts?

cinder abyss
quaint mantle
cinder abyss
#

@tender shard

undone axleBOT
fluid river
#
String msg = "you are player " + Bukkit.getOfflinePlayers().length + " on this server.";```
#

what exactly is not working

#

what about .clone() if it's a copy hm?

#

freejavalessons

#

?jd-s

undone axleBOT
fluid river
#

good luck

#

lol

#

you just ?ask

#

wait 4 me

#

well there is no spigot course

#

1 day

#

this was 1.5.2 version

#

so api was quite easy

#

well less then a month

#

surely

cinder abyss
#

@tender shard java public void GenNoteBlock(Block block, Instrument instrument, int octave, Note.Tone tone){ block.setType(Material.NOTE_BLOCK, false); NoteBlock nblock = (NoteBlock) block.getBlockData(); nblock.setInstrument(instrument); nblock.setNote(Note.flat(octave, tone)); PersistentDataContainer customBlockData = new CustomBlockData(block, this); // Bug here customBlockData.set(new NamespacedKey(this, "instrument"), PersistentDataType.STRING, instrument.toString()); customBlockData.set(new NamespacedKey(this, "octave"), PersistentDataType.INTEGER, octave); customBlockData.set(new NamespacedKey(this, "tone"), PersistentDataType.STRING, tone.toString()); block.setBlockData(nblock); getLogger().info(block.getX() + " " + block.getY() + " " + block.getZ()); }

fluid river
#

depends

#

i mostly just throw big plugins

#

not cuz they are too hard

#

i'm just too lazy

#

if i'm under pressure i can code it in several days

fluid river
#

i mean

#

i can explain the api in like several sentences

#

in english you say