#help-development

1 messages ยท Page 1734 of 1

tribal holly
#

not a reason to spam

quaint mantle
#

ok

#

but u got a awnser?

tribal holly
#

did i need to write thing inside the method ?

quaint mantle
#

cuz ive been wondering for 3 weeks now

opal juniper
#

so you need to define it

#

so like

#

it should be easy

tribal holly
#

i write the toBase64 of itemstack in it ?

quaint mantle
#

Yall got my awnser or no just say yes or no and if yes say the awnser pls,.

opal juniper
#

hang on

quaint mantle
#

You talking to me or the other guy?

opal juniper
#

other guy

quaint mantle
#

ok D:

opal juniper
# tribal holly i write the toBase64 of itemstack in it ?
    @Override
    public Map<String, Object> serialize() {
        Map<String, Object> data = new HashMap<>();
        data.put("item", item.serialize());
        data.put("price", price);
        data.put("shopKey", "IDK HOW TO DO THIS ONE");
        data.put("uuid", uuid);
        return data;
    }
tribal holly
#

don't realy understand the method, this one will be call when i call object output stream ? why serialize all variable ?

opal juniper
#

well i assumed that you needed all the data saved to file

#

so i serialized all fields

#

and yes

#

it gets called when you call the writeObject on the BukkitObjectOutputStream

tribal holly
#

okay kinda weird method but thanks i'll make some test with this

opal juniper
#

fyi the output wont be human readable

tribal holly
#

yep i know i only want a parser to load it when server restart

opal juniper
tribal holly
#

for persistant data through start/stop server

#

thanks again

tender shard
#

do you want to save an itemstack inside a PDC?

tribal holly
#

nop

tender shard
#

oh okay, haven't read the full conversation

tribal holly
#

np

tender shard
#

seems like the allatori dudes have to manually verify every purchase, smh. I already regret buying it lmao

#

at least I got a 40% discount lol

opal juniper
#

wtf

hasty fog
#

does spigot allow allatori?

opal juniper
#

why are you obfuscating

tender shard
hasty fog
#

wow that's so expensive

#

just accept the leaks

tender shard
#

e.g. synthetize fields is not allowed

tribal holly
#

your code will be never unique and original bro

jovial nymph
#

anyone got an got tutorial for opening an players inventory and updatedating it when moving items

tribal holly
slim kernel
#
int i = 0;
        for (UUID uuid : RegisterManager.getActivePlayers()) {
            inv.setItem(13 + i, getSkullWithPlayersElementName(uuid));
            i = i + 9;
        }

I am filling a vertical line with heads from Players. How can I clear the space I didnt need for heads?

jovial nymph
tribal holly
#

by coding it ๐Ÿ™‚

hasty fog
#

javadocs :)

jovial nymph
tender shard
#

let's not start a discussion about whether obfuscating is useful or not... I also don't like the idea but after all it's my work and I don't like the idea that everyone could just easily copy/paste the source

tribal holly
#
  1. open your ide
  2. Learn java
jovial nymph
tender shard
#

what's the problem exactly?

tribal holly
#

you tried not enough so

jovial nymph
hasty fog
#

Player.openInventory()

tribal holly
proud fiber
#

p u m p

tender shard
#

waterpump

#

can you show your config?

proud fiber
#

ye

quartz valve
#

How can I put a player in Spectator Mode without them being able to fly through walls?

tender shard
tribal holly
#

but in creative and invisible !

#

gamemod spec are client side not server side

tender shard
#

hm looks correct. did you properly save your config.yml file?

proud fiber
hasty fog
#

your code is your code

proud fiber
#

sorry

tender shard
quartz valve
#

I want to make a spectator mode for my game mode. But if a player places a block and the spectator is with him, that doesn't work.

tribal holly
hasty fog
#

stupid thing is that those leak websites ask money themselves for my work

quartz valve
hasty fog
#

and their buyers go to me for help

tender shard
tardy delta
#

does anyone knows if there is a way in intellij to replace all uses of a method to another method?

quaint mantle
#

How do i customize max enchant levels with enchant gui?
1.17.1

tribal holly
#

i agree this is internet

tender shard
#

someone once started to sell my FREE plugins lmao

hasty fog
#

lmaooo

#

only difference is that they charge 5 euros instead of 9

tender shard
#

then I messaged him and he was like "oooh sorry I didnt know it must not do that blabla"

hasty fog
#

but you get like the first version

tender shard
hasty fog
#

ahhhh that's so annoying

tender shard
#

then I added obfuscation etc and then it stopped lol

#

sooooo

#

I kinda think allatori does make sense, although of course it's not perfect

quartz valve
hasty fog
#

I just put the user in my code (doesn't even do anything) and they stopped

tender shard
#

yep I have that too of course ๐Ÿ™‚

#

%%__USER__%%

tribal holly
tender shard
#

although I have no idea what the NONCE is for

hasty fog
#

:)

#

I mean I don't mind if they leak it for free

#

I'm fine with a free version that I don't have to give support to

#

but asking money themselves just nooo

tender shard
#

well I kinda do mind. If they want to get it for free, they can ask me and I'll add them as buyer. What I don't want though is to lose control over who gets access for free

stone sinew
tender shard
tender shard
#

yeah true of course

hasty fog
#

if I get the standard my brother is sick just no

tender shard
stone sinew
hasty fog
#

or can I make a YT video in exchange for your plugin? bails

tender shard
#

oh yeah makes sense

#

like I just imagine

#

someone leaks a plugin with their spigot ID in it, that could have been faked. but a matching NONCE and USER ID probably cannot jus tbe faked

hasty fog
#

exactly

slim kernel
hasty fog
#

I don't have access to my own leak though since I would have to pay xD

stone sinew
tender shard
slim kernel
tender shard
hasty fog
#

if so do a for loop with all inv slots and check if it's empty

slim kernel
tender shard
#

IIRC getItem(int) returns Material.AIR instead of null, not sure though

#

soo check both, if the item is null or if it's type is AIR

hasty fog
#

just always null check when doing stuff with items

tardy delta
#

is there a real difference between for (object o : new object[] {...})
and Object[] objects = {...} for (object o : objects) {}?

eternal night
#

one more assign call

#

about it

tardy delta
#

mwoa

#

just do it then

eternal night
#

not much reason to do either

tender shard
#

quick question about custom enchantments

#
    @NotNull
    @Override
    public EnchantmentTarget getItemTarget() {
        return null;
    }
#

it must not return null, but... that enchantment should work for ALL items and EnchantmentTarget.ALL is deprecated

#

what should I do? D:

#

(In all my plugins I simply return null and it never caused any problems but I feel like this is wrong anyway lol)

river spear
tender shard
#

can you show your code that's causing this?

river spear
chrome ferry
#

only on 1.17.1

#

ah nvm i found out why

tender shard
chrome ferry
#

Not using NBT Tags

#

It was me using reflection

tender shard
#

hmm

chrome ferry
tender shard
#

can you post your code?

chrome ferry
#

only happens in 1.17.1

#

Me just aching the game profile, and using it later on

tender shard
#

what's "profileField"?

chrome ferry
tender shard
#

try to use latest spigot and not paper and see if the error still occurs

chrome ferry
#

okay

#

i was using purpur then switched to paper

tender shard
#

sometimes paper has strange bugs in certain versions

chrome ferry
#

oki

tender shard
#

e.g. in paper 310 Command#getPermissionMessage always returned null, took me hours to find the problem lol

#

sooo better check it using spigot before we spend ages trying to find the problem^^

chrome ferry
#

lmao

#

ok thankfully i had it already in build tools for 1.17.1

#

well i just realised i am using itemMeta, not skullmeta in my reflection

#

that could be why, maybe

tender shard
#

oh yeah

chrome ferry
#

doubt it though

tender shard
#

use getField instead getDeclareField

#

getDeclaredField only returns fields that are defined by that exact class

#

getField returns all fields that are declared by that specific subclass

#

or super classes etc

jovial nymph
#

hwo do i check if a player is banned?

chrome ferry
#

OfflinePlayer#isBanned

tender shard
#

I just checked my code again @chrome ferry , I'm using getDeclaredField on SkullMeta and it works fine in all versions

chrome ferry
#

okay thank u, one moment

tender shard
#

sooo either use SkullMeta, or use getField instead of getDeclaredField ๐Ÿ™‚

chrome ferry
#

damn my memory likes being eaten up today

#

nom nom

tender shard
#

lol

#

laughs in 32 GB

#

I did a very bad job at building this PC

#

I cannot upgrade to Windows 11 because of missing TPM >.<

tender shard
#

yeah I should have invested more into the mainboard

#

but I have no idea about building PCs sooo... I didnt know any better

tardy delta
#

Arbeit

tender shard
#

ARBEITSSPEICHER

#

yeah I know german is cursed

#

SPEICHERAUSLASTUNG

ancient plank
#

Ethernet

tender shard
#

yeah no idea why they didnt translate that

ancient plank
#

lmao

tender shard
#

it should be called NETZWERK

#

btw @ancient plank somce you're already here

#

is it possible to convert a paid resource on spigot to a free resource?

ancient plank
#

idk

tender shard
#

or does it require creating a new resource?

#

kkk

ancient plank
#

I don't use the forums

chrome ferry
#

can probably ask for it to be moved

tender shard
#

yeah I got some different answers from different people

#

and the forum staff haven't replied to my DMs ๐Ÿ˜„

hasty fog
#

or go for mcmmo setup both free and premium

tender shard
worn tundra
young knoll
#

You may want to check your bios

#

Pretty sure there are ways around it anyway

rough jay
#

Hi, how to get item from main hand?

tender shard
#

Player#getInventory#getItemInMainHand

#

or are you on 1.8?

rough jay
#

no i am 17

tender shard
#

and my purple is a bit lighter than yours

rough jay
#

hmm yeah, anyway thanks

tender shard
#

1.8 and earlier it's Player#getItemInHand, 1.9+ is what I wrote above

ivory sleet
#

lol

#

Almost the same pfp

tender shard
#

yeah but I promise it's not me lol

#

I'm myself

rough jay
#

be yourself man)

tender shard
#

๐Ÿ˜Ž

#

continues to be myself

fossil prawn
#

How would i call that class there?

barren nacelle
#

?pdc

fossil prawn
#

Well like i have a onCommand boolean right now but i cant use an playerinteractevent inside of it

#

so people told me to create an listener

#

but idk if my listener is good + how i should call that event (.Java class) inside of my boolean

chrome ferry
#

do you even know java

fossil prawn
#

yes

chrome ferry
#

do you know the naming conventions

tender shard
#

yeah your naming scheme is cursed

fossil prawn
#

owh ๐Ÿ˜‚

tender shard
fossil prawn
#

Ok so, i want to check if the player has right click on a chest + he is sneaking. Well et cetera the end conclusion is that it for now will log the location.

torn crescent
#

Hey,
I am trying to use the mojang mappings with the maven plugin.

I am getting the error Failed to create remapped artifact, project main artifact does not exist.
Any ideas?

slim kernel
#

anyone know If I want to set a Inventory slot to nothing should I use null or Material.AIR ?

chrome ferry
#

both work

slim kernel
#

thx

chrome ferry
#

you only have the jar in there

tender shard
tender shard
chrome ferry
tender shard
#

nope

chrome ferry
#

oh, i had to do that

tender shard
#

really? normally I'm using the obfuscated mappings but I once tried and the special sauce (lol) thing was enough to make it work

chrome ferry
#

lmfao yeah

#

i mean

#

i spent like 3 hours trying to do

#

i aint gonna touch it, if it works. it works

fossil prawn
chrome ferry
#

so why do you need the command?

torn crescent
tender shard
chrome ferry
#

i did lmao

#

i mean it works

tender shard
#

oh you are right, it indeed has a <configuration> thing that specifies the mappings file

torn crescent
chrome ferry
#

nvm dont listen to me

#

i did it wrong, but it still works for me

#

so eh

tender shard
#

but tbh I rather use the obfuscated mappings because otherwise it'll break on every update

#

doing it with the obfuscated mappings, I can just use reflection to use the correct fields / methods

young knoll
#

Except those will change

tender shard
#

that's why I use reflection

#

so I can decide on runtime whether "playerConnection" is called "a" or "c" or "blabla"

fossil prawn
#

how would i call the void then?

tender shard
#

you need an instance of your listener

#

to call non-static methods

#

but tbh

#

you don't even have any event in the left class

#

soooo

#

what would you call that method with, anyway?

eternal night
#

smaller field names mean smaller jars means speed ๐Ÿ™ƒ

torn crescent
tender shard
#

yes, the mojang mappings are

#

buuut

#

when you compile your plugin, they get translated back to the obfuscated mappings

#

and those of course change all the time

#

that basically means you have to compile a different .jar for every MC release

#

which is why I don't use them

torn crescent
#

Ah right, I am only using it for my network which got one MC-Version for every spigot server anyway so the mojang mappings are pretty damn yummy for me

tender shard
#

yep then you're lucky ๐Ÿ˜„

ancient plank
#

y u m m y

tender shard
#

delicous

ancient plank
#

delicious*

tender shard
#

I hate nexus. Why do I have to tell it the file extension of every file, like - why can't it just auto-detect it?! smh

torn crescent
#

I still didnt manage to get it working tho, might have something to do with my multi-module project?
Just created a fresh project to test this

tender shard
tender shard
ancient plank
#

๐Ÿคฎ the word nexus gives me ptsd

tender shard
ancient plank
#

no no for other reasons

torn crescent
tender shard
#

reFX nexus

#

?

ancient plank
#

a server I play on, like 6 years ago, had a professions system named Nexus. It was the buggiest thing in the world, because it was written by epople who weren't that good at coding in 2011.

tender shard
#

ooooh okay

#

I started with MC plugins in 2011 as well lol

ancient plank
#

like 100k+ lines of code for a system which was shrunk down to like 10-20k lines when the system was remade

tender shard
#

yeah some people think copy paste is a good idea when coding lol

obtuse crane
#

Hello good morning, how do I upload a plugin to the spigot page?

tender shard
#

You click on the upload button? lol

#

"Add Resource" top right

ancient plank
#

believe it or not there's an add-resource button on the forums :)

ancient plank
#

add that to the list of useless tutorials I should make

tender shard
#

๐Ÿ˜„

jovial nymph
#

how do i set an item in anvil inventory?

tender shard
#

use Inventory#setItem(int, ItemStack)

tribal sparrow
#

when you .getBlock().breakNaturally(); to a chest is it not meant to drop all the contents? or will i need to get the inventory contents and drop those items? Just asking too make sure that it's not meant to drop the contents

tender shard
#

nope, it isn't

#

you have to drop the things manually

tribal sparrow
#

alright, thank you

#

yeah thats fine, i just didnt want to accidently make a dupe thing

tender shard
#

you can just do sth like this:

#
Chest chest = event.getBlock().getState();
chest.getBlockInventory().forEach(itemStack -> chest.getWorld().dropItemNaturally(chest.getLocation(),itemStack));
tribal sparrow
#

i've got this

        for(ItemStack item : inventory.getContents()) {
            if(item == null || item.getType() == Material.AIR)
                continue;
            location.getWorld().dropItemNaturally(location, item);
        }
    }```
tender shard
#

yep that's basically the same

#

oh and yeah I forgot to null check in the example I sent

#

sooo yeah just use the code you just sent

tribal sparrow
#

thanks for your help

tender shard
#

np

jovial nymph
tender shard
#

can you show your code pls

jovial nymph
#

yes

tender shard
#

GUTEN TAG

#

show code pls

jovial nymph
#

!pastebin

tender shard
#

`paste

#

?paste

undone axleBOT
jovial nymph
tender shard
#

thaaaat should work fine

jovial nymph
#

but it doesnt

tender shard
#

it just doesn't show anything in the inv, right?

jovial nymph
#

yes its there but it is invisible

tender shard
#

how do you know that it's there when it's invisible?

jovial nymph
#

i have an onclick event and if i click the slot the event fires

tender shard
#

ah okay

#

can you DM me your full code?

jovial nymph
#

na sry i am not allowed

tender shard
#

hm okay let me check something quickly

#

I'll answer again in ~3mins

jovial nymph
#

ok

tender shard
#

oh yeah you're right, it also doesn't work for me

jovial nymph
#

hm

tender shard
#

strange

#

let me do some more tests

#

yeah it's really strange

#
package de.jeff_media.test;

import net.md_5.bungee.api.ChatColor;
import org.bukkit.Bukkit;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.block.Block;
import org.bukkit.block.Chest;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.block.BlockBreakEvent;
import org.bukkit.event.block.BlockPlaceEvent;
import org.bukkit.event.inventory.InventoryClickEvent;
import org.bukkit.event.inventory.InventoryType;
import org.bukkit.inventory.Inventory;
import org.bukkit.inventory.ItemStack;
import org.bukkit.plugin.java.JavaPlugin;
import org.jetbrains.annotations.NotNull;

import java.util.ArrayList;
import java.util.function.Consumer;

public class Test extends JavaPlugin implements Listener , CommandExecutor {

    @Override
    public void onEnable() {
        getCommand("test").setExecutor(this);
        getServer().getPluginManager().registerEvents(this, this);
    }

    @Override
    public boolean onCommand(@NotNull CommandSender commandSender, @NotNull Command command, @NotNull String s, @NotNull String[] strings) {
        openFakeAnvilInventory((Player) commandSender);
        return true;
    }

    private void openFakeAnvilInventory(Player commandSender) {
        Inventory anvilInv = Bukkit.createInventory(null, InventoryType.ANVIL);
        anvilInv.setItem(0,new ItemStack(Material.DIAMOND));
        commandSender.openInventory(anvilInv);
        commandSender.updateInventory();
    }

    @EventHandler
    public void onClick(InventoryClickEvent event) {
        System.out.println(event.getCurrentItem().toString());
    }
}
jovial nymph
#

and i can't find any solutuins online

tender shard
#

it SHOULD show an anvil inv with a diamond in the first slot

#

but it shows an empty inventory. however when clicking the first slot, I get a PacketProcessingError and kicks the player, but the console correctly tells me that I clicked on the diamond

#

very strange

#

sorry I don't have any idea either

jovial nymph
#

ok ty

tender shard
#

maybe open a post in the forum

#

it seems like the client simply ignores the anvil inventories, which kinda makes sense, because everytime you open an anvil in vanilla, it's empty

jovial nymph
#

ok

tender shard
#

does anyone know whether a new resource gets approved faster when it's NOT obfuscated?

arctic moth
#

anyone know why this code yeets the thing only like 1 block with barely any velocity?

for(int i = 0; i < plugin.getConfig().getInt("throwpower"); i++) {
                        fb.setVelocity(look.multiply(plugin.getConfig().getInt("throwpower") / 5).normalize());
                    }
#

bruh discord destroys indents

#

?paste

undone axleBOT
ancient plank
#

discord doesn't destroy my indents :)

arctic moth
#

lucky

#

btw is there a way to get the nearby chunks near a player?

#

lol

#

like as a list

jovial nymph
#

were do i open a thread on spigot

#

pls help i dont know where

tender shard
jovial nymph
#

found it

pastel stag
#

is there a shortcut way to blocktype.equals(Material.slab) to check if it's any of the 'slab' blocks

#

im not seeing any but just asking before i do it the long way and specify every possible slab block

stone sinew
echo basalt
stone sinew
echo basalt
#

EnumSet at that point

#

Still a String#contains call is quite fast

#

and it sounds like premature optimization

pastel stag
#

this is a temporary fix until i can address an underlying problem anyways

#

im adding exceptions that will be ignored by the plugin until i can address the proper way to handle them later on

tender shard
pastel stag
#

mostly blocks that don't act normally, change coordinates, or inhabit more than a single coordinate at a time

tender shard
#

if a computer cannot handle a few simple string comparisons you have a way bigger problem than your plugin

#

for example ChestSort sorts items by creating a string for every itemstack - never ever did I get a single report about ChestSort creating lags

obtuse crane
#

How do I get the source code of my plugin?

tender shard
#

you already have it

#

otherwise you couldnt compile your plugin

jovial nymph
#

@tender shard do you have any idea how i can find a solution for my anvil problem because forum threads need so long to be answered to?

pastel stag
#

it is better for performance to check for lets say .contains("DOOR") rather than specifying each Material door in a comparison list right

tender shard
#

does anyone whether obfuscating a plugin will slow down it's aproval process?

jovial nymph
#

ok ty

tender shard
obtuse crane
tender shard
#

comparing enums is very fast. comparing their names or checking whether it "contains" a certain string is still very fast, but a bit slower than directly checking the enums

pastel stag
#

so using .contains("DOOR") would be worse for performance than having it check if the object .equals every single door and trapdoor material individually

tender shard
#

but

#

don't worry about it at all

#

the difference is totally irrelevant

pastel stag
#

alright just making sure

tender shard
#

comparing strings is very very very fast. comparing the material directly would be a tiny tiny tiny tiny tiny bit faster

#

you really shouldnt care about the difference AT ALL

pastel stag
#

18 lines of code being faster than 1 just seems counter-intuitive but i get what you mean about the different methods to checking

tender shard
#

for strings, java has to check every character individually

#

sooo yeah, just because the source is longer, doesn't mean the execution takes more time as well

pastel stag
#

right

tender shard
#

but as I already said: you really do not have to care about this

#

just create a method like

obtuse crane
# tender shard ??

create the plugin in java, more specific in eclipse and export it to a .jar file, and I don't know how to get the source code or how do I get it?

tender shard
#
public static boolean isSlab(Material mat) { return mat.getName().endsWith("_SLAB"); }
tender shard
#

sooo

#

the source code is your eclipse project

jovial nymph
#

@tender shard do you know what UNSPECIFIC_META means?

tender shard
#

it's every ItemMeta that isn't a "specific" itemmeta

#

e.g.

pastel stag
#

@tender shard ill stick to what i'm doing currently only because the list of things im comparing is slowly going to get smaller as i implement the ways for the plugin to handle those block types im currently excluding w/ the comparison, but will keep doing that as a method in my head if i need to do this again in the future

#

thanks ๐Ÿ™‚

tender shard
#

a diamond pickaxe has Damageable itemmeta

jovial nymph
tender shard
#

a firework has FireworkMeta, etc...

#

and all other things have "Unspecific" itemmeta

#

like when you add a display name to a dirt block, you get an "unspecific" itemmeta

obtuse crane
tender shard
#

like imagine

pastel stag
#

im so confused

tender shard
#

you make a new eclipse project

#

and you save it in C:\Users\YourName\EclipseProjects\MyNewPlugin

#

then everything inside MyNewPlugin folder is your source code lol

tender shard
pastel stag
#

@obtuse crane you're asking what your source code is, it's the code that you wrote to make the plugin do the things it does

obtuse crane
tender shard
#

@vagrant stratus does approval for premium plugins take longer when the plugin's code is obfuscated? sry for ping but I really wonder lol

#

hatebin lol

tender shard
#

@obtuse crane Is your plugin your first java project?

#

like for real, I don't understand your question

#

the source code is EVERYTHING you typed into your IDE

#

source code = everything needed to make a .jar out of the things you wrote

#

like

#

it's self explanatory

#

EVERYTHING you did to get a .jar file is the source code

#

I really don't understand how you wrote a plugin without knowing what "source code" means lol

obtuse crane
arctic moth
#

anyone know why this isnt working?

@EventHandler
    public void onPlayerJoin(PlayerJoinEvent event) {
        new BukkitRunnable() {
            @Override
            public void run() {
                if(!event.getPlayer().isOnline()) {
                    this.cancel();
                }
                List<Block> blocks = getNearbyBlocks(event.getPlayer().getLocation(), plugin.getConfig().getInt("radius"));
                Random rand = new Random();
                Block block1 = blocks.get(rand.nextInt(blocks.size()));
                Block block2 = blocks.get(rand.nextInt(blocks.size()));
                block1.setType(block2.getBlockData().getMaterial());
                block2.setType(Material.AIR);
                System.out.println("Decayed");
            }
        }.runTaskTimer(plugin, plugin.getConfig().getInt("decaydelay"), plugin.getConfig().getInt("decaydelay"));
    }
hasty fog
#

you turn it into a jar

arctic moth
#

it doesnt get to the decayed part

hasty fog
#

it is already flooded with /spawn plugins

arctic moth
#

ig it thinks the player is offline but idk why

hasty fog
arctic moth
#

ye

#

i had it to 20 at first, then tried 40

#

still not working

hasty fog
#

hmm should be more then enough

tender shard
#

I literally have no idea what you're talking about

hasty fog
#

I think he thinks you have to put the code you wrote somewhere on the page and the page will export it for you or something

#

or he saw github links and thought it worked like that

tender shard
#

erm ok wtf

arctic moth
#

cant get this to work

arctic moth
jovial nymph
#

any one know how to create an anvil input gui without any other plugins?

torn crescent
pastel stag
#

@tender shard he might be asking what youre supposed to put in the 'source code' field on spigot plugin submission

#

.

jovial nymph
pastel stag
#

@obtuse crane if you are asking what to put here you are supposed to put a link to where your source-code can be found, usually a gitlab or github repo page, also it is not required and you don't have to include it.

#

and if thats not what you are asking then i really have no clue what you're asking w/ all due respect

obtuse crane
pastel stag
#

glad i could help

quaint mantle
arctic moth
#

?paste

undone axleBOT
regal moat
#

?paste

undone axleBOT
arctic moth
#

my code is

@Override
    public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
        if(label.equalsIgnoreCase("decayreload")) {
            if(sender.hasPermission("decay.reload")) {
                plugin.reloadConfig();
                sender.sendMessage(ChatColor.GREEN + "Config reloaded successfully");
            }
            else {
                sender.sendMessage(ChatColor.RED + "You do not have permission to use this command");
            }
            return true;
        }
        return false;
    }
#

anyone know what this error is

#

it says this.plugin is null

quaint mantle
#

Your plugin instance is null

arctic moth
#

but idk how to rlly fix that

#

lol

#

oh ik

#

i put the wrong text in getPlugin

hasty fog
arctic moth
#

lol

jovial nymph
#

@quaint mantle how? it just doesn't work?

arctic moth
#

?paste

undone axleBOT
arctic moth
#

https://paste.md-5.net/pideradeqi.cs
my code:

new BukkitRunnable() {
            @Override
            public void run() {
                for(Player player : Bukkit.getOnlinePlayers()) {
                    List<Block> blocks = getNearbyBlocks(player.getLocation(), instance.getConfig().getInt("radius"));
                    List<Block> airblocks = getNearbyAirBlocks(player.getLocation(), instance.getConfig().getInt("radius"));
                    Random rand = new Random();
                    Block block1 = airblocks.get(rand.nextInt(blocks.size()));
                    Block block2 = blocks.get(rand.nextInt(blocks.size()));
                    block1.setType(block2.getBlockData().getMaterial());
                    block2.setType(Material.AIR);
                }
            }
        }.runTaskTimer(instance, 20, instance.getConfig().getInt("decaydelay"));
#

for some reason it only happened when i set it to 1 tick

last ledge
hasty fog
arctic moth
#

k

#

like print it or if statements

hasty fog
arctic moth
#

ok

hasty fog
arctic moth
#

lol it just the error even though im printing

last ledge
arctic moth
#

@hasty fog why is my config messed up

#

is it something to do with my reload

#

its just plugin.reloadConfig()

hasty fog
hasty fog
last ledge
#

same error

#

again

hasty fog
#

hmmmm, hopefully someone else knows something

#

config

last ledge
#

ah someone help me

wide flicker
fading lake
#

is there a way of finding out why maven is excluding a jar from shade?

regal moat
#

Alright so, I am trying to ride a normally not rideable entity

#

A cow.

#

However, It doesn't work and I don't get any errors.

#

And also yes I have ProtocolLib in my plugins.

summer scroll
#

How can I fix the SQLITE_BUSY thingy?

fading lake
#

by not trying to manipulate it when it's busy ๐Ÿค”

fading lake
summer scroll
#

How can I keep track of that?

#

So only 1 connection will be opened, or just open the connection all time without closing it.

summer scroll
quaint mantle
#

To create a menu i need use all Map Javadoc?

ivory sleet
#

Wym?

fading lake
summer scroll
#

Should I store the connection to a field and reopened them every 5 minutes or so?

fading lake
summer scroll
#

Okay, so here's what I think right now.

#

Open a connection, store it on a field and do some things, and then when I want to do something with the database again, check if the connection that is stored on the field is closed or not, if closed open a new one, if not closed, use that again.

fading lake
#

Yes do that

#

you might want to make the getconnection method synchronized so it doesn't run multiple times on different threads possibly causing the same issue, up to you

summer scroll
fading lake
#

should be fine

summer scroll
#

If I do need the syncronized, where should I use it?

#

I never used it before.

ivory sleet
fading lake
#

I use it for stuff around that, not 100% sure if its needed, but it just forces methods to be run one at a time even with multiple accessing threads, its usually used when opening files, saving and closing etc

ivory sleet
#

yeah for quering and commanding the db it might be good to have it in case u manipulate mutable data models

#

though you'd only bootstrap the actual database on one thread I hope

summer scroll
#

Alright, thanks so much guys.

regal moat
#

How can I set yaw of an entity?

fading lake
#

LivingEntity#setYaw

fast cairn
#

How do you download spigot? Is there a tutorial?

ivory sleet
#

?bt

undone axleBOT
ivory sleet
#

send ur pom.xml

regal moat
ivory sleet
#

and btw Gradle

fading lake
#

and btw noooo

#

gradle seems too eh

fading lake
#

and are you sure its pathfindergoals/ai arent just resetting it

#

if its a brainy mob

ivory sleet
#

macho

#

which one isnt getting shaded

fading lake
#

oh sorry

ivory sleet
#

BoatyStuffAPI ๐Ÿ˜ฎ

fading lake
#

yes

regal moat
fading lake
#

discord shut up about threads istg

regal moat
#

I am getting the entity from PlayerInteractAtEntityEvent

fading lake
#

what entity are they interacting with?

regal moat
#

Cows, Skeletons, Bees. Any entity, I am trying to set the entity yaw to the players yaw when the player is riding the entity

fading lake
#

check if its an entity of LivingEntity, if so, cast it, then you can use .setYaw from the casted entity

regal moat
#

Right, It still doesn't have #setYaw().

#

I am on the latest version, 1.17.1

fading lake
#

WAIT

#

IM A FUCKING IDIOT

summer scroll
#

getLocation first maybe?

regal moat
#

ITS SET ROTATION

fading lake
#

.setYaw is part of getLocation

#

๐Ÿคฆโ€โ™‚๏ธ

regal moat
#

i tried getlocation too

summer scroll
#

iirc you also need to teleport the entity too after setting the yaw.

regal moat
#

teleporting and stuff

#

doesnt work

#

in my case

summer scroll
#

send code

regal moat
#

?paste

undone axleBOT
regal moat
fading lake
regal moat
summer scroll
#

oh something with packet, I don't know about that sorry.

regal moat
#

Uhh

ivory sleet
#

macho which one wasnt getting shaded?

fading lake
#

BoatyStuffAPI

ivory sleet
#

is it added to both compile time and runtime classpath?

fading lake
#

uhhhhhhhhhhhhhhhhh

#

wat

#

sorry what does that mean lol

ivory sleet
#

u use intellij right?

fading lake
#

yes

ivory sleet
#

check if its added both under compile time and runtime dependencies

#

you use the maven tab insread

fading lake
#

its there but its empty, then again, so is spigot so I dont think that matters, and gyazo just broke

ivory sleet
#

idm if its empty

#

is it both under compile time and runtime?

fading lake
#

I think seeing that is gradle specific

ivory sleet
#

maven does have that

fading lake
#

gyazo started working again ๐Ÿ˜Ž

ivory sleet
#

yeah

#

and it says provided there which would be equivalent to compile dependency

fading lake
#

oh, yeah boatyapi doesnt have that which is most probably the cause

ivory sleet
#

I think it should have scope compile?

fading lake
#

I put that on to test it but it didnt seem to do anything, lemme try again see if it changes anything

#

with that it still doesnt say provided ;-;

ivory sleet
#

well it shouldnt

fading lake
#

oh

ivory sleet
#

but I can tell u about runtime / compile dependencies if u want to have a further understanding

#

tho probably irrelevant

fading lake
#

if it helps fix the issue then sure

ivory sleet
#

but the classes of Boaty thing are present at compile time?

fading lake
#

yes

#

i.e I can package it yes

ivory sleet
#

and reference the classes at compile time?

fading lake
#

wdym

ivory sleet
#

like can u import them in ur source?

fading lake
#

yes

#

BoatyAPI has the main interface classes like DatabaseWorker, then the actual Boaty plugin has things that implement it

#

Like the Player interface to CraftPlayer

ivory sleet
#

yeah

#

well u wouldnt want to shade in the api?

#

if its another plugin

fading lake
#

Its not another plugin, its just something that holds objects and interacts with Boaty

ivory sleet
#

oh

#

just another module?

fading lake
#

Yeah essentially

ivory sleet
#

also for the maven shade plugin?

#

<include>com.machopiggies.boatystuffapi:*:*:*</include>

#

think it would only be com.machopiggies

#

since it includes a dependency right?

#

@fading lake

fading lake
#

wdym? I thought if I didn't put its package name in itd just shade everything lol

ivory sleet
#

idk but certainly the include tag takes a groupId, artifactId, version and snapshotVersion

#

similar to gradle

#

so you'd have to reference a dependency there, not a package afaik

#

but im nota maven expert so idk if this is case actually

fading lake
#

okay

#

so

#

I removed its identifier

#

and now its shading

ivory sleet
#

ah nice

fading lake
#

I feel like an idiot

#

thank you

ivory sleet
#

nw

#

learned something also so ty

fading lake
#

as did I, thanks <3

subtle folio
#

is there a way I can delete the drop that the player gets when they fish

fading lake
#

getCaught will return an Item in most cases

white thicket
#

Hey, so I want to add a way to make it so players can't use TAB to get list of commands but idk how exactly I am going to do that

fading lake
#

its not realllllllly possible since thats all dealt with on the client

night copper
#

theres an event i think for that

#

tab completion

#

idk

fading lake
#

you could cancel its packet, but idk how you'd do that

fading lake
night copper
#

probably yeah

white thicket
#

No, it is possible, there are plugins which does that

fading lake
#

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

white thicket
#

I am not allowed to decompile the plugin

#

They have no sourcecode provided either, that is actually a paid plugin but the free one doesn't support bungee

night copper
#

rules are made to break them

young knoll
#

Especially in the EU

fading lake
#

yes

white thicket
#

Who said that?

night copper
#

i did

white thicket
#

You should break this server's rules then

night copper
#

i don't feel like it

fading lake
white thicket
#

Sorry for the tag

night copper
#

If I had a reason to break them, like you do for learning how to do something, I would

fading lake
#

this random topic change is interesting

white thicket
#

I won't

#

Can anyone tell me how I can prevent players from using tab completion?

young knoll
#

No idea, something do with the command sync packet

#

Find an OS plugin that does it

white thicket
#

I already know a plugin which does it but I don't have access to their source code

fading lake
#

ctrl+f to find Tab-Complete (clientbound)

#

Tab-Complete (serverbound) may also be useful

#

client packet ids 0x11 and server packet 0x06 respectively

lavish hemlock
#

stop being such a pussy, nobody cares if you reverse engineer a plugin as nobody would know unless you said so

fading lake
#

thats

#

certainly an aggressive way of putting it

lavish hemlock
#

well it's dumb to be afraid of breaking arbitrary rules on a Minecraft plugin

white thicket
#

It is not called being of afraid of

#

Reputation is a thing which I am sure you don't have any

fading lake
#

the only way anybody'd find out is if you copied someone elses work line by line

white thicket
#

And you should be muted for what you said

lavish hemlock
#

lmao

fading lake
#

we could all just drop it and refer to the packet info I sent above

lavish hemlock
# white thicket Reputation is a thing which I am sure you don't have any

Also reputation can be both negative and positive, for me it's dependent on the person since some people are more assholes than others.
I'm just telling you to get off your ass and do it because nobody actually cares, besides, I've never given someone a list of the games I pirated back in the day, you don't need to announce that you decompiled something to learn a trick.
Knowledge should be unrestricted and free, so unless you can find a better way, learning from what others have learned is just plain better most of the time.

#

Anyway, that's all.

lost matrix
tardy delta
#

is a tabcomplete triggered when using console?

eternal oxide
#

yes

tardy delta
#

yikes

eternal oxide
#

and its horrible

tardy delta
#

why?

#

because it has no reason?

eternal oxide
#

selection in console is difficult

tardy delta
#

if you're just using cmd.exe there is no selection

tidal hollow
#

For a peaceful creature to attack you, would it be something like that?

     @EventHandler
        public void Custom(CreatureSpawnEvent e) {
            if (e.getEntityType().equals(EntityType.BEE)) {

                             Bee Animal = (Bee) e.getEntity();

                             Animal.setHealth(40);
                             Animal.setCustomNameVisible(true);
                             Animal.setCustomName(new ChatComponentText((ChatColor.GOLD +"Animal Hostil")));

                            public void initPathFinder() {
                                super.initPathfinder();
                                this.goalSelector.a(1, new PathfinderGoalNearestAttackableTarget<EntityHuman>(
                                        this, EntityHuman.class, true));
                                this.goalSelector.a(1, new PathfinderGoalNearestAttackableTarget<Animal>(
                                        this, Animal.class, false));
                                {
                                    }
                                }

            }
    

white thicket
opal juniper
#

why not?

lost matrix
gritty urchin
#

How to hide entity for specific player without ProtocolLib or other dependency?

lost matrix
#

Specifically: Listening to packets

gritty urchin
#

Tried sending entity destroy packet to player, doesn't work

lost matrix
quasi flint
#

Which is harder than using protocollib

opal juniper
#

the thing is with protocollib is that so many plugins use it that most servers will already have it installed

gritty urchin
#

cheers

opal juniper
#

there isnโ€™t a whole tonne of documentation so you may have to just look at other plugins

gritty urchin
#

What would be the packet to listen to?

#

@opal juniper

#

to hide an entity?

fierce jolt
#

Is there some kind of 'total amount of ticks' variable you can get from the server?

#

Trying to time some actions and ticks makes more sense then miliseconds

#

but don't feel like ticking down a single int each time

onyx fjord
#

is bukkittask deprecated?

#

@gritty urchinno packet wrapper = ๐Ÿ’€

#

you can shade packetevents for example

#

ez

worldly ingot
#

No BukkitTask is not deprecated

#

It's the preferred alternative

quartz valve
#

How can a player place blocks in a player?

tidal hollow
lost matrix
fierce jolt
#

The option with delaying bukkit tasks could lead to a chain of them and I am not willing to have that : $

young knoll
#

Use a timestamp

lost matrix
# fierce jolt The total amount of ticks is relevant in this case. I have an action queue and w...

Just do something like this then:

public class ServerTickTime {

  @Getter
  private static long current;
  private static boolean started = false;

  public static void start(final JavaPlugin plugin) {
    Preconditions.checkState(!started, "Cant start this task twice.");
    started = true;
    Bukkit.getScheduler().runTaskTimer(plugin, ServerTickTime::increment, 1, 1);
  }

  private static void increment() {
    current++;
  }

}
#
  @Override
  public void onEnable() {
    ServerTickTime.start(this);
  }

Later:

  long tick = ServerTickTime.getCurrent();
fierce jolt
#

Probably going to use something like that yeah. But I thought the time was stored somewhere already ๐Ÿ˜ฆ

fierce jolt
#

Kind of sad, such a usefull var

lost matrix
#

And i have done a LOT of stuff with scheduling

fierce jolt
#

Eh there are multiple way to schedule chains I guess hahaha

#

I just like the method of keeping the time since the last action

lost matrix
fierce jolt
#

Could probably do something with scheduleTaskLater() but that seems like more effort

fierce jolt
young knoll
#

You don't have to

#

I usually just compare timestamps

fierce jolt
#

Yeah but I need ticks specific now hahaha.
I am just going to store ticks in the already ticking task

dry forum
fierce jolt
#

You sure you have the right file in place?

dry forum
dry forum
#

where would i find that? and are there any documents or anything?

chrome beacon
#

Javadoc

#

Can help in a few min brb

chrome beacon
#

Also when doing edits with FAWE make sure to call things async or server will crash

chrome beacon
#

The newSession part

dry forum
#

i dont see a newSession part?

chrome beacon
chrome beacon
dry forum
chrome beacon
#

Oh and use getDataFolder instead of hard coding path

dry forum
#

its only for my server so i dont realy see why id need to do that

chrome beacon
#

Why not write better code when you can

dry forum
#

because its easier ยฏ_(ใƒ„)_/ยฏ

chrome beacon
#

Not really tbh

#

Anyway I used the WorldEdit dependency instead of FAWE in my POM

dry forum
#

but if i didnt have worldedit on my server and used FAWE would it work?

chrome beacon
#

FAWE contains the WorldEdit API

#

Just a bit outdated one

regal sigil
dry forum
#

do 3 ` things

dry forum
chrome beacon
#

Smth like that

regal sigil
#

can i ask sth

chrome beacon
regal sigil
#

sorry to interrupt btw but im close to finishing my project and this is the last problem

chrome beacon
#

Yeah just ask

regal sigil
#

import org.bukkit.plugin.java.JavaPlugin;
import me.Duckybrine.MobArmor.Listeners.listeners;


public class Main extends JavaPlugin {
    private static Main instance;
    
    public static Main getInstance{} {
        return instance;
    }
    
    @Override
    public void onEnable() {
        instance = this;
        
        getServer().getPluginManager().registerEvents(new listeners(), this);
        
    }
    
    @Override
    public void onDisable() {
        
        instance = null;
    }
    
}```
chrome beacon
#

?paste

undone axleBOT
chrome beacon
#

Put code here

regal sigil
#

ok

#

ok i pasted it now wut

dry forum
#

you send the link here

regal sigil
#

oh ok

arctic moth
#

rip something in my plugin crashed the server

chrome beacon
regal sigil
#

So i saved it and this link appeared in my search bar

paper viper
arctic moth
#

no

paper viper
#

Or running something on the main thread

#

You shouldnโ€™t be

#

Lol

arctic moth
#

?paste

undone axleBOT
arctic moth
#

i think its this

#

ever since i added the water thing it crashes the sevrer

chrome beacon
paper viper
#

You are running it on the main thread

#

XD

#

of course itโ€™s gonna stall it

#

You canโ€™t run stuff on the main thread

#

I meant like

#

You canโ€™t run stuff like forever loops on the main thread

#

Or like IO operations or database operations

arctic moth
#

well where else will it run

paper viper
#

Async

chrome beacon
#

while true :kekw:

regal sigil
#

link doesnt work

#

1 sec

arctic moth
#

u put {} and then {
}

#

@regal sigil

#

its () {
}

regal sigil
#

i just realized thats where i f'd up

arctic moth
#

lol

regal sigil
#

tysm

#

everything's workin now

chrome beacon
#

how did I miss that

regal sigil
#

ok ill export+post code to github so i dont lose it again

#

i had to code everything from the beginning bc of some error

#

and not just those 30 lines

arctic moth
paper viper
arctic moth
#

ye

#

the method isnt declared in it

#

but its only run in the runnable

paper viper
#

then send us full code

arctic moth
#

?paste

undone axleBOT
bitter ridge
#

Is EntityPickupItemEvent triggered on Inventory.addItem()?

arctic moth
paper viper
#

You are running it on the main thread

#

runTimerTask runs it on the main thread

arctic moth
#

o

#

how do u run it on a different thread

dry forum
arctic moth
paper viper
#

Dude why

arctic moth
#

lol

paper viper
#

Iโ€™m not gonna tell you cause of that

#

๐Ÿ˜…

#

Kidding

arctic moth
#

i replied to the wrong msg

paper viper
#

Use completablefuture or use runTaskTimeAsync or whatever

quaint mantle
#

Pulse is rude ๐Ÿ˜ 

paper viper
#

Yeah

dry forum
#

does getDataFolder just get "plugins/" or "plugins/<plugin-name>"

paper viper
#

Second

arctic moth
#

thx

arctic moth
arctic moth
prime reef
#

if a library is licensed under LGPL3, can I package it with a premium plugin?

arctic moth
paper viper
prime reef
#

I'm thinking yes, but I'm taking a second look over the conditions

arctic moth
#

lol

hasty fog
#

don't run bukkit api calls in async

worldly ingot
#

Asynchronous block remove!

arctic moth
# arctic moth

it was also spamming that it didnt shut down correctly

#

?

paper viper
#

Oh

chrome beacon
#

I do hope you removed the while true loop

paper viper
#

Yeah

chrome beacon
#

Also do things sync

paper viper
#

I didnโ€™t see that you were modifying the world lmfao

hasty fog
arctic moth
#

lol

paper viper
#

Remove the while true loop

arctic moth
#

but what do i put instead

#

return null or smth

chrome beacon
#

?

hasty fog
#

if you want to loop a lot (with a break) just run a for loop with like i < 1000

paper viper
#

??

worldly ingot
#

The issue isn't that it's sync or async. That task should be sync. That is fine

#

It's that you have a while (true) in there that never completes

paper viper
#

Itโ€™s being ran on a whole true loop

#

Yeah

arctic moth
#

lol

dry forum
worldly ingot
#

Just bear in mind that async != faster. Just means you're not going to halt the main thread if something takes too long. Getting random blocks in a world around a player is not going to take long whatsoever. Your issue is the while loop not having a termination clause

#

Yes you return if some condition is met, but what if it's not met?

#

What if the player is falling from a high place and now all blocks around them are air?

chrome beacon
jovial nymph
#

I am trying to use gson in my plugin but for some reason the gson library doesnt is the same as in my other projects and it asks me to decompile .class file. any ideas what to do?

dry forum
worldly ingot
#

NPE on edit session init. That's probably caused by the fact that "world" doesn't exist

#

Though even if it did exist, you'll get a ClassCastException because you can't cast from org.bukkit.world.World to com.sk89q.worldedit.world.World

paper viper
#

(Paper)

#

But yeah

dry forum
#

yeah i realised that, i fixed that, but im still getting an error from line 48 which is try (EditSession editSession = WorldEdit.getInstance().getEditSessionFactory().getEditSession((World) p.getWorld(), -1)) {

worldly ingot
#

That's probably caused by the fact that "world" doesn't exist

#

Oh you edited it

#

mb

chrome beacon
#

You need to use the BukkitAdapter instead of casting

worldly ingot
paper viper
#

Yeah you canโ€™t cast to World

#

It uses its own World wrapper

dry forum
#

which is (com.sk89q.worldedit.world.World) ?

worldly ingot
#

WorldEdit's got some methods to convert Bukkit worlds to WorldEdit's World wrappers

#

Actually, WE has a simpler way to get an edit session as well

#

WorldEdit.getInstance().newEditSession(world)

dry forum
#

well i tried ``` try (EditSession editSession = WorldEdit.getInstance().getEditSessionFactory().getEditSession((com.sk89q.worldedit.world.World) p.getWorld(), -1)) {

#

ah

chrome beacon
worldly ingot
#

oic

dry forum
#

whcih im doing

#

but im using FAWE on my server

chrome beacon
#

I know

arctic moth
#

?paste

undone axleBOT
chrome beacon
arctic moth
#

so something like that?

dry forum
#

wdym by bukkitadapter?

quiet ice
#

it's a class

#

com.sk89q.worldedit.bukkit.BukkitAdapter

chrome beacon
quiet ice
#

Usage would be

var weWorld = BukkitAdapter.adapt(bukkitWorld);
dry forum
#

it works ๐Ÿ˜„ tysm

golden turret
#

how could the input be null?

paper viper
#

Damn itโ€™s not like it already tells you

#

Lol

#

But perhaps if itโ€™s empty message?

golden turret
#

and how the player could send an empty message?

paper viper
#

Not sure. You may want to look in the source code to check

golden turret
#

sad

ivory sleet
paper viper
#

Bukkit not null checking be like

#

xD