#help-development

1 messages ยท Page 1636 of 1

tardy delta
#

goh

#

i've done it too much

full spruce
#

then what should i use?

tardy delta
#

creating random instances and let them dissapear

#

hey start with the event.getServer.spawnEntiry or something

full spruce
#

๐Ÿ˜ตโ€๐Ÿ’ซ

tardy delta
#

you'll find it

hybrid spoke
#

never work with them if you do not need an own seed or an own instance per thread since using the same random instance for multiple threads can lead to some issues to your performance

full spruce
#

paste where?

#

public static void onPlayerItemConsumeEvent(PlayerItemConsumeEvent event) {
Player player = event.getPlayer();

    event.getPlayer().getWorld().spawnEntity(event.getPlayer().getLocation(), EntityType.values()[new Random().nextInt(EntityType.values().length)]);
    EntityType.values()[ThreadLocalRandom.current().nextInt(EntityType.values().length-1];
#

this is the thing so far

quaint mantle
#

code blocks, for the love of god

full spruce
#

๐Ÿ˜ตโ€๐Ÿ’ซ

quaint mantle
#

dont just paste code without formatting, its ugly as hell

full spruce
#

?paste

undone axleBOT
quaint mantle
#

sure, that works 2

full spruce
#

now will that work?

#

i cant run

#

getting error down

#

near 1

#

what to do

#

what to type

#

what to add

#

what to subtract

narrow furnace
#

u set player to event.getPlayer

#

then u didnt use it

hasty prawn
#

Wait wtf EntityType isn't an Enum

#

so values() doesn't exist

narrow furnace
#

...

#

welp

#

scrap that

#

u need to make an arraylist and add mobs to it then

#

like u had before

full spruce
#

what to do ๐Ÿ˜ตโ€๐Ÿ’ซ

full spruce
narrow furnace
#

is it still there

regal moat
#

@hybrid spoke it doesnt give out NPE now but it doesnt work at at all.

hybrid spoke
full spruce
#

see

hardy swan
#

It definitely is

hybrid spoke
full spruce
#

the code isnt working

#

what to do now

hasty prawn
#

Oh nvm it is, IntelliJ imported the wrong one sus

full spruce
#

?

hybrid spoke
#

imagine not using notepad++

narrow furnace
#

@full spruce we're basically writing the plugin for you at this point

regal moat
hybrid spoke
hybrid spoke
regal moat
#

so

#

yeah

hybrid spoke
#

not sure if the event is called AFTER used

eternal oxide
#

if its cancellable, its before

hybrid spoke
#

yeah

regal moat
#

Nope. It's not

hybrid spoke
#

it is

#

so its before

full spruce
#

this plugin took me forever

tardy delta
#

already solved?

full spruce
#

no

#

and i dont think so

#

at this point I literaly tried to delete everything

regal moat
#

Huh. I didn't notice that.

#

If it's before. and I do have the item.

#

What's wrong?

full spruce
#

thanks to Control+Z

hardy swan
#

Bruh wtf JavaPlugin has a getPlugin method, I'm today years old.

tardy delta
#

pff java event.getServer().spawnENtity(event.getPlayer().getLocation(), EntityType.values()[new Random().nextInt(EntityType.values().length -1)])

#

here we go

#

huh what does control Z do?

narrow furnace
#

thats

#

a very long line

regal moat
tardy delta
#

thats not

#

you wanna see long lines?

full spruce
#

?paste

undone axleBOT
full spruce
#

check it out

#

is it ok?

#

or need to change something

tardy delta
#

and replace event.getPlayer in my method with player

narrow furnace
#

um

hardy swan
#

Whats the try and see link

tardy delta
#

and put it in the {}

narrow furnace
#

whys it outside the brackets

tardy delta
#

?tryandsee

#

whoa

full spruce
#

Player player = {Player}

#

this?

tardy delta
#

lmao

#

Player player = event.getplayer and in my code replace the event.getplayer with player

#

smh

#

you already got it

#

you understand?

full spruce
#

mine is correct?

tardy delta
#

๐Ÿ˜–

#
public class FirstEvents implements Listener {
    @EventHandler
    public static void onPlayerItemConsumeEvent(PlayerItemConsumeEvent event) {
        Player player = event.getPlayer();
        player.getWorld().spawnEntity(player.getLocation(), EntityType.values()[new Random().nextInt(EntityType.values().length - 1)]);
    }```
full spruce
#

?paste

undone axleBOT
tardy delta
#

if the event is ran for another time the random will be created again no?

full spruce
#

if this is not correct then

#

i am going to uninstall mc

quaint mantle
#

what packet do I need to send to light an nms entity on fire?

tardy delta
quaint mantle
full spruce
tardy delta
#

which ide are you using?

full spruce
#

intelli

#

j

#

IDEA

tardy delta
#

you know what a parameter is?

full spruce
#

umm

#

no

#

is there somewthing wrong in the code again?

quaint mantle
narrow furnace
#

onPlayerJoin(Player p)

#

Player p is the parameter

tardy delta
#

if you see that the spawn method accepts two parameters

quaint mantle
#

?learnjava

undone axleBOT
narrow furnace
#

parameters != arguments

tardy delta
#

:/

#

i use the same names

torn shuttle
#

anyone who has dealt with double chests before know if there's any specific reason why this code wouldn't empty double chests correctly?

        if (blockState instanceof Container)
            ((Container) blockState).getInventory().setContents(new ItemStack[0]);

I'm trying to deal with chest destruction but this consistently only seems to scan half of a double chest

full spruce
#

will this work

#

or not

narrow furnace
#

try it

#

and see

full spruce
#

ok

full spruce
#

i use to learn spigot months back

torn shuttle
#

does each half of a double chest contain its own built-in inventory or smth?

tardy delta
#

:/

quaint mantle
#

getBlockInventory returns that half

#

getInventory gets the full inventory

full spruce
full spruce
tardy delta
#

whoa

#

run a command in config?

torn shuttle
tardy delta
#

you didnt even make a command

#

you made a listener

narrow furnace
#

you're asking very basic questions

tardy delta
#

which listens for a player eating

narrow furnace
#

it would help a lot to learn java first

tardy delta
#

^^

quaint mantle
#

^^

narrow furnace
#

trying to learn spigot before learning java is like trying to drive before learning to open the car door

torn shuttle
#
        if (blockState instanceof Container)
            if (blockState instanceof Chest)
                ((Chest) blockState).getBlockInventory().setContents(new ItemStack[0]);
            else
                ((Container) blockState).getInventory().setContents(new ItemStack[0]);

yeah the fact blockInventory exists already gives me hope

tardy delta
#

i'm feeling bored and i want hugs

#

๐Ÿฅบ

torn shuttle
#

weird that not every container would have a blockinventory though

quaint mantle
#

[][]
^
block inventory

full spruce
#

?paste

undone axleBOT
torn shuttle
#

I do want the one block... I'm pretty sure, let me test real quick

quaint mantle
#

yeah it works then

regal moat
quaint mantle
#

chest is the only container that supports two blocks

full spruce
#

cant select my main class in add config

tardy delta
full spruce
#

๐Ÿ˜ตโ€๐Ÿ’ซ

narrow furnace
#

go

torn shuttle
#

yeah I get that but at the same time that makes every other inventory block-sized lol

narrow furnace
#

learn

#

java

#

please

#

i beg

full spruce
#

i

#

used

#

to

#

lear

#

it

#

months

narrow furnace
#

you

full spruce
#

back

narrow furnace
#

failed.

dusk flicker
#

can you not spam this channel thanks

full spruce
#

but

quaint mantle
narrow furnace
#

you did not learn java

#

or if you did, you forgot it by now

dusk flicker
#

theres this amazing thing called an edit button

narrow furnace
#

because you clearly dont know it

torn shuttle
#

guys did you know the space bar is a thing on every single keyboard on earth?

full spruce
tardy delta
quaint mantle
#

https://www.youtube.com/watch?v=dem7dujCDvg&list=PLfu_Bpi_zcDNEKmR82hnbv9UxQ16nUBF7&index=3
@full spruce
nobody wants to code your plugin for you over the course of 2 hours

In this episode, I show you how to create your first plugin using the Spigot API and the Minecraft plugin for the IntelliJ IDEA. #Spigot #SpigotPlugin #MCCoding

Spigot: https://www.spigotmc.org
Code: https://gitlab.com/kody-simpson/spigot/your-first-plugin

โญ Kite is a free AI-powered coding assistant that will help you code faster and smarter....

โ–ถ Play video
narrow furnace
#

^^^^^^^^^^^^^^^

#

please go away

torn shuttle
#

@quaint mantle yep that straight up worked instantly, thanks for the hot tip

narrow furnace
#

the plugin you want is about 10 lines and its taking hours

wheat schooner
#

and learn java before you start making minecraft plugins

#

?learnjava

undone axleBOT
full spruce
#

guess what i think i watched too many tuts i will start again

narrow furnace
full spruce
#

from begining

torn shuttle
#

I still think yt tutorials are the worst for learning programming

#

docs just feel way better

narrow furnace
#

same unless its for something specific

full spruce
#

i dont like reading too much

narrow furnace
#

if you want to learn programming in general a course is better

full spruce
#

video are easy too understand

narrow furnace
#

but you still dont understand...

torn shuttle
#

@full spruce then maybe you shouldn't do something that is primarily working with text for hundreds or thousands of hours on end

narrow furnace
#

lmao

full spruce
#

i havent watched yet

narrow furnace
#

you could have watched it 5 times in the time you've spent writing these 3 lines of bad code

full spruce
#

but

#

I asked what should i write

#

nvm

#

I am going to watch

torn shuttle
#

the only time I get anything out of video tutorials is when explaining mathematical concepts visually for stuff like quaternion explanations or shader math

quaint mantle
#

docs and google is better

full spruce
#

i will talk to you tommoriow

narrow furnace
#

okay

quaint mantle
#

i hate reading but its better for programming concepts

torn shuttle
#

shader tutorials are actually pretty lit

full spruce
#

?learnjava

undone axleBOT
torn shuttle
#

there's some dark magic going on there

full spruce
#

here we go again

torn shuttle
#

I still don't know why journey used sphere tracing for rendering though

tardy delta
#

๐Ÿ‘€

#

i still want hugs

quaint mantle
#

google it

tardy delta
quaint mantle
#

I did

#

e.e

#

the ones for 1.13 obviously don't work

#

did you try them

#

yes I did

#

or I would not be asking here

#

search through protocollib

#

thry have docs right

torn shuttle
#

oh wow there's actually a gdc talk about sand rendering in journey, today is my lucky day

quaint mantle
#

I guess I will do that

hybrid spoke
#

you can learn java WITH spigot

tardy delta
#

true

#

but some basics

#

are needed

hardy swan
#

learning java with spigot is more of an extra step taken. it is probably easier to compile .class files individually and play with editors instead of IDEs.

tardy delta
#

lets play with BlueJ

hardy swan
#

No

#

jshell

tardy delta
#

how can i write a new root uhh key to my yml file?

hardy swan
#

Yml file configuration structure is determined by indentation

#

So a new root would be of indent 0

tardy delta
#

yes

#

so how do i make one?

last citrus
#

How would I make the player move forward 15 blocks?

tardy delta
#

does set creates one?

hardy swan
#

Oh you mean create through the plugin

hardy swan
tardy delta
#

yes okay

last citrus
#

Is there a way to smoothly move the player forward 15 blocks?

hardy swan
#

Teleporting considered smooth?

last citrus
#

I want to make it look like that is eases into moving and then eases into stop moving

echo basalt
tardy delta
#

and can i write an array or a hashset to the config file?

last citrus
tardy delta
#

is there a kind of list like where i can store my uuids inside and use a get method that accepts an uuid that could be there as parameter?

gloomy mulch
#

So I made a code that whenever I execute the particular command it spawns a prime_tnt. And that tnt can actually push the player away from it. Can anyone help me with that please?

tardy delta
#

doesnt it push the player?

gloomy mulch
#

And a way to reduce the damage of it

tardy delta
#

uhh maybe with nms

gloomy mulch
tardy delta
#

uhh not the bukkit part of the code but the minecraft part

echo basalt
#

Just set the velocity yourself

#

to spawn an entity, World#spawnEntity(Location, EntityType) or World#spawnEntity(Location, Class<T>) (where T extends entity, and will be returned)

Example

Zombie zombie = world.spawnEntity(location, Zombie.class);
#

To modify explosion power, cancel the entityexplodeevent and call World#createExplosion or whatever the method was

tardy delta
#

๐Ÿ‘€

echo basalt
#

I don't reuse variables, return statements or dependency injection

#

In terms of quality, it's horrible

#

But it can help with what you need

gloomy mulch
#

Thank you for the help

swift dust
#

why can't I import GameProfile?

eternal night
#

because game profile is not part of the API ?

swift dust
#

oh

#

and how can i get it?

eternal night
#

either by depending directly on the server (spigot-api -> spigot) or by adding the mojang library that defines GameProfile

lusty cipher
#

or you use paper

eternal night
#

which still doesn't get you GameProfile

#

just their API for it

tardy delta
#

whats the best way of making cooldown for commands?

eternal night
#

Map<UUID, Long> ?

tardy delta
#

yea i have that

lusty cipher
tardy delta
#

and check in the onCommand if someone has cooldown or somthing

eternal night
#

at least not on the interface

#

else the entire point of that API would be useless

lusty cipher
#

oh right yes that func was removed

#

well still

#

you can use it instead of GameProfile as other funcs support it instead

#

and you dont have to use nms -> gud

eternal night
#

Yes, but you are vibing in the spigot discord here

#

and such API does not exist

#

so /shrug

lusty cipher
tardy delta
#

ok

south onyx
#

is it possible to make my plugin download a world i made, and if so, how?

regal moat
#

whats the difference between Player#getBedSpawnLocation and Player#getBedLocation

#

help

#

i also cant teleport my player

#

for some reason

#

it wont work

eternal night
#

getBedSpawnLocation would return exactly where a player would spawn while getBedLocation simply returns the spawn location

#

e.g. the first method takes blocks obstructing the spawn into account

regal moat
#

?paste

undone axleBOT
regal moat
#

so why wont

#

spigot teleport my player

#

it prints out haha

#

but wont teleport player

#

help

regal moat
#

@narrow furnace

#

what

#

people

#

just help me

pulsar zenith
#

just teleport him to his bed location?

regal moat
#

yeah i am trying to

#

do that

#

i cant

#

though

pulsar zenith
#

p.teleport(player.getBedLocation());

regal moat
#

Yeah

#

i did that

#

it wont work

pulsar zenith
#

output the location of his bedlocation

regal moat
#

did you read my code

pulsar zenith
#

it may be null or something

regal moat
#

v

pulsar zenith
#

yes

regal moat
#

SO I AM DOING THAT

#

I AM DOING Player#teleport()

pulsar zenith
#

see where he is getting teleported

regal moat
#

i am not

#

getting

#

teleported

quaint mantle
#

What resources should I look into if I want to code my own bi-directional socket implementations into my plugin so I can communicate to a Node.js server.

regal moat
#

..

pulsar zenith
#

im testing ur code rn

tough venture
#

How can i sell ranks on a bungee cord server with tebex like he can get a rank in all different server

pulsar zenith
#

set up luckperms to work on all of your servers

#

have tebex set the required permissions on purchase

#

boom done

tough venture
#

But there are luckperms for each server individually how do I connect them

pulsar zenith
#

a database

tough venture
#

And also to bungee cord

pulsar zenith
pulsar zenith
tough venture
#

How do it ?
IDK how use database

pulsar zenith
regal moat
# pulsar zenith

alright i removed that. now it gives out the coords of the bed and tries to teleport

#

it doesnt work

tough venture
#

Thanks,
But maybe there is a video?

pulsar zenith
regal moat
#

oops

#

tryinna ping a friend in dm. computer lagged

#

srry

#

@pulsar zenith so?

true perch
#

When storing objects in MySQL do you have to write separate methods which stores the member variables accordingly within columns, or is there a solid universal get/set for any objects for MySQL?

ivory sleet
#

I mean sql

pulsar zenith
ivory sleet
#

but yes thereโ€™s a set thing and a get thing

#

Not like Mongo tho

true perch
#

How would I go about getting it?

ivory sleet
true perch
#

incorporated into the plugin

#

thank you

ivory sleet
#

Just read on that (:

regal moat
ivory sleet
#

Yea you will have to, to a certain extent

undone axleBOT
ivory sleet
#

?scheduling

regal moat
#

i already

#

know how to use

#

the scheduler

ivory sleet
#

ok good for you

regal moat
#
BukkitScheduler scheduler = Bukkit.getScheduler();
scheduler.runTaskLater(main, () -> {
  p.teleport(spawnLoc);
}, 1L);
#

is this correct?

ivory sleet
#

Mye

regal moat
#

Yeep

#

seems to work

ivory sleet
#

Pog

pulsar zenith
#

poggers

regal moat
#

and i need to just add a custom texture and an item flag

#

i have done all of that

#

thanks y'all

ebon siren
#

is there a way to 'append' or 'set' custom fields/data to an object? for example, on a command it would add a String variable called CustomEffect and add that to the 'custom user data' to a sword and i could add effects or lore to that based off of the custom effect field

left lodge
#

i'm trying to make my own vote listener for NuVotifier, but maven can't seem to resolve the dependency (it is copied directly from their wiki). is anyone able to help? i'm posting here because they don't offer support

chrome beacon
left lodge
#

yeah, it's jitpack

ebon siren
little trail
#

ok so i compiled buildtools to spigot-1.17.jar, where does this go ive not used maven before

eternal night
#

Well that's your server jar

little trail
#

apparently i add it to buildpath

eternal night
#

If you want to depend on it just depend on the normal spigot-api dependency

little trail
#

where is that in vscode

eternal night
#

But replace spigot-api with spigot

#

You are using maven / gradle right ?

little trail
#

maven yes

eternal night
#

Yea then replace spigot-api with spigot

#

And you should be good

little trail
#

it seems to be in the java projects tab in Maven Dependencies tho

eternal night
#

Replace it in your pom file

little trail
#

im not following sorry

#

cant send screenshots here either

#

C:\Users\olive\.m2\repository\org\spigotmc\spigot-api\1.17-R0.1-SNAPSHOT\spigot-api-1.17-R0.1-SNAPSHOT.jar is in my Maven Dependencies already so do i even need the spigot jar

#

because ive got The import org.junit cannot be resolved

eternal night
#

That is the api

#

In your projects pom file

#

You have a dependency

#

With the artifact ID spigot-api

#

Change that to spigot

#

And then you can use server internals

little trail
#

lmao yeah im stupid

#

tysm

ivory sleet
#

Download the world to the world folder

#

Then unzip if needed

#

And load (:

short shale
#

how can i do to verify if args[0] is a GameMode or an Integer?

hazy igloo
short shale
#

hmm, ok

#

i will try it

#

thx ๐Ÿ˜Ž

viscid wharf
#

Hi. I have some problem with ProtocolLib. I have created a plugin that listens on PacketType.Play.Server.ENTITY_METADATA, but when process
new WrapperPlayServerEntityMetadata(packet.deepClone()); it sometimes throw RuntimeException. So I'm finding any method else that allow me to clone the packet, just for not to edit the real entity?

proud basin
#

How do vectors work?

ivory sleet
#

Has a direction determined on the fields x, y and z, and by that we can also get the magnitude of the vector

exotic kraken
vast sapphire
chrome beacon
#

Send the error

vast sapphire
chrome beacon
#

It tells you what's wrong

#

And you send the wrong class

vast sapphire
#

the gen command is in that class

chrome beacon
#

That's not where the error is comming from

vast sapphire
#

oh it's the array

#

that's throwing it

chrome beacon
#

?conventions oh and I recommend to follow these

undone axleBOT
grim ice
#

its not recommend

#

its you should

chrome beacon
#

True

chrome beacon
#

ActionbarAPI is accessing a method that doesn't exist 1.16

#

I recommend using the built in api

vast sapphire
#

nothing is storing in the config either

chrome beacon
#

Add some debug messages

exotic kraken
#

ty

crude charm
vast sapphire
#

did I do this wrong?

chrome beacon
#

Well does the code run

vast sapphire
#

yes

#

no errors

whole stag
#

I'd be willing to say that this instance variable is related to a good deal of the errors

eternal oxide
whole stag
#

You're playing way too fast and loose with static members and methods for one thing

vast sapphire
#

ok I initalized it and I get items

#

config looks like this however ```yaml
locations: {}

#

and items only spawn at one location

whole stag
#

yeah...

eternal oxide
#

As is yoru hash storage in your command, only ever one location per block type

whole stag
#
protected static Generators instance;
public static List<Location> activeLocations = new ArrayList<>();

What's the static doing here?

hollow bluff
#

I looked at creating multiple versions of a plugin with maven but every time I create the module, I can't actually create java files in it? I guess I'm doing it wrong

vague oracle
#

Aren't they not modules?

quaint mantle
#

why wont my fucjing thing qoekr

#

i tryu register event

#

and it say cant find

#

class

#

and its fuckign tyhrte

#

hELp me

eternal oxide
#

OH No, do it right scrub

quaint mantle
#

ee look]]\

#

right fucking there

eternal oxide
#

show its import

hollow bluff
vague oracle
#

The blue box means it a module i think

quaint mantle
#

it no fucking worok

#

y

hollow bluff
eternal oxide
#

is dev.bunk.absence.modules.stuff your package?

quaint mantle
#

ye

#

for the

#

tp logger

eternal oxide
#

and its a part of the current project?

quaint mantle
#

yes

#

it used to work

eternal oxide
#

intelij?

quaint mantle
#

then i updated pc and

#

reopen intellij

#

and it say this

vague oracle
eternal oxide
#

invalidate cache, the restart

quaint mantle
#

Oki

ivory sleet
quaint mantle
#

done

#

smel

#

@eternal oxide it worked

#

thx

graceful turret
#

huys is there a way to hide book's author and 'orginal/copy' text?

crude charm
#

there is a cheat evil

graceful turret
#

cheat?

graceful turret
#

which one bro

crude charm
#

or what I was gonna say

#

enchant a book

graceful turret
#

hide attributes only hides autgor

graceful turret
crude charm
#

no

#

Material.BOOK

set enchanted

#

then hide enchants

stone sinew
warm galleon
#

My custom craft doesnt have the enchantment on it
Im making a custom item with a custom enchantment

i printed the meta in console and it said theres the enchantment before i registered the recipe BUT when i craft it it has no enchantment (the rest of the meta works)

#
public class Recipes {
    public static void loadRecipes(Plugin plugin) {
        ItemStack wand = new ItemStack(Material.BLAZE_ROD);
        wand.addUnsafeEnchantment(CustomEnchants.WAND_ENCHANTMENT, 1);
        ItemMeta wandMeta = wand.getItemMeta();
        wandMeta.setDisplayName(ChatColor.DARK_RED + "Wand");

        wand.setItemMeta(wandMeta);

        ShapedRecipe wandRecipe = new ShapedRecipe(new NamespacedKey(plugin, "wand_craft"), wand).shape(" ! ", " @ ", " @ ")
                .setIngredient('!', Material.COAL)
                .setIngredient('@', Material.STICK);
//2nd craft
        ItemStack fireSpell = new ItemStack(Material.BOOK);
        fireSpell.addUnsafeEnchantment(CustomEnchants.FIRESPELL_ENCHANTMENT, 1);
        ItemMeta fireSpellMeta = fireSpell.getItemMeta();
        fireSpellMeta.setDisplayName(ChatColor.DARK_RED + "Fire Spell");

        fireSpell.setItemMeta(fireSpellMeta);

        ShapedRecipe fireSpellRecipe = new ShapedRecipe(new NamespacedKey(plugin, "firespell_craft"), fireSpell).shape(" ! ", " @ ", " ! ")
                .setIngredient('!', Material.FLINT)
                .setIngredient('@', Material.BOOK);

        plugin.getServer().addRecipe(wandRecipe);
        plugin.getServer().addRecipe(fireSpellRecipe);
    }
}
regal anchor
#

I don't know how to turn off combos (sweep attack) I tried to install OldCombatMechanics there's still combos

#

I looked the github and tried his way it in fact doesn't work (damagecause)

torn shuttle
#

I have found a new strategy when providing plugin support

#

as it turns out if I copy paste my reply and keep pasting it people will unironically only actually read it starting from the second time I paste it

native nexus
#

Nice nice ๐Ÿ‘

unreal quartz
#

i also have a strategy for providing plugin support

#

it's called the 'ignore their message and don't reply' strategy

pulsar zenith
#

Hey, so I am having a problem with JDBC. So whenever I try to store information to my database it works fine. But afterwards, whenever I try to retrive that same information, it returns 0. But the weird part is, that if I run it again, then it returns the correct information from my database. Anyone have any ideas why? My methods to retrive that info : https://hastebin.com/nusaniyeme.php

#

It also happens whenever I start my server also.

regal anchor
#

maybe timeout

#

that would explain why requesting a second time works

#

I had timeout issues, I use hikaricp now and it's better

pulsar zenith
#

ok

#

ill look into it, thanks

regal anchor
digital plinth
#

is there a way i can periodically perform a method
but i want to chanegt he delay based on a condition

stone sinew
#

Gonna have to do it the cheat way and create a written book item and just open a custom book gui when clicked.

fluid cypress
#

if i have this config

something1:
  something2:
    something3: true
  something22:
  ...

can i do config.getBoolean("something1.something2.something3")? or do i have to get each config section first

unreal quartz
#

yes

fluid cypress
#

will it throw an error somehow? or if anything doesnt exists, it will return null?

#

like, if the config doesnt even have the something1 part

eternal oxide
#

then it will return false

fluid cypress
#

mmm

#

what about get or getString or any nullable type

eternal oxide
#

null

fluid cypress
#

good

#

thanks

quaint mantle
#

potato

#

any1 wanna spoon feed me

#

i couldnโ€™t be ducked doing it myself

dusty herald
quaint mantle
#

k

dusty herald
quaint mantle
#

worked

#

thx

vital ridge
#

Maybe not the right place to ask but if somebody has knowledge on forge minecraft then:
Im trying to run my 1.12.2 forge mc in eclipse but Im getting this error:
https://paste.md-5.net/bedufajoso.bash
Could someone help me out?

#

Thanks.

#

They dont give out 1.12.2 support xd..

wise mesa
#

is there a way to get the translation key of a potion effect?

#

or do I need to put an if else for every potion effect?

#

I would like to do something like this but I would do new TranslatableComponent with the potion effects translation key

wary harness
#

@vital ridge update to latest

#

Leave those older versions let them be dead

quaint mantle
#

how to give out experience? giveExp() does not work

ivory sleet
#

@pulsar zenith please link discords in DMs and not here

wary harness
#

@quaint mantle setTotalExpiriance

quaint mantle
#

no

wary harness
#

Bit u will need to calculate

#

Proper amount of xp which player has

quaint mantle
#

ะฐ ะผะพะถะฝะพ ะบะฐะบั‚ะพ ะธัะฟะพะปัŒะทะพะฒะฐั‚ัŒ give?

#

is it possible to use give somehow?

wary harness
#

No

#

Calculate amount what player has then use + your amount

#

And set it like i told u

quaint mantle
#

and how can this be done?

wary harness
#

Look in my beastwithdraw plugin on spigot

#

U can decompile it and look in to thecode

#

U can find example in essentialx source code same thing

#

Do a bit of digging

#

It is simple

quaint mantle
#

BeastWithdraw (Multy withdraw) 2.9.6

#

is that him?

wary harness
#

That is it

quaint mantle
#

thanks

undone axleBOT
full spruce
#

?learnjava

tepid monolith
#

I'm trying to register every block place event in my bedwars server but when the server lags for a second, the block disappears and the player falls into void and teleports back up. is there any way for the server to run some code once that event (block place event) has failed registering?

tepid monolith
#

i know but im trying to ask of there's a specific solution for it to realize once an event has failed registering

full spruce
#

?

#

?paste

undone axleBOT
full spruce
#

?learnjava

lost matrix
#

Im writing an API to make multiblock objects movable and am now standing before the problem of rotating this 3d Matrix of falling blocks around a pivot point. Could someone give me a hint on how to cheaply apply a rotation matrix for a given axis and pivot point?

#

I need to figure out the position + rotation of the block for a certain rotation around a point.

full spruce
#

can you make custom blocks in spigot?

lost matrix
#

No. Yes. Kind of.

#

But no

full spruce
#

wdym

#

Like fabric?

#

or forge

lost matrix
#

You can replace existing blocks models and textures with a resourcepack.

full spruce
lost matrix
#

Nope. Minecraft doesnt allow that.

full spruce
#

what

#

I made one in fabric

lost matrix
#

Yes but the client has to download the mod manually. You can not distribute such data to the client.

quaint mantle
#

Hello

#

i have a question , how do i can keep the special item on player death

full spruce
#

hi

quaint mantle
#

like i have a DIAMOND_AXE i want to keep it on player inventory on death

#

and drop other items

full spruce
#

keep ineventory

#

lol

quaint mantle
#

no

full spruce
#

ik

quaint mantle
#

keep inventory will keep all items

#

xd

wheat schooner
#

that keeps all

full spruce
#

I know

opal juniper
#

but i would be no help lmao

lost matrix
quaint mantle
#
  List<ItemStack> toRemove = new ArrayList<>();
        for (ItemStack i : e.getDrops()) {
          if (i != null && i.hasItemMeta() && i.getType().equals(Material.DIAMOND_AXE) && i.getItemMeta().hasEnchants() && i.getItemMeta().hasDisplayName() && i.getItemMeta().hasLore())
            toRemove.add(i); 
        } 
        for (ItemStack i : toRemove) {
          for (int a = 1; a < 110; a++)
            e.getDrops().remove(i); 
        } ```
#

i tried that

#

but not works

lost matrix
#

Then add it to a Map<UUID, List<ItemStack>> and give it back to him in the PlayerSpawnEvent

lost matrix
lost matrix
lost matrix
# quaint mantle ```java List<ItemStack> toRemove = new ArrayList<>(); for (ItemStack i...

This would be my take on it.

  private final Map<UUID, List<ItemStack>> playerRespawnContent = new HashMap<>();
  private final Predicate<ItemStack> itemFilterForKeeping;

  @EventHandler
  public void onDeath(PlayerDeathEvent event) {
    Iterator<ItemStack> itemIterator = event.getDrops().iterator();
    UUID playerID = event.getEntity().getUniqueId();
    List<ItemStack> respawnList = playerRespawnContent.computeIfAbsent(playerID, key -> new ArrayList<>());
    while (itemIterator.hasNext()) {
      ItemStack next = itemIterator.next();
      if (itemFilterForKeeping.test(next)) {
        itemIterator.remove();
        respawnList.add(next);
      }
    }
  }

  @EventHandler
  public void onRespawn(PlayerRespawnEvent event) {
    UUID playerID = event.getPlayer().getUniqueId();
    Inventory playerInv = event.getPlayer().getInventory();
    playerRespawnContent.remove(playerID).forEach(playerInv::addItem);
  }
quaint mantle
#

okay bro i will try it

#

thank you so much btw โค๏ธ

lost matrix
#

java.util
But if you have never worked with predicates before you should just write a method that takes an ItemStack and returns a boolean to check if the item should be kept.

severe marsh
#

How do I remove default lore from potions?

lost matrix
#

You can substitute like that if you want to:

  private final Predicate<ItemStack> itemFilterForKeeping = this::shouldBeKept;

  private boolean shouldBeKept(ItemStack itemStack) {
    if (itemStack == null) {
      return false;
    }
    return itemStack.getType() == Material.DIAMOND_AXE;
  }
onyx fjord
#

is there a way to cancel opening social gui? (p)?

lost matrix
lost matrix
lost matrix
severe marsh
#

Thanks

quaint mantle
#

dude you are really the best @lost matrix

#

much thansk respect โค๏ธ @lost matrix

#

last question does i can save item durability when player respawn ? @lost matrix

lost matrix
#

The code above should maintain the durability of the ItemStack when a player respawns.

quaint mantle
#

not it's doesn't xd @lost matrix

lost matrix
#

So the item gets repaired?

quaint mantle
#

yes sir

lost matrix
#

Uhm... makes no sense to me.
First try rewriting this line: respawnList.add(next); -> respawnList.add(next.clone());
If that doesnt work then check the durability within the if block and print it:

      if (itemFilterForKeeping.test(next)) {
        itemIterator.remove();
        respawnList.add(next);
        // <- Check durability here and print it
      }
quaint mantle
#

okay sir thanks

dreamy scarab
#

how can I increase size of mobs
or players?

lost matrix
dreamy scarab
#

in plugins also?

dreamy scarab
plain scroll
#

what does this mean?

dreamy scarab
lost matrix
#

Probably a forge or fabric mod

dreamy scarab
#

uhmm

#

really?

lost matrix
dreamy scarab
#

oo

plain scroll
#

in that else statement how can i send a message to the user ( that has no perm ) ?

lost matrix
#

And pls refrain from using single character variables like e or p

plain scroll
#

like this

plain scroll
lost matrix
#

Yes. And pls refactor 'p' to 'player' ^^

plain scroll
#

mhm ill change it all when i have time

#

does IJ have a quick ver change lol

lost matrix
#

Yes. Right click variable -> refactor

plain scroll
#

ahhhh ty

#

also that all works lol so thanks for that!

lost matrix
#

Its for a server that wants elevators, trains ships airplanes etc. So it all has to be packet based and scalable -.-

opal juniper
#

oh no lmao

#

packet based just adds 100 x more things to go wrong

#

if they are falling blocks do they have hit boxes?

#

ie can you even stand on them

lost matrix
#

Nope. The MovableObject has 2 states. Physical and virtual. When it gets virtualized then all entities within its boundingbox get mounted on a armorstand with a predefined position (If all positions are occupied then the entity just gets thrown out)
and then moved alongside the falling blocks.

opal juniper
#

ah ok that makes sense

lost matrix
#

Hop into train -> get seated -> wait till it stands still -> everything goes back to being a block -> you get unseated

quaint mantle
#

Hey everyone,
I get the compiling error: java package com.Zrips.CMI.Modules.Economy does not exist
Even tho I added the CMI.jar to the Dependecies list

rigid otter
#

How can I store a persistent data in a block?

lost matrix
opal juniper
#

^

#

if not

#

redlib has a persistent block data api

rigid otter
quaint mantle
#

Hey everyone,
I get the compiling error: java package com.Zrips.CMI.Modules.Economy does not exist
Even tho I added the CMI.jar to the Dependecies list

opal juniper
#

does rely on a lib plugin though

plain scroll
#

errrr so im trying to print a string here,

#

but i "cant get config"

opal juniper
#

are you in a class that extends JavaPlugin

#

if not you need your plugin instance

plain scroll
#

oh yea im using it in a extended class

#

well the command class

opal juniper
#

well if it is the command class it isnโ€™t your main

#

therefore you need your plugin instance

#

either by having a static field in your main or passing it through the constructor

quaint mantle
plain scroll
#

so do i just add tha?

#

that*

opal juniper
#

myeah

#

or do it one of the ways i said

quaint mantle
#

In the command class ofc

lost matrix
#

Ew. Just looked at redlib. It literally executes sql statements on the main thread. Thats one way to make your server lag...

plain scroll
#

privarte8

grim ice
#

why

#

i always use e for events

lost matrix
plain scroll
#

im guessing this is wrong lol

grim ice
#

wtf

#

what the

plain scroll
#

lmao

grim ice
#

uh umm

opal juniper
grim ice
#

do you know Dependancy injection

#

or do i help you

lost matrix
#

If you follow clean code principles then single character variables are only acceptable if the variable is used in not more than 3 consecutive lines.

opal juniper
plain scroll
grim ice
#

ok so

#

first

#

make a field

#

at the top of your class

#

for example

#

MyMainClass plugin;

#

then make a constructor for it

#

and done

#

if you have intellIj you can just do the first step then go to the tool bar at the top and click code

#

then click generate

quaint mantle
grim ice
#

then click constructor

#

and select urmainclasshere:plugin

#

and click ok

plain scroll
#

was so like...

grim ice
#

itll automatically do it

grim ice
#

to write that tho

#

this Main.getPlugin is all useless

plain scroll
#

ahh kk

grim ice
#

who told you to do tha

#

t

#

wait

#

did u just copy paste MyMainClass plugin;

#

bruh

plain scroll
#

no

grim ice
#

replace MyMainClass with ur class name

#

ur main class name

plain scroll
#

ight so like this?

grim ice
#

no

plain scroll
#

ohhhh

#

i get u

grim ice
#

BanGuiCommand is not your main class

plain scroll
#

kk i have it

grim ice
#

Okay

plain scroll
#

so like thi s

#

^^ thats my main class

grim ice
#

now make a constructor, do you know how to do it?

grim ice
plain scroll
#

ok ok

grim ice
#

where do you have that field?

plain scroll
plain scroll
grim ice
#

show me

plain scroll
grim ice
#

bruh

#

why do you have it at the imports section

#

you're not supposed to touch that

plain scroll
#

ik but its under it? does it need to be under the public class

grim ice
#

yes ofc

plain scroll
#

so like thi s

grim ice
#

youre not supposed to write anything above your class

#

no

#

above your @Override

plain scroll
#

ahhhh

#

ok ok

#

i made the constructor

grim ice
#

I don't see

#

the field

plain scroll
grim ice
#

oh god

#

the constructors should always be under the fields

#

got it?

plain scroll
#

ok so when i make a constructor it auto does that

grim ice
#

your code should look like this:

Duke plugin;
public BanGuiCommand(Duke plugin){
this.plugin = plugin;
}```
#

also

#

did you learn java

plain scroll
plain scroll
grim ice
plain scroll
#

i do about 6hours a week

#

learning java

grim ice
#

now you can

plain scroll
#

im 2 weeks in

grim ice
#

use plugin

#

for example

#

plugin.getConfig()

#

I've seen an error in your class

#

1s

grim ice
plain scroll
#

yea

grim ice
#

you dont do getConfig

#

use plugin.getConfig()

plain scroll
#

TYSM!

grim ice
#

:D

plain scroll
#

haha when i try and build i get this

#

this is new

grim ice
#

wait

plain scroll
#

'BanGUICommand(bangui.me.duke.Me.Duke)' in 'bangui.me.duke.Me.commands.BanGUICommand' cannot be applied to '()'

#

this line

#

in my main class

grim ice
#

yeah

#

click ctrl and p

#

i wont spoonfeed ;)

#

you need params there

plain scroll
wheat schooner
#

pass this as an argument

grim ice
#

@wheat schooner bruh

#

why did u spoonfeed

#

he has to figure it out himself or he wont learn

plain scroll
#

nvm

#

i found it

grim ice
#

Okay

plain scroll
#

look

#

IJ tells u lol

grim ice
#

ye

#

Also

#

learn implicit else

plain scroll
#

ill check my rota now

grim ice
#

using else is bad most of the time

plain scroll
#

i think its on there

grim ice
#

lemme give you an example

plain scroll
#

oop-

#

i get an error now

#

nvm

#

nvm

#

i found it

grim ice
#

if(!player.hasPermission("owo.uwu"){
player.sendMessage("man u dont have owo.uwu");
player.setHealth(0);
}
player.doSomething;

humble stag
#

can i add custom blocks in plugins

grim ice
#

you can use resource packs though

humble stag
#

ah ok

grim ice
#

to make them almost same as mods

#

1s

#

ill send u a tutorial

humble stag
#

ok ty

grim ice
#

Wooo! Custom textures finally :) Since this is my first custom textures video, I made it pretty simple. There is definitely a lot we can do with textures as well as multiple ways to apply it to a player but first, we need to learn the basics. In this video, I explain how a texture pack works, how we make our own, and finally how to apply it to a...

โ–ถ Play video
plain scroll
grim ice
humble stag
grim ice
#

use ChatColors btw @plain scroll

#

to make it fancy

#

for example

plain scroll
grim ice
#

player.sendMessage(ChatColor.RED + "You do not have the required permission");

#

oh ok

plain scroll
#

lol

#

this is my like 5th plugin i think

#

just never done confinging

grim ice
#

btw

#

remember the code i explained to you

humble stag
grim ice
#

it's called Dependancy Injection

grim ice
#

but why do you need a plugin for that

#

or do you want to create a whole new block?

#

You would have to make the block yourself and make it spawn randomly

humble stag
#

you can craft the wood

grim ice
#

oo

#

this is a shapedrecipe example

humble stag
#

ty

hardy swan
#

hello all

grim ice
#

rip ur boost

hardy swan
#

my 1-month free trial ended

#

kek

true perch
#

With a large sized SQL database consisting of 9,000+ rows, is there a more efficient way to get information from the database than SELECT * FROM Column? Assuming the server will be doing 500+ calls per minute?

onyx shale
#

9k is nothing for a sql

#

you can go in millions and the performance wont rly be affected

true perch
#

Damn! Thanks for the information! So would doing SELECT * FROM Column on a database this size over 1,000 times a second would be no problem?

onyx shale
#

shouldnt rly be any problem

#

however why so many

true perch
#

I just wanted to make sure, in the most extreme cases

true perch
# onyx shale however why so many

Players will be making roughly 50 calls per GUI page they open, and if the server is popular enough to have 50 people all looking through pages at the same time, could cause quite a lot of calls at once.

onyx shale
#

still

#

why select *

#

just filter the data based on something

#

like the player guid

true perch
#

I'm sorry, just new to SQL ๐Ÿ˜… didn't know that existed

onyx shale
#

its more of the server memory at this point

#

rather than the database speed

#

yes sql has advanced filters

#

like select * from guiitems where playerguid = '..'

#

basically mkaing life easyer

#

but i guess youll find more once you start working with it

#

and see the querys are rather simple

true perch
#

Yeah I am very interested in making it as smooth as possible

#

You mentioned filtering the data based on something, that will make it more efficient?

onyx shale
#

yes

#

well for once you wont have thousands of useless data

#

loaded

twilit rivet
#

Error: Cannot resolve method 'registerEvent(java.lang.String, com.monoto.customcrops.events.CustomCropEvent)' java public CustomCropEvent(CustomCrops plugin) { plugin.getServer().getPluginManager().registerEvent("onRightClick", this); } Does this not work? I'm trying to call it with new CustomCropEvent(this);

young knoll
#

registerEventS

onyx shale
#

thats.. a rather weird way to register a event tho

twilit rivet
#

I tried doing it based off my command register

young knoll
#

Yeah it takes an instance of the listener class and an instance of your main class

twilit rivet
#

I don't know any better ways of doing it

young knoll
#

No idea where you got a string from

twilit rivet
#

nah, the string was there bc I was confused why it wasn't working

true perch
#

I have a little project I'm working on, and I'm interested in getting help with the design of it. I'm new to SQL, and I don't know what would be the best way to do this efficiently.

The main table called Cards would have 9,000+ rows. Each row would be: ID of the card, Name of card, strength of card, etc.

I was thinking of making sure each card in the database is sorted based on the ID value of each card (1 to 9,000). Maybe I could use a SQL equivalent of a binary search to get the specific info I need instead of select * from?

Players would open a GUI to see which cards they own. I was thinking a design could be simply a unique table for each player. Each row in a player's unique table would consist of: ID of card, and quantity of card the player owns. I was thinking if a player wanted to sort their pile of cards, they would simply re-arrange their unique SQL table of their owned cards.

onyx shale
#

well a row must have a identifier

#

wich is usually the ID(either as guid or number(identity))

true perch
#

oh so storing the ID within the table is irrelevant?

#

not 100% sure what the G in guid stands for.

#

I was thinking the UID of each card is simply a number from 1 to 9000

twilit rivet
#

Now I get this... 'onRightClick(org.bukkit.event.player.PlayerInteractEvent)' in 'com.monoto.customcrops.events.CustomCropEvent' cannot be applied to '()' I literally have the event method listed underneath

#

I mean, what would I put in the field... I'm just trying to figure another way of registering events instead of slapping long lines in main, or is that okay?

hardy swan
#

if so, why the need for the parameter

#

if not, why this in the second argument of #registerEvent(s)

grim ice
#

1s

#
public CustomCropEvent(CustomCrops plugin) {
    getServer().getPluginManager().registerEvents(new CustomCropEvent(this), this);
}```
#

or just do it in ur main class

#

oh also

#

the code i sent u alone

#

will not work

#

its rly dumb to do it in an other class

#

just do it in ur main

#

or make a method in ur other class

#

then do ThatClass.ThatMethod

#

ez

tardy delta
#

i read that runnables for cooldowns are not the best ideas..

#

is there something better?

hardy swan
#

Why not

#

You are scheduling a task, you will definitely need a runnable

#

Or some type of lazily evaluated expression

#

Unless you meant cool-down for a specific Material for a specific player, then there is already a spigot implementation