#help-development

1 messages ยท Page 2114 of 1

tender shard
#

it's probably not worth the trouble to "fix" this existing .jar

#

after all it only has 500 downloads, it will probably never get updated again

#

well that's not exactly java, but the result of a decompiled shitty plugin lol

limpid pebble
#

yeah, you have a point.

#

But what does that leave me with

#

xD

tender shard
#

maybe this would be an alternative?

limpid pebble
#

Broken

#

Tried it

tender shard
#

how exactly is it broken?

limpid pebble
#

I used to use that one though

tender shard
#

it's at least open source

limpid pebble
#

yeah

tender shard
#

so everything can be fixed easily

limpid pebble
#

let me try it and see what happens

#

I forgot what the issue was

tender shard
#

yeah but anyway, fixing this weird MultiWorldMoney plugin will probably take more time than rewriting it from scratch lmao

#

but as said, I'm sure someone would change all the messages for you for a tiny bit of $$$ lol

noble lantern
#

intellij refactoring takes 2seconds

#

select string -> right click -> refactor -> Change string -> its changed everywhere in the project

tender shard
#

ofc but first of all you'd have to turn this into an intellij project

#

all they have is a weird .jar file

limpid pebble
#

hmm

noble lantern
#

oh thought you were talking about the plugin you just sent :p

limpid pebble
#

MWMoney is workign somehow

#

Alex I tihnk u may have solved my life issues

#

lemmie test it a min

tender shard
#

I need some ideas for my string encryption

river oracle
limpid pebble
#

All youtube urls link to "Never Gonna Give You Up"

tender shard
#

yeah I already have a rick roll included

#

one sec I'll compile something

limpid pebble
#

damn Alex

#

That other plugin u linked works

#

Idk why it didn't b4

#

but bet.,

tender shard
#

no idea ๐Ÿ˜„

#

so yeah I need ideas for my string encryption

#

currently there's 4 things:

#
  1. strings having a rick roll link
  2. strings having the ``%%USER%%` placeholders etc
  3. strings having a copyright message
  4. strings without any additional stuff
#

but I need more funny things like rick roll stuff

#

oh and a fifth thing: a message telling people to buy the legal version at https://spigotmc.org / plugin link

zinc mist
#

What is the best way to set a certain range of blocks to air?
The way I am currently doing it keeps causing issues with the server and crashes

tender shard
zinc mist
#

Hmm, well currently its like 3x a 9x4x9 and I would say unloaded

tender shard
#

unloaded chunks is always a problem

#

9x4x9 is NOTHING

#

that's only like 4000 blocks

zinc mist
#

it would be hard to load them because the blocks are currently in a world made fully of bedrock XD

tender shard
#

erm wait

#

it's only 400 blocks

zinc mist
#

XD

#

yeah its nothing too major

tender shard
#

you can use PaperLib to async load chunks

zinc mist
#

oh?

tender shard
zinc mist
#

Haven't used PaperLib before, how do I do that?

#

perfect

tender shard
#

HOWEVER

#

if you run the plugin on spigot (instead of paper) it falls back to normal chunk loading

#

so async loading will only work on paper

zinc mist
#

Well I am currently developing a plugin for paper but figured since most things in paper are still spigot it would be best to ask here XD
So I guess that I already have access to paper lib

tender shard
#

you can just shade PaperLib

#

it will also work on spigot

#

buuut on spigot it will not be async. so you can use the same code for both spigot and paper, on paper it'll load chunks async, and on spigot it'll still cause lags

zinc mist
#

I will give it a test and see

#

Would this be right?:

PaperLib.getChunkAtAsync(origin)
        .thenAccept(c -> rooms.forEach((name,room) -> room.construct(origin)));
tender shard
#

that looks correct

zinc mist
#

Alright, wanted to be sure lol

tender shard
#

but

#

what does room#construct do?

#

if it intercepts with nearby chunks, obviously you wanna load them too

#

otherwise you only load the original chunk async, then you're fucked if your construct method interacts with unloaded chunks directly

zinc mist
#

Hmm, alright. Well the room#construct just makes the 9x9 rooms currently. I am curious though, what would be the best way to load the nearby chunks if they are needed?
I plan to use the nbt files to generate the structures in the future, the for loops way I am doing it now is just for testing

timber oracle
#

are sign packets broken in 1.18.2?

#

Swear I updated and sendSignChange no longer works

tender shard
#

sendSignChange works fine

timber oracle
#

ill do some more testing but im so confused

fierce hawk
#

Hello, I am having issues with my code. The goal is to give the player a potion effect when they equip a specific Player Skull. The code below works fine in creative but when switching to survival mode, it is unreliable.
Can anyone help fix this code?

    public static void onInventoryClickEvent(InventoryClickEvent event) {
        HumanEntity player = event.getWhoClicked();
        ItemStack item = event.getCursor();
        Bukkit.getServer().getConsoleSender().sendMessage(String.valueOf(event.getSlotType()));
        Bukkit.getServer().getConsoleSender().sendMessage(String.valueOf(event.getRawSlot()));
        if (item.getItemMeta() != null) {
            if (item.getType().equals(Material.PLAYER_HEAD) && ((event.getRawSlot() == 5 && event.isShiftClick() == false) || (event.isShiftClick() == true && event.getRawSlot() != 5))) { //(player.getGameMode() == GameMode.CREATIVE && event.getRawSlot() == 5 || player.getGameMode() == GameMode.SURVIVAL && event.getRawSlot() == 11))
                player.addPotionEffect(new PotionEffect(PotionEffectType.FAST_DIGGING, 999999, 2));
            } else {
                player.removePotionEffect(PotionEffectType.FAST_DIGGING);
            }
        }
    }
tender shard
#

?paste

undone axleBOT
tender shard
#

also erm, why are you listening to a click event if it's about equipping? there's a ton of ways to equip armor

#

the clickevent isn't enough to listen to

#

I have a library that adds an ArmorEquipEvent, you might wanna look into using that instead

zinc mist
#

Welp, I found out what the cause of my crazy lag was.
I was using Location#add instead of Location#clone#add so it just kept increasing the values.

tender shard
#

oh yeah, locations are mutable

zinc mist
tender shard
# fierce hawk sure https://paste.md-5.net/ekisireyif.cs

that's horrible. first of all:

  1. You're checking the raw slot. The raw slot however is a different slot, depending on what inventory the player has open
  2. Why are you checking shift click at all?
  3. Why are you removing the effect if the first if isn't true? that basically removes the effect everytime the player clicks into their inventory
#

You should definitely use the ArmorEquipEvent instead @fierce hawk

tender shard
#

right now, player's lose the potion effect e.g. when they craft something, because in the else block, you remove the potion effect

#

I doubt that's what you wanna achieve

noble lantern
#

A1 naming

dusk flicker
#

static events

#

ew

noble lantern
dusk flicker
river oracle
#

๐Ÿ‘€ static events what the hell

#

why

#

what

#

that is the most horrific thing I've seen in a while

noble lantern
#

i need a bigger screen

river oracle
#

I have a pretty decent sized screen 1366x768 or something like that

noble lantern
#

mines just a 32 inch

river oracle
#

why do you need bigger than that

tender shard
#

why the fuck do I always get ghost pings from this server

noble lantern
#

cause im a little blind so if i wanna see methods on my screen i have to zoom in

#

but when i zoom in i cant see the full line of code and end up scrolling for days

zinc mist
#

Is there a more efficient way to add a value to a Location without using #clone

tender shard
#

is there a specific reason why you're worrying about this?

zinc mist
#

Well, its not about the performance.
its just about me having quite a few clones hanging around

tender shard
#

its just about me having quite a few clones hanging around
?

zinc mist
#
for(int y = 0; y < 4; y++) {
    if(y > 0 && y < 3)
        loc.clone().add(0,y,0).getBlock().setType(Material.GOLD_BLOCK);
    else
        loc.clone().add(0,y,0).getBlock().setType(Material.IRON_BLOCK);
    if (facing == BlockFace.WEST || facing == BlockFace.EAST) {
        loc.clone().add(0,y,-1).getBlock().setType(Material.IRON_BLOCK);
        loc.clone().add(0,y,1).getBlock().setType(Material.IRON_BLOCK);
    } else {
        loc.clone().add(-1,y,0).getBlock().setType(Material.IRON_BLOCK);
        loc.clone().add(1,y,0).getBlock().setType(Material.IRON_BLOCK);
    }
}
#

Just feels a bit clustered

tender shard
#

yeah tbh that does look disgusting

zinc mist
#

I mean, its only for testing but still

river oracle
#

you could press enter at the end of some of those lines and add some more curly braces

tender shard
#

but performance-wise, there is no problem at all

zinc mist
#

welp, guess I will live with it for now.
After I get a bit of the other code working I will be working on loading the schematics

tender shard
#

I wonder what this is supposed to do in the first place

river oracle
#

ah u can also addcomments to make it more pretty

#

maek them constructive though like this thing does sthing

waxen plinth
#

You can do Block#getRelative(int, int, int) if you want to make it more compact

#

But you shouldn't be needing this kind of repetitive code anyways

zinc mist
#

Well, I am going to swap over to using that.
I am used to having the ability to add two values together without needing to clone it, so that will work perfectly

waxen plinth
#

What are you trying to do here

#

What's the goal of this code

zinc mist
#

Well this bit of code is just to clear out some space while I do some testing

#

That specific line creates the 'door' i am working on

waxen plinth
#

Is it an animation via blocks or something

zinc mist
#

No, just static blocks

waxen plinth
#

So you're creating a static structure

#

And you want to build it at a relative location

#

And you're doing this with manual calls to setType using relative coordinates

zinc mist
#

For now yes.
Until I get this bit of code working and add the schematics

waxen plinth
#

Do you want my solution

zinc mist
#

Sure ๐Ÿ™‚

waxen plinth
#

I've got a library that does this sort of thing, among many others

#

You can scan in a structure and then it's pretty trivial to build it programmatically

#

Rotated, relative to a certain location, mirrored, whatever you need

zinc mist
#

But isnt there already a way to use minecraft structure nbts to spawn in structures?

waxen plinth
#

Think so, haven't dabbled with that part of the api

#

Since I just use my own

#

If you're aware of a better way to do it why are you doing it by hand to begin with?

zinc mist
#

Well, I haven't done it either.
I saw it was a thing when poking around a bit, but I was already working on one thing and wanted to finish it before starting another

vale cradle
#

Any idea how to serialize entity nbt and then load it back from it's nbt?

#

I'm good by knowing how bukkit does it so I can figure out how to do it on my own

prime kraken
#

Hello everyone, I come to ask for your help because I am stuck. I need to use NMS for my server under 1.17.1. I work with intellij idea. I have run Buildtools to get the 1.17.1 version as well as the remapped version. When I ask intellij idea to run the compilation of my plugin, it tells me this : Unresolved dependency: 'org.spigotmcspigotjar:1.17.1-R0.1-SNAPSHOT' (I modified the name of the files before to see if it came from that but no) I used the remapped mojang classifier but nothing to do. Help me please ๐Ÿ˜ฆ

kindred valley
#

Can someone pls explain simply what is TileState and what is the difference between BlockState, i read the docs for 60 times but as for english is my not native language, im getting stucked. Someone pls explain shortly like explaining it to a dumb.

vale cradle
vale cradle
kindred valley
vale cradle
#

BlockState holds some of the Block data, a TileState represents when the Block is loaded and ticking

prime kraken
kindred valley
vale cradle
vale cradle
kindred valley
#
ItemStack item = new ItemStack(Material.QUARTZ_BLOCK);
  ItemMeta meta = item.getItemMeta();
  PersistentDataContainer container = meta.getPersistentDataContainer();
  NameapacedKey key = new NamespacedKey(Main.getPlugin(), "itemdata");
  container.set(key, PersistentDataType.DOUBLE, 12.1);
#

I mean if i place this (Block) item, the data still stays on placed block?

vale cradle
#

No

#

It wont

#

if you mean give the item to a player and then be placed by him, then don't

kindred valley
vale cradle
#

by listening to their respective events

#

db

#

from a json nbt or whatever

kindred valley
#

Hmm so event.getIteminHand can handle my custom item

vale cradle
#

I know, but I would like some help if somebody has knowledge about code this deep or whatever

#

I think I found it tho

#

NMS's Entity.load method apparently, I'm not sure

#

oh, I thought you were talking to him

#

so, may I know what strategy did you use?

kindred valley
#

Alright tysm

#

Ah yes i looked at it then confused

vale cradle
#

I don't know, I don't plan to use Bukkit's API

#

No, they are individually filled in one of the Entity methods

ornate heart
#

Anyone know what version within the world edit api contains the CuboidClipboard class?

#

Nevermind i just figured it out lets goooo

crude loom
#

Bukkit.getWorld(string name) doesn't work for me when I upload a new world to the server, so I plan on getting the world through the file directory of the server, my question is if I have an instance of a file can I convert/cast it to a world?

prime kraken
#

Hello, i performed on spigot 1.17.1 and I have a question.. I have this code ;

#

        MinecraftServer server = ((CraftServer) Bukkit.getServer()).getServer();
        WorldServer world = ((CraftWorld) Bukkit.getWorld(p.getWorld().getName())).getHandle();
        GameProfile gameProfile = new GameProfile(UUID.randomUUID(), "");
        EntityPlayer npc = new EntityPlayer(server, world, gameProfile, new PlayerInteractManager(world));
        npc.setLocation(p.getLocation().getX(), p.getLocation().getY(), p.getLocation().getZ(), p.getLocation().getYaw(), p.getLocation().getPitch());

    }```
#

At the entityPlayer, they return the (world) as underlined, can anyone help me ?

vale cradle
#

use the WorldCreator.create to load an unloaded world

prime kraken
earnest forum
#

previous methods don't work

vale cradle
#

besides, Bukkit.getWorld(world.getName())?

#

just use the world given by the p.getWorld()

crude loom
crude loom
prime kraken
earnest forum
earnest forum
#

I remember getting stuck here and there wasnt lots of tutorials

stable willow
#

Hi!I can change that anywhere? (PowerRanks) The Language
--------------------PowerRanks---------------------
Your Balance: "---"
Click 'confirm' to purchase
"Rank"
Cost: 100000
[Confirom]

https://i.imgur.com/dvIlHSg.png

crude loom
#

Given a world folder (of type File) can I convert it to a world?

fringe wyvern
#

hi, my spigot isn't remapping properly, ran buildtools with --remapped, and copied the maven thing from one of the posts md_5 made

karmic mural
#

I'm trying to build a plugin so I can fork it, but I'm getting an error when trying to run the server with it. NoClassDefFoundError specifically. I couldn't figure out why that issue appears. It originates at Line 13 of this file https://github.com/oraxen/oraxen/blob/master/src/main/java/io/th0rgal/oraxen/mechanics/provided/gameplay/efficiency/EfficiencyMechanicFactory.java

When it hits this, the plugin fails to enable and goes to disable. It also runs into an issue here, but this time a NullPointerException.
Line 102 in the main class https://github.com/oraxen/oraxen/blob/master/src/main/java/io/th0rgal/oraxen/OraxenPlugin.java

I've tried building a few different ways, maybe I am dumb but what I've been doing is running a gradlew build. I'm going to be contacting the main dev later today, but thought I'd ask here first.

karmic mural
faint harbor
#

When setting the players health using player.setHealth() , is there a way to simulate the flashing hearts effect that shows on the client normally without packets?

chrome beacon
#

and make sure you're actually using maven to build your jar

#

?paste

undone axleBOT
desert tinsel
#

how to create a itemstack for a custom player head from a nbt tag, i searched that, but i didn't find nothing

chrome beacon
#

If you're using nbt tags you need to use NMS

#

NMS is generally undocumented and you will have to take a look around yourself to see how things work

#

I do happen to know that you can use the MojangsonParser or TagParser in Mojmaps

#

Also is there a reason why you want to use nbt tags instead of the api?

desert tinsel
chrome beacon
#

You can still use the api for this

#

I explained it a few days ago, let me see if I can find it

maiden briar
#

I have a database somewhere. I am writing a multi-server plugin and the plugin will store data on the database. How can I synchronize the data between the database and the local plugin cache?

desert tinsel
#

what api do i need?

chrome beacon
#

Spigot api ๐Ÿ™‚

desert tinsel
#

ah

#

sure

#

do you find it?

chrome beacon
#

The conversation starts here. You can read through it, ping me if you have any questions

desert tinsel
#

ok thanks you

kindred valley
#

What was the method removing item from inventory

maiden briar
#

removeItem

kindred valley
#

is it removing all or 1

maiden briar
#

Put in the item you want to remove so 1

kindred valley
#

Hmm how can i directly remove all

maiden briar
#

clear

kindred valley
#

i mean

#

All item in players hand

#

Not all inv

maiden briar
#

I believe you can clear per slot. I believe you can get the slot the players hand is on

kindred valley
#

i couldnt find the method wait

#

Im fucking trying to code note book on school

maiden briar
#
int hand = player.getInventory().getHeldItemSlot();
player.getInventory().setItem(hand, null);
#

@kindred valley Does this solve your problem?

kindred valley
#

I dont know, im coding it to a notebook ๐Ÿ™ƒ

maiden briar
#

Ok haha just write it down

kindred valley
#

null is valid for slot?

maiden briar
#

But this code is at least accepted in my IDE

maiden briar
#

It means clearing it

kindred valley
#

Ah alright then that works tysm

maiden briar
#

Np

maiden briar
desert tinsel
#

ty

smoky adder
#

...

maiden briar
smoky adder
#

Pls can you show me an example?

maiden briar
#

player.sendTitle("This is a awesome title", "This is a awesome subtitle")

#

If you only want one of them, leave the other empty ("")

smoky adder
#

No i use spigot 1.8.8 sendTitle doesn't exist

chrome beacon
#

Time for packets

#

Very fun

smoky adder
#

Lol

maiden briar
chrome beacon
#

Wait it does? Interessting ๐Ÿ™‚

smoky adder
#

I can't use packets

chrome beacon
#

Legacy versions are a pain to work with

smoky adder
chrome beacon
maiden briar
#
<dependency>
            <groupId>org.spigotmc</groupId>
            <artifactId>spigot</artifactId>
            <version>1.8.8-R0.1-SNAPSHOT</version>
            <scope>provided</scope>
        </dependency>
smoky adder
#

Wtf

maiden briar
#

It is only Deprecated

#

So will most likely not work on newer versions

smoky adder
#

can you send me your jar where do you get the libraries from?

chrome beacon
#

It probably will work

#

?bt

undone axleBOT
chrome beacon
#

^ this is the only official way to get the spigot jar

#

But you don't really need it you can just depend on the spigot api

#

Like tvhee has done above, but with spigot-api instead of spigot inside of the artifact id

smoky adder
#

there is no need to change the jar ?? just change the libraries?

chrome beacon
#

You shouldn't be depending directly on the jar

#

Use a build system like maven or gradle

maiden briar
maiden briar
smoky adder
#

how can I do?

smoky adder
#

Thanks

maiden briar
#

Also if using IntelliJ, right click and choose "Add framework support". Lot easier

torn badge
#

Hey guys, I'm looking to implement a dynamic arena creation system for a minigame, which creates a new arena automatically when there are enough players in the queue. My question is, is there a more performant way than creating and loading a world and deleting it after the game is over?

crimson terrace
#

if not you could theoretically just keep a single map active at all times. just not sure whether that is less performant that creating it when you need it

smoky adder
#

@maiden briar titleAPI is good?

maiden briar
#

Never used it, just try it

smoky adder
#

Okay

torn badge
crimson terrace
#

I meant a single map inside its own world which you can just tp people to whenever its not occupied and the playercount is reached.

#

so instead of deleting the map when the players are done you could just keep it there and teleport the next batch of players there

torn badge
#

But there are going to be multiple arenas with the same map at the same time

crimson terrace
#

you can change the amount of maps permanently active. possibly make it depend on the overall playercount?

#

so if theres 50 players on the entire server just keep 2 of the maps open, if theres 100 keep 4 or something like that

torn badge
#

Hmm that would be an idea

#

So whenever a player joins or leaves, check how many arenas it would need to fit all online players, and then delete or load one if necessary

crimson terrace
#

basically

#

as I said, I don't actually know whether its more or less performant to keep the maps open compared to just making them on demand

torn badge
#

I think defining the arena region with WorldEdit and then only loading the chunks which are actually used would also drastically increase performance

#

And disable spawn chunks

kindred valley
#

Why do we need a File object for custom config file

crimson terrace
#

how else did you wanna make a file?

lavish hemlock
#

Path go brrr

crimson terrace
#

Path#toFile(), right? or is there another method?

rain grove
#

How can you create an object with a new model that does not exist in Minecraft?

lavish hemlock
#

I mean you could just use a Path by itself

crimson terrace
#

well you still need that file so that the path works

lavish hemlock
#

No ya don't

#

java.nio.path.Files

crimson terrace
#

I mean, how do you wanna access a file that does not exist

kindred valley
#

What is FileConfiguration pls explain shortly

#

Couldnt understand from docs

crimson terrace
#

not actually sure, but its a (i think) hashmap representation of the config file? please correct me if im wrong

kindred valley
#

what physically it is

crimson terrace
#

data

lavish hemlock
#

...what do you mean physically?

#

I mean it's like

#

Part of your RAM

#

I suppose

crimson terrace
#

FileConfiguration does not inherit from File, if thats what you mean

lavish hemlock
crimson terrace
#

Burchard got this

noble lantern
#

File - the literal file, eg config.yml, it allows the creation/deletion of the file and opening of the file as a type of InputStream, it holds no data in itself other than that stuff, its basically just a pointer to a file on your system

FileConfiguration - Data from your File, what maow said, it is typically loaded into ram when you load the File -> File Configuration, its basically just the data content of the File

rain grove
#

How can you create an object with a new model that does not exist in Minecraft?

chrome beacon
#

Items yes

steel swan
#

anyone knows how to stop a this.getServer().getScheduler().scheduleSyncRepeatingTask(this, new Runnable() {

undone axleBOT
steel swan
#

oh thx !

#
this.getServer().getScheduler().scheduleSyncRepeatingTask(this, new Runnable() {
                @Override
                public void run() {
if(getIntVallue(block) = 0){
                    Runnable.cancel();
}

                }
            },20,20);

so like this for instance?

chrome beacon
#

No

#

Read the entire thing

steel swan
#

oh yeah my bad

#

yeah but how do i get the id?

chrome beacon
rain grove
chrome beacon
#

Items can have custom models

rain grove
#

I looked at it, but with that you can include new items? I don't want to replace the ones that are already there

#

With that method? It is that I have only seen that it replaces the textures of the items, it does not create new ones

undone axleBOT
fringe wyvern
#

hi, I have this error: java.lang.NoSuchMethodError: 'buw org.bukkit.craftbukkit.v1_18_R2.inventory.CraftItemStack.asNMSCopy(org.bukkit.inventory.ItemStack)' No idea how it's happening, any ideas?

steel swan
#
BukkitScheduler scheduler = Bukkit.getScheduler();
            scheduler.runTaskTimer(this, task -> {
                if (block.getType() != POLISHED_ANDESITE_SLAB) {
                    setintVallue(block, 0);
                task.cancel();
                }else{
                    setintVallue(block, getintVallue(block) + 100);
                }
                        }, 20L, 20L);
#

so would this work

fringe wyvern
fringe wyvern
#

hello?

faint harbor
#

Is there a way to heal a player while showing the flashing heart effect without packets?

chrome beacon
golden kelp
#

I am coding a plugin which stores the versions of all plugins installed on the server. How can I get the version from their plugin.yml

glossy venture
#

im pretty sure rheres like a get descriptor method or get version

#

on the plugin instance

golden kelp
glossy venture
#

yes Plugin#getDescription()

glossy venture
#

it should never be null

golden kelp
#

Some plugins dont specify the version ig

crimson terrace
#

maybe check whether the plugin instance is null

golden kelp
#

Is it because my plugin is loaded before the plugin i am checking for?

crimson terrace
#

version is standard in my pom

glossy venture
#

it cant be

crimson terrace
golden kelp
#

How

glossy venture
#

then all plugins will have been loaded

#

but not enabled yet

crimson terrace
#

when you make the project I think you can set when to load it. not sure how to do it once the project has been created already

golden kelp
#

maybe do it in onEnable
i do it when the player executes a cmd

set your plugin to load on STARTUP
how

glossy venture
#

if you do it when the player executes a command there is no way rhe plugins will be null

#

show code

crimson terrace
#

or do it inside a Bukkit.getScheduler.scheduleSyncDelayedTask

#

and do it like a minute after onEnable in your plugin

glossy venture
#

wtf where are you getting the versions

#

oh nevermind

glossy venture
#

check if the plugin is null when getting it

#

if so then send the player like "unknown plugin name"

fringe wyvern
crude loom
#

How do I rename a file in the plugin's data folder? I know that I can user file.renameTo(File file) But this method receives a file, how do I rename an existing one?

eternal night
#

what is the issue what that method

crude loom
#

What am I supposed to pass to that method?
Lets say I have a file variable named f and I want to rename it to "newName"?

compact haven
#

Just create a new file

#

new File(โ€œnewName.txtโ€)

eternal night
#

Well if you have a file, lets say ```java
final File dataFolder = ....;
final File existingFile = new File(dataFolder, "f");
existingFile.renameTo(new File(dataFolder, "b"));

#

renames your f to b

compact haven
#

A file object doesnโ€™t actually represent a file on the file system (like it doesnโ€™t need to exist)

#

and yeah make sure you specify the parent my bad

crude loom
#

Oh I see, thanks for the help!

#

How do I save these changes? because I see that they are being done but for some reason after I rename a file the plugin still sees the old name

#

When I execute this : getServer().createWorld(new WorldCreator(file.getName()))
Does this create a new world with the file's name or does it load the world that is in the file?

eternal night
#

Both

#

If the file exists it loads the world from the file

#

If it doesnโ€™t it creates the world instead

surreal prawn
#

is there a cleaner way to write this?

brave goblet
#

Why don't end portals fall under the event PortalCreateEvent?

surreal prawn
eternal oxide
#

they are under DragonBattle

brave goblet
brave goblet
#

if it doesn't work ill also try ur method

brave goblet
surreal prawn
#

oh, mb then

brave goblet
#

but ur method actually has portal type

#

why the fuck would they separate the different portals lol

upper niche
#

Constructors are how you instantiate an object. It lets you control what exactly happens when you first create an object, before doing anything else to it.

brave goblet
#

old depreciated method lets gooooo!

eternal night
#

the server creates the instance of your plugin's main class

upper niche
#

It's called when Spigot loads the plugin.

midnight shore
#

Hi! Can anyone please tell me an idea for a boss? Whatever theme is accepted

brave goblet
#

@surreal prawn doesn't work :(

brave goblet
#
@EventHandler
    public void portalCreatEvent(PlayerPortalEvent event) {
        Player player = event.getPlayer();
        if (player.getWorld().getName().equals("worldName")){
            player.sendMessage("Error!");
            player.setVelocity(player.getLocation().getDirection().multiply(-1));
            player.setNoDamageTicks(40);
            event.setCancelled(true);
        }
    }```
How can i make it so that it waits before i send another message? instead of spamming the player
eternal night
#

Well, the server will try to teleport the player each tick they are inside the portal

#

you will have to implement a cooldown yourself

brave goblet
eternal night
#

I mean, a plain Map<UUID, Long>

crimson terrace
#

You could use System millis

kindred valley
#

?paste

undone axleBOT
kindred valley
#

can someone help

crimson terrace
#

exception, you can read what caused it in the bottom bit

#

i would guess its this

kindred valley
brave goblet
crimson terrace
sterile token
#

Any good github example for doing multiplatform plugins. Like a example which demostrate how to use let say a Core module and use it for Bungee and Spigot?

crimson terrace
#

youre using reflections, right?

kindred valley
#

if(p.getInventory().getItemInMainHand().isSimilar(cash.getCash())) this is 115

sterile token
kindred valley
#
@EventHandler
    public void onClicking(PlayerInteractEvent e) {
        Player p = e.getPlayer();
        Cash cash = new Cash();
        Block block = e.getClickedBlock();
        Action action = e.getAction();
        if(action == Action.LEFT_CLICK_BLOCK) {
            if(p.getInventory().getItemInMainHand().isSimilar(cash.getCash())) {
                if(block.getState() instanceof  TileState) {
                    BlockState blockState = block.getState();
                    TileState tileState = (TileState) blockState;
                    PersistentDataContainer container = tileState.getPersistentDataContainer();
                    NamespacedKey key = new NamespacedKey(Main.getInstance(), "blocks");
                    int i = 1;
                    if(container.get(key, PersistentDataType.INTEGER).equals(i)) {
                        int amount =p.getInventory().getItemInMainHand().getAmount();
                        Bukkit.dispatchCommand(Bukkit.getConsoleSender(), "money give " + p.getName() + " " + amount);
                        int hand = p.getInventory().getHeldItemSlot();
                        p.getInventory().setItem(hand, null);
                    }
                }
            }
        }
    }
sterile token
#

Allright

crimson terrace
#

you should check for null values for the p.getItemInMainHand and others there

#

not sure what this means, anyone?

chrome beacon
#

As it says it can find or load that class

crimson terrace
#

if it wasn't able to find that class, wouldn't it throw that error in the 4th line already?

desert tinsel
#

how can i access the GameProfile?

kindred valley
crimson terrace
#

it cant find a class from the api?

kindred valley
#

why

crimson terrace
#

youre using the spigot api, right?

kindred valley
#

yeah

crimson terrace
#

you using maven? maybe reload the dependencies?
gotta guess at this point

kindred valley
#

no im not using

crimson terrace
#

gradle?

kindred valley
#

no

crimson terrace
#

just a plain java project?

kindred valley
#

yeah?

crimson terrace
#

who hurt you

#

jkjk, i don't know how you could fix that, maybe check your dependencies

sterile token
quaint mantle
#

bro how can put bow enchantment infinite arrows in spigot?

sterile token
#

You have to create/get a item stack

crimson terrace
#

actually thats from 2013 damn

sterile token
crimson terrace
#

just surprised at how nobody has asked that on spigot in like 9 years

desert tinsel
chrome beacon
crimson terrace
sterile token
desert tinsel
#

yes

sterile token
#

let start from there

#

Allright so check your .m2/org/spigotmc

#

And check if you have spigot-api and spigot-jar folder

desert tinsel
#

nvm

sterile token
#

You should have it

desert tinsel
#

i solved without gameprofile

sterile token
#

Oh ok

#

No problem

desert tinsel
#

thx

sterile token
#

Your welcome

#

Zacken NMS which maven dependency is?

#

Its called as spigot-nms?

#

Oh ok

#

Because you have org.bukkit:bukkit-nms too

kindred valley
#
Block block = e.getBlockPlaced();
BlockState blockState = block.getState();
TileState tileState = (TileState) blockState;
#

is this a true situation?

#

my console sends Caused by: java.lang.ClassCastException: class org.bukkit.craftbukkit.v1_18_R2.block.CraftBlockState cannot be cast to class org.bukkit.block.TileState

eternal night
#

not every block state is a tile state

#

you need to instanceOf check this

kindred valley
#

yes i have

river oracle
#

Doubt this

kindred valley
#

ah no

#
@EventHandler
    public void onBlockPlace(BlockPlaceEvent e) {
        Player p = e.getPlayer();
        Bank bank = new Bank();
        if(p.getInventory().getItemInMainHand().isSimilar(bank.getBank()) && e.getBlock() instanceof TileState) {
            Block block = e.getBlock();
            BlockState blockState = block.getState();
            TileState tileState = (TileState) blockState;
            PersistentDataContainer container = tileState.getPersistentDataContainer();
            NamespacedKey key = new NamespacedKey(Main.getInstance(), "blocks");
            container.set(key, PersistentDataType.INTEGER, 1);
         }
    }
#

is this true rn

river oracle
#

:/

#

Your casting tile state to block state and your checking if it's instance of a block Two different things

#

As such you get an error

kindred valley
# river oracle Your casting tile state to block state and your checking if it's instance of a b...
@EventHandler
    public void onBlockPlace(BlockPlaceEvent e) {
        Player p = e.getPlayer();
        Bank bank = new Bank();
        if(!(e.getBlock() instanceof TileState))
            return;
        if(p.getInventory().getItemInMainHand().isSimilar(bank.getBank())) {
            Block block = e.getBlock();
            BlockState blockState = block.getState();
            TileState tileState = (TileState) blockState;
            PersistentDataContainer container = tileState.getPersistentDataContainer();
            NamespacedKey key = new NamespacedKey(Main.getInstance(), "blocks");
            container.set(key, PersistentDataType.INTEGER, 1);
         }
    } 
#

wow e.getBlock().

#

ahahha

#

nah somehow not working

earnest forum
#

p.getItemInHand()*

#

I'm pretty sure the event one is like get tool or something

#

neverm ijnd

kindred valley
#

how can i contain datas on a normal block

#

not a tile

#

or can i

tardy delta
eternal night
#

blocks don't hold data

#

tile entities do

#

if your block does not hold onto a tile entity

#

you cannot store custom data in it

tardy delta
#

i would cache namespacedkeys but is that really worth it?

earnest forum
#

a regular block like stone or grass cannot hold data, but anything that has further functionality like a furnace, beacon, etc, has custom data availability

desert tinsel
#

why i have that error: Unable to make field private java.lang.Object java.lang.ref.Reference.referent accessible: module java.base does not "opens java.lang.ref" to unnamed module @7ff2a664
my code is:java public static void saveBlocks() throws IOException { Gson gson = new Gson(); File file = new File(plugin.getDataFolder().getAbsolutePath() + "/blockStorage.json"); file.getParentFile().mkdir(); file.createNewFile(); Writer writer = new FileWriter(file, false); gson.toJson(blocksList, writer); writer.flush(); writer.close(); System.out.println("All blocks have saved"); }

tardy delta
#

use new File(plugin.getDataFolder(), "blockstorage.json") instead

#

wont solve it but ye

desert tinsel
#

Also, the error is in line: gson.toJson(blocksList, writer)

#

And blocksList is an ArrayList

quaint mantle
#

Hello i am using intellij and when i build my project as an artifact there is only the resources folder
configuration in imgs

#

intellij idea 2021.2.2

sterile token
#

Where does dependency: ninja.leaping.configurate came from?

sterile token
quaint mantle
#

i am using maven

sterile token
#

Allright

#

So can you send a picture

#

Of his please but a fully picture

#

I want to see your project structure

carmine mica
#

Is there a way to suppress chest open and close sound also the animation?

lean gull
#

how do i change the ObjectId in the _id of a document in MongoDB to a player's UUID

sterile token
#

Could you solve it?

lean gull
#

append?

quaint mantle
sterile token
# lean gull `append`?

You can either do:

Document#appen("field-name", value)
Document#set("field-name", value)

tardy delta
#

if i do getConfig().options().copyDefaults and then something liek config.getString("smth here") when that string isnt set, will it return the default value from within the yml file in the jar?

sterile token
#

Or that what i think

#

You can always use my simple class for files

#

So you can either load files with content from yaml inside jar or empty file

tardy delta
#

well basically my problem is that rn im having an enum to save lang defaults in, and i would rather save them in the file directly because i need to initialize those values and stuff

carmine mica
#

is there an event for when a chest is opened/closed?

sterile token
#

Wait you can do:

Enum.values().forEach()

sterile token
carmine mica
#

Ah okay

tardy delta
#

look at the Lang#initialize method, thats what im trying to avoid

#

there must be a more elegant way

tardy delta
#

scroll down or do ctrl + f lol

sterile token
#

Im on cellphone

#

Send a cap please

#

Or send the code

tardy delta
sterile token
# tardy delta

Replace the for to:

Lang.values().foreach(entry -> yaml.set(entry, entry.getText()));

#

getText() replace it according to your method

grim ice
carmine mica
kindred valley
#

im f*cking dealing with fileconfigs

#

i mean i get all logic of it but when phsycially the thing i want to see in config, i cant code it

tardy delta
#

you need to go into spectator mode for a short time to disable the animation

#

and handle the item clicks

#

atleast thats what i think is the easiest way

sterile token
sterile token
kindred valley
#
String text = "Locations"
Configs.fileConfig.createSection(text + ".location");
Configs.fileConfig.createSection(text + ".location.x");
Configs.fileConfig.createSection(text + ".location.y");
Configs.fileConfig.createSection(text + ".location.z");
Configs.fileConfig.save(Configs.file);
#

i have this

sacred mountain
#

hey how should i calculate a 'Top Overall Player' using Kill rank, death rank, highest bow accuracy, highest mob kills, damage dealt, damage taken etc

delicate lynx
#

just save the location by itself, you are making yourself do more work this way

grim ice
#

maybe

#

idk

sacred mountain
#

bow accuracy is (hitShots / Math.max(1, totalShots)) * 100

#

so its a percentage atm

#

i just dont know how i would put them all together nicely to have a fair top player

torpid jewel
#
    execute console command: "/kickall"
        wait 1 tick
            execute console command: "/tempban * 1d maintenance, you are not banned, this is a whitelist"```
#

Would this work?

#

I'm brand new to skript, haven't done it before, ever.

sacred mountain
#

and idk why you would divide by mob kills, surely that would decrease their total?

I'm thinking something like
int playerTotalStat = (kills - deaths) + hitShots + mobKills + (damageDealt - damageTaken);
@grim ice

ivory sleet
#

lightfury how are you adding em all up rn

#

oh

#

ugh

sacred mountain
#

idk i wrote that in discord

#

i havent done it yet

sacred mountain
#

thats skript

torpid jewel
#

I have absolutely no idea on how to do this

#

oh

sacred mountain
#

this is for java im fairly sure

torpid jewel
#

Ah alright

#

where would I go for that?

#

Well

#

what I need

sacred mountain
#

the skript discord if they have one

delicate lynx
#

doesn't skript have a discord?

torpid jewel
ivory sleet
#

lightfury okay first of all how easy is it to get damage dealt contrary to a kill

#

and how easy is a mob kill contrary to a normal kill

#

you need to figure that out

sacred mountain
ivory sleet
#

and then translate each one of them into a unanimous currency

sacred mountain
#

and a mob kill is easier because they arent critting you out constatntly

#

but you still get damage so

ivory sleet
#

like "skill points" or sth where every other unit in your system can be translated to this unit

#

pretty much how its done everywhere

sacred mountain
#

ill try

#

im updating the leaderboard a lot so i may not calculate it every time, maybe just get the values and add the skill points when people kill each other. I'm thinking i could just have a leaderboard for each stat and then have a 'skill point' leaderboard.

ivory sleet
#

yes

#

thats also one way to do it

grim ice
#

maybe try urs tho

#

or well

desert tinsel
grim ice
#

(hitShots/100) + ((kills+deaths)/damageDealt)) + (damageTaken / (kills/1000))

prisma needle
#

SortPlayerlist?

prime kraken
#

Hello, I made a gun with a fireball as projectile, everything is ok with that except when the fireball hit a player, it made it in fire, how can i remove this ?

chrome beacon
#

It made it in fire?

kindred valley
sterile token
#

Any good library for managing Json and Yaml files?

#

I have seen Gson or Jackson what do you recommend?

kind hatch
#

YAML is pretty easy with the API. I think Gson is what most people use here.

river oracle
#

Gson over Jackson

sterile token
#

Yes

#

I know the 2 of them support json and yaml parsing

#

I want a library for parsing yaml and json, so them i can built my own file api

#

What do you think? iI accept opinions

ember estuary
#

How to calculate the Speed of a player?

#

I thought player.getVelocity().length(); would do, but its just the acceleration :/

#

So sneaking, sprinting, walking all gives the same result

#

I know i could make a map for every player and in moveevent use pythagoream theorem to calculate the distance since last moveevent and divide by time since last moveevent

#

but thats kinda suuuper complicated. Does anyone know an easier way?

kindred valley
#

How can I add a new section to the config every time?

kind hatch
#

Wdym new section? Like another node or something like a value in a list?

kindred valley
#
Locations:
  location:
    x: 
    y: 
    z:
  location:
    x:
    y:
    z: 
#

Everytime a new location

kind hatch
#

You could use #createSection() or just #set() the new section.

sterile token
#

I always asked that question

kind hatch
#

Idk, I.refer to them as nodes but sections also work. I categorize sections as a group of nodes like in his example.

#

Itโ€™s just language semantics

sterile token
#

So nodes can either be? string, integer, byte, etc, maps?

kind hatch
#

The path to it yes.

sterile token
#

node - will be a key-value
section - will be a collection of key-value

#

๐Ÿค”

kind hatch
#

Again, really just semantics, but I refer to them as nodes because they are similar to permission nodes.

Permission Node: myplugin.command.permission
YAML Node/Path: path.to.your.value

sterile token
#

Yeah

#

Shadow can i ask you some personal questions?

kind hatch
#

I guess.

solid cargo
#

can i put letters like: ลก, ฤ, ฤฃ in .yml file comments?

sterile token
#

Allright:

  1. Do you think a file api would be useful?
  2. What data format will you add for support?
kindred valley
#

did i make mistakes on load/save?

kind hatch
kind hatch
kind hatch
#

Like the path name?

sterile token
kindred valley
#

oh yes it is

kind hatch
#

That would be why

kind hatch
#

Caching is another problem Iโ€™m trying to work around.

sterile token
#

Allright so will start working on the lib

#

Also shadow i want some help about coding the section thing

green prism
#

Code: https://pastebin.com/7Gh8VdBk
With placeholder api I made a placeholder where the value is obtained from the config. The problem is that when I modify and save the programmatically config, the placeholder does not update until a total reload with /reload confirm. Version 1.16.5
Can you help me?

kindred valley
kind hatch
green prism
sterile token
kindred valley
#

but its always overwriting

#

after placing

sterile token
#

You should keep the blocks in memory

#

And then right back to file

#

I dont know what you are doing exactly that why

green prism
# sterile token Wait explain carefully hat doing

I simply made a plug-in that allows you to create a custom name, gender and age and puts them in the config (and then giving value to the placeholder). I added a command that allows you to reset the values of this player and re-entering them requires the "setup" resetting the data in the config. The problem is that the data remains old and the placeholder does not update except with a /reload confirm

sterile token
#

?paste

undone axleBOT
sterile token
#

Allright paste the code there please

sterile token
#

I cannot use pastebin

#

Its blocked on my country

sterile token
#

Allright thanks

#

Let me check

green prism
#

and this is the part of the command which reset the name

                    if(args[0].equalsIgnoreCase("removePlayer") && sender.hasPermission("identity.removePlayer")) {
                        if(main.getConfig().isConfigurationSection("data") && main.getConfig().getConfigurationSection("data").contains(args[1])) {
                            main.getConfig().set("data." + args[1], null);
                            main.saveConfig();```
crisp steeple
#

are you sure that you have that permossion?

#

also is it the file that isnโ€™t updating or is it just in game

green prism
#

it works I tested

#

Doing /papi reload doesnโ€™t change anything then idk

tender shard
#

java detects NBSP as whitespace D:

green prism
#

๐Ÿ™‚

plain oracle
#

Hi in my kitpvp plugin i want the snowball refill when kill, im a new developer can any one help me pls?

        ItemMeta SBMeta = Arrow.getItemMeta();
        SBMeta.setDisplayName("ยง7Snow Ball");
        SB.setItemMeta(SBMeta);

        k.getInventory().setItem(0, SB); ```
#

i know the snowball will take the slot 1

#

but idk how to make it refill the snowball

tender shard
#

i want the snowball refill when kill
whut?

kindred valley
#

i want to store every block i placed.

#

but its overwriting and overwriting

tender shard
tender shard
kindred valley
tender shard
#

section? I have no idea what you're talking about

#

maybe show us some code

#

?paste

undone axleBOT
tender shard
#

are you storing blocks in a config file?

kindred valley
tender shard
#

okay, show some code pls

kindred valley
#

i mean the location of block

#

let me explaing it bit because i made it a bit long

#
int y1 = (int) e.getBlock().getLocation().getY();
        int y2 = (int) e.getBlock().getLocation().getY() -1;
        int y3 = (int) e.getBlock().getLocation().getY() +1;

        int x = (int) e.getBlock().getLocation().getX();
        int x1 = x - 1;
        int x2 = x - 1;
        int x3 = x - 1;
        int x4 = x;
        int x5 = x + 1;
        int x6 = x + 1;
        int x7 = x + 1;
        int x8 = x;

        int z = (int) e.getBlock().getLocation().getZ();
        int z1 = z;
        int z2 = z + 1;
        int z3 = z - 1;
        int z4 = z - 1;
        int z5 = z - 1;
        int z6 = z;
        int z7 = z + 1;
        int z8 = z + 1;

        String text = "Locations";
        Configs.fileConfig.createSection(p.getUniqueId() + ".");
        Configs.fileConfig.set(p.getUniqueId() + ".locations.x", x);
        Configs.fileConfig.set(p.getUniqueId() + ".locations.y", y1);
        Configs.fileConfig.set(p.getUniqueId() + ".locations.z", z);
        Configs.fileConfig.save(Configs.file);
tender shard
#

well your section is called "uuid."

#

so obviously you overwrite it every time

#

instead of saving a configurationsection, you should save a List<ConfigurationSection>

#

or just directly store a List<Location>

kindred valley
#

ah actually wait

#

yes

kindred valley
#

for casting location as Integer

tender shard
#

Why don't you just save a List<Location>?

List<Location> locations = new ArrayList<>();
list.add(someLocation);
configFile.set("locations",locations);
fallen sandal
#

I need a help in bukkit schedular.. can somebody tell me how to send a msg per minute.. whats the delay time

green prism
fallen sandal
#

I tried this. But i dont think so its working correctly

#

0L, 60 * 1000

green prism
kindred valley
sterile token
#

How would you read this yanl file and load it into cache using Jackson?

Yaml file looks

Section-1:
key-1: "value 1"
key-2: "value 2"

desert tinsel
#

?paste

undone axleBOT
halcyon mica
#

Quick java question, how can I pass a throwable to a different function when the catch block defines the exception as multiple types?

sterile token
desert tinsel
#

not

sterile token
#

Oh ok sorry

desert tinsel
#

i want link

ivory sleet
#

and then cast

#

since thats a union type

quaint mantle
#

you dont need to loop anything

#

if you implement ConfigurationSerializable or smth for the value type then you dont have to worry about doing it manually

kindred valley
#

how can i control if player is close a specified location

quaint mantle
#

wym

kindred valley
plain oracle
tender shard
#
  1. apply a special PDC tag to the snowball itemstack
  2. when a player dies, get their killer
  3. if the killer has the snowball itemstack, set it's amount to 16
quaint mantle
rugged cargo
#

can you change how fast a particle changes it texture? my assumption is no

kindred valley
tender shard
#

try to use a more recent version of gson and it should work

desert tinsel
tender shard
quaint mantle
#

good to know

#

use that

tender shard
scarlet sun
#

Im having trouble with my GUI. I have used InventoryClickEvent to disable dragging items in and out from the GUI and it doesn't fully work. When i try to put an item in to GUI with right click - the gui closes, but when i put an item with left click - it stays and when i close the gui manually - the item just disappears. Any ideas how to fix it? My code:

    @EventHandler
    public void onInventoryClick(final InventoryClickEvent event) {
        final Player whoClicked = (Player) event.getWhoClicked();
        final String title = event.getView().getTitle();
        if (!(title.equalsIgnoreCase(whoClicked.getName() + "ลฝmogลพudลพiลณ gaudytojas"))) return;
        event.setCancelled(true);
tender shard
#

creative is weird because the inventories are mostly client sided

scarlet sun
#

Tried in survival and now it allows me to use the gui as a trash can with both mouse buttons

#

even worse :D

#

But atleast it doesn't allow me to drag items out of the gui

tender shard
#

how are you opening the inventory? I assume that you create a new one everytime?

desert tinsel
tender shard
#

if so, obviously it will be empty when you reopen it

quaint mantle
tender shard
#

yeah so everything works, where's the problem?

#

if you create a new inventory, of course it will be empty

scarlet sun
#

I mean i dont need to save the items

#

I need to disallow players to put something in the gui

kindred valley
#

@quaint mantle do you have anything i can read about this sh*t cause just because of this yml stuff i will leave java

tender shard
undone axleBOT
tender shard
#

like - are you sure that you cancel the event?

#

also you must also listen to InventoryDragEvent

scarlet sun
# tender shard like - are you sure that you cancel the event?
    @EventHandler
    public void onInventoryClick(final InventoryClickEvent event) {
        final Player whoClicked = (Player) event.getWhoClicked();
        final String title = event.getView().getTitle();
        if (!(title.equalsIgnoreCase(whoClicked.getName() + "ลฝmogลพudลพiลณ gaudytojas"))) return;
        event.setCancelled(true);

this is the code

quaint mantle
#

really shouldnt compare titles

tender shard
#

I know that this is your code, and as I said, the title is probably incorrect

scarlet sun
#

ah

plain oracle
quaint mantle
#

?pdc

tender shard
#

your inventory is called ลฝmogลพudลพiลณ gaudytojas

scarlet sun
#

right

tender shard
#

however you check if the inventory is called "<playername> ลฝmogลพudลพiลณ gaudytojas"

quaint mantle
#

loop through the inventory until you find the snowball pdc, (optimizable)

tender shard
#

no, you shouldn't use titles to identify your inventory in the first place ๐Ÿ˜›

#

you should store your inventories in a set or map or similar

#

then you can check in the clickevent if yourSet.contains(inventory)

quaint mantle
#

or use reference == for more safety, i think that works

scarlet sun
#

some people say i should check inventories using titles ._. idk who to trust

scarlet sun
tender shard
quaint mantle
#

fr

#

?stash

undone axleBOT
tender shard
#

oh wait

#

no, CraftInventory implements equals like this:

#
    public boolean equals(Object obj) {
        return obj instanceof CraftInventory && ((CraftInventory)obj).inventory.equals(this.inventory);
    }
#

still, it's basically the same

tender shard
#

so yeah using equals() on an inventory will never compare the contents

#

so it's fine to use for this stuff I guess :3

scarlet sun
#

But what will happen if i will identify invetories using titles

#

Like, what are the security issues?

tender shard
#

you go to hell

quaint mantle
#

can confirm

tender shard
#

well it will work if done properly, BUT

quaint mantle
#

can be manipulated

#

for instance if another plugin allows custom GUIs

#

or renaming chests

#

is that a plugin? im finna do that

tender shard
#

lets assume you want to give your father 100โ‚ฌ but not to anyone else. now someone comes to you who has the same name as your father, and you give him 100โ‚ฌ.

obviously that's not what you wanted. you wanted to give 100โ‚ฌ to your father and not to some person who randomly had the same name

scarlet sun
#

ah, i get it

#

but if the server is using only like 2 plugins and they dont allow renaming chests or making custom guis

tender shard
#

yeah as said, it will probably work fine

#

it's bad practice nonetheless

#

simply do this:

#
final Set<Inventory> myGuiInventories = new HashSet<>();
#

everytime you open a custom GUI inv, add it to that set

#

everytime a player closes any inv, remove that inv from the set

#

now you can simply check if myGuiInventories.contains(event.getInventory())

hybrid spoke
#

or check the holder and let your custom inventory implement InventoryHolder

quaint mantle
#

no

tender shard
#

that's not supposed to be done

hybrid spoke
#

idc

quaint mantle
tender shard
#

although I have to admit, I also use custom inventory holders

tender shard
#

they only want to see "is this my custom inv"

hybrid spoke
#

its in the api so useable by us

tender shard
#

as said, I also abuse inventoryholders myself, but actually one should not do that

quaint mantle
tender shard
quaint mantle
#

oh aight

tender shard
#

one sec

tender shard
#

?jd

quaint mantle
tender shard
tender shard
#

The Bukkit API is designed to only be implemented by server software.

scarlet sun
#

Okay i did that and it works :D Thank you :P

tender shard
#

np ๐Ÿ™‚

hybrid spoke
#

so on own risk

tender shard
hybrid spoke
#

like everything in bukkit

tender shard
#

otherwise you'll have a memory leak

scarlet sun
#

ah okay

tender shard
#

you can simply do this:

#
@EventHandler
public void onInvClose(InventoryCloseEvent event) {
  mySet.remove(event.getInventory());
}
scarlet sun
#

did it

#

thank you

tender shard
#

np

scarlet sun
#

by the way, is there any way to check if player is holding the specific item and when he's not holding it - it will run command?

#

broken english but i hope you understand :D

quaint mantle
#

your english is perfectly understandable

#

just worded a little weirdly

quaint mantle
#

if the custom item can change, sometimes by config, you should use PDC

plain oracle
#

this bug in the Scoreboard idk why at all

              int Deaths12 = StatsAPI.getDeaths(p.getName());
              int Points12 = StatsAPI.getPoints(p.getName()); ```

```[22:23:55 WARN]: [FFA] Task #42 for FFA v1.5 generated an exception
java.lang.NullPointerException: Cannot invoke "org.bukkit.entity.Player.getName()" because "this.val$p" is null
        at Offender.Events.ScoreBoardListener$1.run(ScoreBoardListener.java:49) ~[?:?]```
plain oracle
#

what

#

ok how can i fix that ?

fickle helm
#

does anyone use Aikar's Annotation Command Framework (ACF)?

quaint mantle
#

you should use redlib by @waxen plinth

#

its better

fickle helm
#

I like ACF, the only problem is it's inflating my jar file by 325 kb. trying to figure out if that's expected or I'm doing something wrong

quaint mantle
#

325kb is nothing

#

you can use the minimizeJar setting in maven tho

fickle helm
#

I am

quaint mantle
#

oh jesus

fickle helm
#

it's a small plugin, 10kb without ACF, so it seems rediculous to add so much size just to ease the command programming

quaint mantle
#

sooooo dont use it

#

unless you manually modify ACF its not gonna get smaller

#

Can you please help me?
when i import org.bukkit.plugin.java.Javaplugin it says it cannot be resolved
even i did everything in the tutorial

#

heres the tutorial

tender shard
quaint mantle
#

i know

#

..

quaint mantle
#

then you dont have it as a dependency

tender shard
#

btw the tutorial is quite shitty. I would suggest that you get started with maven right now

quaint mantle
#

codedred :/

tender shard
#

you should definitely read this and use maven to handle your dependencies, instead of manually adding them

#

@quaint mantle

#

either maven or gradle, but definitely NOT like they do it in the video

quaint mantle
#

ok

manic delta
#

can i ask mongodb things here? ๐Ÿ’€ maybe someone knows

quaint mantle
#

yes

opal juniper
#

yeah

quaint mantle
#

anything development related

golden turret
#

how can i make the rayTrace ignore some blocks

#

like, i would like to ignore the barrier

manic delta
#

oh wait i just see there's a Updates.unset() method

#

maybe it works for it

rugged cargo
#

what does Player#getItemInMainHand return if there is no item?

manic delta
#

maybe air for sure, i will search 1sec

rugged cargo
#

its annoted with @NotNull so does that mean it will never return null?

#

air would indeed make sense

#

air seems to be what's used whenever there is "nothing"

manic delta
#

yea i think

#

there's nothing on api docs

rugged cargo
#

thats why i asked. :)

#

thanks though

waxen plinth
waxen plinth
#

It gives multiple options

#

You can shade RedCommands, which is quite small - 72kb unminimized

#

You can shade RedLib, 400kb, which includes RedCommands

#

Or you can put RedLib as a plugin dependency and not shade anything at all

rugged cargo
waxen plinth
#

And it's easier than acf to use

golden turret
#

how can i make a block not persistent, make he disappear when the server restarts

quaint mantle
#

save to map

#

just air

golden turret
#

so i would like not to see the blocks after the server crashes

quaint mantle
#

?

waxen plinth
#

Do you mean feature requests

#

You can do it on the spigot JIRA

golden turret
waxen plinth
quaint mantle
#

like are you following me here

golden turret
#

i dont want a config

quaint mantle
#

bro

golden turret
#

nor a database

quaint mantle
#

so stubborn for what

waxen plinth
#

Yeah why do you not want to do that

tender shard
#

imajine

#

2015/2016 quiz?

waxen plinth
#

If you really hate it that much you could use chunk pdc

quaint mantle
tender shard
#

:<

quaint mantle
#

working on a lite plugin

#

gonna make it extremely feature rich

#

for like the simplest thing ever

tender shard
#

for real, PDC is the best thing that was ever added to bukkit

quaint mantle
#

can pdc modify nbt

tender shard
#

of course

#

but

#

BUT

#

no "vanilla" nbt lol

#

PDC is like a "subsystem" of NBT

quaint mantle
#

wack asf

#

its like non-rooted phones

#

no point to it

tender shard
#

e.g. imagine you save "asd" inside the PDC usin g namespacedkey "chestsort:keyname", the whole NBT thing will look like this:

BukkitValues: {
  "chestsort:keyname": "asd"
}