#help-development

1 messages · Page 116 of 1

quaint mantle
#

Lunar client has a mod that removes it

#

there should be some mod somewhere to be found

#

but it cannot be done by the server solely

vital sandal
#

It is custom font with empty char

chrome beacon
#

That would require replacing all the numbers

#

or making the entire scoreboard a texture

#

and simply not using the vanilla one

dawn plover
#

hey, simple question, how would i run a task every tick
i know its posible with a scedular

BukkitScheduler scheduler = Bukkit.getScheduler();
        scheduler.runTaskTimer(this, task -> {
            if (!Bukkit.getOnlinePlayers().isEmpty()) {
                everyTick();
                }
            }, 0L, 1L);
``` But isn't there just an method or event that does this ?
chrome beacon
#

Just use the scheduler and create your own tick method

#

Like you did above

dawn plover
#

oh aha, okay. i thought it would be a bit inconvenient, but it works obviusly

#

thnx

chrome beacon
#

If you mean the internet, yes you can

young knoll
#

You can remove that red number with core shaders

#

And the background

#

Example from some smart people

#

I assume you can only do one or the other as well

chrome beacon
#

Ah shaders

#

Nice

agile anvil
#

you can also do it with resource packs

chrome beacon
#

Shaders are part of the resourcepack??

agile anvil
#

nop

#

but now you can edit almost everything, i don't know how it's possible but i saw some guys succeed with just rp

eternal night
#

pretty certain shaders are part of resource packs these days

#

idk which version added the ability to include GLSL code in there

#

but it was a rather recent one

agile anvil
#

Worth for prison servers

#

mine 5B blocks before leaving

agile anvil
#

Just don't allow offline mode it's even more frustrating

#

just firewall your backend servers

#

then there is no way to join offline

#

yeah

#

but they're safe

#

just ignore it lmao

agile anvil
#

IPs are not saved so you'll have to write your own

#

but why ?

#

IPs are in most cases not static

#

so it's kinda useless

#

I recommend to disable it asap ^^

#

and if you host something, create another network

#

what's your ISP ?

#

I'm 90% sure you can disable it

#

you'll have to search your account parameters

#

you're an easy target for hackers but it's ok

visual tide
#

it makes you more trackable from an adventisers perspective, but nothing really worse than that

#

unless you make someone mad on irc

ivory sleet
#

?ban @urban kernel

undone axleBOT
#

Done. That felt good.

cobalt thorn
#

Hi im trying build the plugin with another method for obfuscating and it said missing class org.bukkit.potion.PotionData

i imported spigot-api builded from Buildtools 1.8.8

visual tide
#

or did i miss some messages after that

ivory sleet
#

Yes, they promoted illegal sites in principle

#

And they didnt really behave well in chat

visual tide
#

👍

#

we need reaction reactions so we can make chains

#

@discord get on it

ivory sleet
#

🥲

quaint mantle
#
 ChatColor.DARK_GRAY + "Edition: #" + (plugin.editionNumber++),

like for example if this lore shows #1

in the chat the message shows as #2 and not as #1

player.sendMessage(ChatColor.RED + ((Player)sender).getName() + " §egave you a§e §cDctr's Space Helmet§c " + ChatColor.GOLD + "#" + (plugin.editionNumber++) + ChatColor.GOLD + "!");
drowsy helm
#

you are incrementing editionNumber

quaint mantle
#

not go up

drowsy helm
#

you're doing it twice

#

so it will go up

quaint mantle
#

the lore number and the message number should be the same

drowsy helm
#

you are doing plugin.editionNumber++

#

twice

#

that will increment it

#

just store it as a local variable

quaint mantle
#

what

#

how

drowsy helm
#
int editionNumber = plugin.editionNumber++;
item.lore(editionNumber);
player.sendMessage(editionNumber);
quaint mantle
#

no no

#

I tried

#

that

drowsy helm
#

show your code

quaint mantle
drowsy helm
#

just send the code here

quaint mantle
#

We track these errors automatically, but if the problem persists feel free to contact us. In the meantime, try refreshing.

drowsy helm
#

huh

quaint mantle
#

idk

drowsy helm
#

which class is it

quaint mantle
#

github sow

#

DctrSpaceHelmCMD

#

oh yea I forgot gib push

#

1m

#

?paste

undone axleBOT
quaint mantle
#

@drowsy helm

#

hello??

agile anvil
#

editionNumber++ increment editionNumber by one each time you call it

agile anvil
#

do you even know what you are doing ?

#

or what you want to do ?

quaint mantle
#

bro I literally said what I wanted to do

#

and YES I TRIED BOTH

#

THE editionNumber like the dude with the anime dude said

agile anvil
#

are you ok in your life ?

#

then why do you add "++" after it?

quaint mantle
#

wait 1m

granite owl
#

got a question tho its more a theoretical thing than actual code yet

couldnt i make custom blockbench models, apply it via custom model data and put it correctly centered onto the mobs head to give it a new appearence. and when i want it to say attack, i make a 2nd model thats having the attack animation, set the custom model data of the head item to X and after the attack is done i reset it to its default state?

#

same for hurt animation etc

quaint mantle
#

hey the second just use plugin.editionNumber I tried that

#

it still said different numbers

#

the lore said 1 and the message said 2

round finch
#

Lol

#

Exactly

quaint mantle
#

but I want it to say the same numbers

#

or is that a part im missing

#

OH

#

so one I kep ++

agile anvil
#

what the heck

quaint mantle
#

and one I kep += 1

#

ok

#

ok

#

one += 1

agile anvil
#

afterward

#

not in the middle

quaint mantle
agile anvil
#

yes he is, there is no way

quaint mantle
#

ok but what do I do for the second one

granite owl
#

bruh

agile anvil
#

learnjava isn't useful here. don't know what to say

quaint mantle
#

bro

#

so "ONE" I kep ++, and "ONE" I kep +=1

#

????

agile anvil
#

my goshhh

quaint mantle
#

thanks

hazy parrot
#

++ is the same as +=1

round finch
#

Give him exemple

#

He clearly doesn't know

hazy parrot
#
plugin.editionNumber += 1;
plugin.editionNumber++;
plugin.editionNumber = plugin.editionNumber + 1;
#

there is some example, all 3 of those are same

quaint mantle
#

like this?????

agile anvil
#

am i dreaming

hazy parrot
#

but take a note that plugin.editionNumber++ will first display the value, and increment later

#

if you want to increment first do ++plugin.editionNumber

granite owl
agile anvil
kindred valley
#

How can I store an item that the player clicked in the inventory?

agile anvil
quaint mantle
#

OH

#

I GOT IT

#

NO DONT SPOON FEED

hazy parrot
#

that is a bit rude

quaint mantle
#

im slow sorry

#

FUCKING

#

NO

round finch
#

Haha gj!

quaint mantle
#

@round finch @last temple @hazy parrot @agile anvil THANKS GUYS

#

🙏 🙏

agile anvil
#

happy you finally solved it

kindred valley
# agile anvil store as a variable or store in config ?

Not that way, let's assume the player clicks on a wooden sword. After clicking on the sword, a different inventory will come and he will choose how many of that sword he wants in that inventory. However, if I do not store the wooden sword, I cannot calculate how much money I will withdraw from the player.

agile anvil
quaint mantle
#

wait

#

how do u guys install themes

tardy delta
#

for what

kindred valley
# agile anvil I guess you have a method to open the second inventory, so just add in the metho...
if(e.getClickedInventory().equals(Pazar.swordGUI)) {
            switch (e.getSlot()) {
                case 20: p.openInventory(Pazar.getInv1(new ItemStack(Material.STONE_SWORD)));
                case 21:
                case 22:
                case 23:
                case 24:
            }
        }``` inv1 is the gui where we choose the amount of the item we will buy. But even if I assign it as a parameter, what good would it do me? As a result, another gui will open and I will choose the amount from there.
agile anvil
#

Or if you work like that, you can have like a map saving for a player the last item he clicked, and retrieve it in the next inventory

#

Map<UUID, Itemstack> or whatever

#

so just before opening the next inventory, put the player and the itemstack in the map

kindred valley
#

But in hashmap it will always add a new item

#

wha

#

wha

agile anvil
#

then give the item and withdraw the money

warm light
#

Someone pls help me to make this ._.

#

I did this. but its not blocking shulkerbox on player inv

agile anvil
# kindred valley yes exactly

So when the player click on the item in the first GUI, put in your Hashmap playerUID -> ItemStack. Then in the other inventory, you can get the ItemStack back from the playerUID

brave goblet
#
  @EventHandler
    public void playerKillEvent(PlayerDeathEvent event){
        if(event.getEntity().getKiller() instanceof Player){
            event.setKeepInventory(true);
        }
    }
``` I got this code, but when I get killed it stays in my inv and also drops
Is there possibly another plugin in this list causing the issue?
haughty idol
#

yeah that's what i was thinking, would ii store parties in a hashmap though, and if so would it be party leader per party member or party member per party leader

#

i'd assume party leader per party member because it would be hard to tell who the party leader is

boreal seal
#

any tips in creating different shapes

#

?

warm light
boreal seal
#

i already made an sphere and a cube

#

but was thinking about some strange shapes

#

any idea?

brave goblet
#

80% sure it might be AureliumSKills

warm light
#

can be. check it first

brave goblet
#

but my code isn't the problem right?

warm light
agile anvil
agile anvil
haughty idol
#

or should i do the player that remembers it's party

agile anvil
#

Two possibilities :

  • give a name or id to each party and save in a map id -> Party, and for each players save the party id.
  • save directly the Party reference for each players
#

then you can access it very easily

quaint mantle
#

Hello Guys Can I ask something?

agile anvil
quaint mantle
#

how to import the nms? in my gradle is below!

    compileOnly("org.spigotmc:spigot-api:1.18.2-R0.1-SNAPSHOT") // The Spigot API with no shadowing. Requires the OSS repo.
    compileOnly("org.spigotmc:spigot:1.18.2-R0.1-SNAPSHOT")

I think it's not work,

agile anvil
#

Did you run buildtool ?

quaint mantle
#

Yeah I run that
java -jar BuildTools.jar --rev 1.18.2 --remapped

kindred valley
#

like this?

agile anvil
quaint mantle
#

Ahh ok I'll

agile anvil
agile anvil
quaint mantle
#

repositories {
    maven { url 'https://jitpack.io' }
    maven { url "https://mvn.lumine.io/repository/maven-public/" }
    maven { url "https://mvn.lumine.io/repository/maven-public/" }
    maven { url = 'https://repo.codemc.org/repository/maven-public/' }


    maven { url = 'https://oss.sonatype.org/content/repositories/snapshots' }
    maven { url = 'https://oss.sonatype.org/content/repositories/central' }

    maven { url = 'https://oss.sonatype.org/content/repositories/snapshots' }
    maven { url = 'https://oss.sonatype.org/content/repositories/central' }

    mavenLocal()

}
dependencies {
    compileOnly("org.spigotmc:spigot-api:1.18.2-R0.1-SNAPSHOT")
    // The Spigot API with no shadowing. Requires the OSS repo.
    compileOnly("org.spigotmc:spigot:1.18.2-R0.1-SNAPSHOT")
    compileOnly fileTree(dir: 'api', include: ['*.jar'])
    implementation 'org.reflections:reflections:0.10.2'

}
agile anvil
#

rn you're creating an hashmap each time

quaint mantle
#

is that right?

agile anvil
#

oh wait

#

refer to this page

#

there is everything in there

quaint mantle
#

ahh

#

I don't know why should I build first to use nms

#

and

#

bad class file: C:\Users\SkyExcel.gradle\caches\modules-2\files-2.1\org.spigotmc\spigot\1.18.2-R0.1-SNAPSHOT\884b3b6772862b8898b8b837cea8c00c1055833d\spigot-1.18.2-R0.1-SNAPSHOT.jar(org/bukkit/craftbukkit/v1_18_R2/inventory/CraftItemStack.class)
class file has wrong version 60.0, should be 52.0
Please remove or make sure it appears in the correct subdirectory of the classpath.

#

!scheduler

#

what's the command

#

damn

#

I rebuild my project but it doesn't work

agile anvil
#

?scheduling

undone axleBOT
quaint mantle
#

ty

quaint mantle
#

ahh now, the build is success!

#

bbut the nms still can't find..

agile anvil
#

did you put everything of the wiki page ?

quaint mantle
#

should i add the file build.gradle.kts? 'cause I can't find it in my project

agile anvil
#

no

#

are you using kotlin ?

quaint mantle
#

I'm using Java

agile anvil
#

if not you should only see build.gradle

#

?paste your build.gradle

undone axleBOT
quaint mantle
agile anvil
quaint mantle
#

Ok just change the version 1.18,2 to 1.19? like
org.spigotmc:spigot-api:1.19-R0.1-SNAPSHOT

agile anvil
agile anvil
quaint mantle
agile anvil
quaint mantle
#

i though u could help me

agile anvil
#

No we can't

hasty prawn
agile anvil
quaint mantle
#

ok

quaint mantle
agile anvil
#

and did you build spigot 1.19 with buildtool ?

quaint mantle
#

Ahh I didn't that yet haha

#

buildtool and what's next I don't know this

hasty prawn
#

?bt

undone axleBOT
agile anvil
#

don't forget --remapped

quaint mantle
#

java -jar BuildTools.jar --rev 1.18.2 --remapped like this?

#

mhm

hasty prawn
#

Well you need 1.19 and not 1.18 but yes

quaint mantle
#

I'm trying again in 1.18 and if it's not working I'm gonna change :>

kindred valley
#

Inventory inventory = e.getClickedInventory();
        if(inventory.equals(Pazar.swordGUI) ||
                inventory.equals(Pazar.foodGUI) ||
                inventory.equals(Pazar.blockGUI) ||
                inventory.equals(Pazar.mineGUI) ||
                inventory.equals(Pazar.toolGUI) ) {
            e.setCancelled(true);
        }
``` Somehow its not entering this case. The GUI'S all instanced. I instanced the inventory too but still not entering the case.
quaint mantle
#

minimessage works with 1.18+ correct?

warm light
#

Whats wrong here?

I am trying to make
if player open echest, and he try to put more then 5 shuklerbox in echest from his inv, it will break

hasty prawn
echo basalt
#

oh god you're still at this

quaint mantle
#

alr

#

thanks

#

and yes they did merge

hasty prawn
#

Just try it and see if it works PeepoShrug

#

Best thing to do if you're unsure honestly

warm light
quaint mantle
#

👍

#

I can't upload the image in this channel

#

I thought my keyboard's gone lmao

hasty prawn
#

You have to verify to do that

eternal oxide
#

!verify

undone axleBOT
#

Usage: !verify <forums username>

quaint mantle
#

Ahh Thanks

#

.

#

I've got these file

eternal oxide
#

check the distance when they move

quaint mantle
#

after build tool

eternal oxide
#

don;t teleport, just cancel

#

you did it wrong then

quaint mantle
#

show your code

eternal oxide
#
if (player.getLocation().distance(centerLocation) > distance)```
#

or event.getTo().distance(center)

tall dragon
#

isnt #distance quite expensive tho?

eternal oxide
#

your code is testing player location not the event location of getTo

#

not really. Everyone says yes, but when you are telking about a few players sqrt is not that costly

reef lagoon
#

is a utils class basically a bunch of static methods

eternal oxide
#

usually yes

tall dragon
eternal oxide
#

It just depends how much you need to use it

#

if you used it for every player event single movement (not just when they move to a different block) it could get costly, but even then when it's a handful of players its nothing to worry about.

tall dragon
#

ah alright

#

good to know

drowsy helm
#

bit far fetched but is it possible to create a virtual server environment for JUnit testing?

eternal oxide
#

I believe there is a plugin/project for that

#

I don;t know its name

drowsy helm
#

yeah i remember there was one, just cant remember the name

eternal oxide
#

Mockito

drowsy helm
#

awesome thanks

eternal oxide
heady spruce
#

How do I remove certain Items from dropps when a player dies? Ex: Player dies, only drops soups

agile anvil
#

listen to the event, get all drops from the event and remove those you don't want

boreal seal
#

hi guys

#

i got an general java question

#

i make a list contaning materials for example

#

each time i request from it will load it

#

how it works?

#

with lists

lost matrix
#

"each time i request from it will load it"
What does that mean?

boreal seal
#

I mean like what goes in the background

agile anvil
#

do you know what's the difference between arrays and lists ?

boreal seal
#

for example if u store an object in hashmap Object , integer ... and put once again it will replace

#

now

#

the question is how it would work

#

it would replace or re create a new one

#

i want to create a list of materials and accses it very often

#

lets say i will take if from config thanks for the answers.

tardy delta
#

config.getMaterialList() hoping there is one

#

(List<Material>) config.getList()

boreal seal
#

i dont ask for it

#

i ask how does list work when you ask for value from it

tardy delta
#

depends on what list impl lol

agile anvil
#

a list is basically multiple boxes. each box contains a value, and the address of the next box. so to get the 3rd box you have to go through the 3 first boxes.
while array doesn't store address of the next box, they're all together

lost matrix
#

So the List<T> holds references to your Objects.
A list can contain duplicate values and null. This means you can have
a list that looks like this:
[1, 1, 1, 2, 2, 4, 4, 1, null, 1, null]

If you call .contains(Object)
then it will iterate through all elements and check if
it is equal to your searched element.

tardy delta
#

an arraylist just stores an array with your stuff internally

boreal seal
#

it loads up to cache like hashmap once?

#

or it does a request eachtime like to an database

agile anvil
#

that doesn't make sense

boreal seal
#

Rolyn im asking because im wondering

lost matrix
#

Everything you do is stored in RAM. Every data you see is simply in RAM. Nothing needs to be loaded in a "cache".

boreal seal
#

its loaded into Ram once in start right?

#

like an hashmap

#

i'm not trolling guys dont lose your mind please.

agile anvil
#

If you mean "allocate memory" the answer is no, neither for hashmap

tardy delta
#

your program loads into the ram memory

lost matrix
#

There is no "loading into ram"
If you use the new keyword then you allocate a block of memory.

agile anvil
#

arrays allocate memory

boreal seal
#

so basically once i made a one and it will be in the Ram thats it

#

i understand

#

it will not re make more and more lists and over load ram

#

i ask it because im not sure about the behavior of list

agile anvil
#

if you add stuff to the list it will grow

boreal seal
#

yeah yeah i know

agile anvil
#

it's not fix

boreal seal
#

i mean like so if Class A > asks list (it doesnt create another list and another list and another list each time...)

#

just an idiot told me something like it

agile anvil
#

oh no

boreal seal
#

so i was asking because i was kinda not gonna use that shit

lost matrix
#

You can have the same object stored a million times in a List if you keep adding it.
A List doesnt replace already contained object. It just appends them.

warm light
#

I clicked a item in gui. now how can I check if the item from upper inv?

boreal seal
#

nah i dont speak objects just someone told me a while ago that Lists work like Once lets say i need to read something from List it will load another list into memory

lost matrix
boreal seal
#

sounds bullshit yeah i just had to ask because if it would work that way would be crazy damage to performance

#

lol

agile anvil
#

In java, your variable store a reference (address to the memory) except for primitives types (int, double, ...)

#

so you pass the address, not the list

lost matrix
#

Well there are some List implementations that will do a lot of copying like the CopyOnWriteArrayList

#

Its only used for very specific thread safe operations.

thin delta
#

How do I export my jar with this org.apache.commons.io.jar included?

chrome beacon
#

Switch your project to maven or gradle and we'll help

thin delta
#

I'm sure someone can help with eclipse

chrome beacon
#

You'll have to wait a long time

#

I'm not even sure it's possible with the Eclipse package system

worldly ingot
#

No, you can't. You'll have to use Maven or Gradle

#

That being said, I want to say Commons IO is actually part of Bukkit?

upper vale
#

I thought it was only apache commons lang

worldly ingot
#

Commons IO is internal

#

Nevermind

thin delta
#

Link to Maven

chrome beacon
quiet ice
#

But I am not too sure if it is possible to shade in just select few dependencies

thin delta
#

will a runnable jar work for a plugin?

quiet ice
#

Yes, but I have never tested it out

#

Chances are it shades in ANY dependency, it has been a long while since I used it

thin delta
#

It's not letting me proceed. Doesn't have any options in the Launch configuration: dropdown

flint coyote
#

Just use maven. That's the common way of doing it anyway

eternal oxide
#

If not there will not be any there

#

Also, why do you want it as a runnable jar?

young knoll
#

They want to shade a dependency

eternal oxide
#

Thats definitely not how to do it

flint coyote
#

Maybe he's already swapping to maven or gradle

quiet ice
#

Create runnable jar does shade stuff in, but it is a bit more complicated than that and as such not worth it

eternal oxide
#

If you keep down that path, to get that to work you NEED a main method. You MUST have created a launch profilet to execute that main method, then you can export.

#

simpler to export as a jar, not runnable.

quiet ice
#

Yeah, crafting a launch profile from hand (Eclipse provides no fancy GUI for that afaik) just to shade in a dependency is a fool's errand

#

Best just not shade the dependency at all and declare the lib in the plugin.yml file

eternal oxide
#

Its not hard in eclipse, just pointless

thin delta
#

Is it easier to convert a project to maven or gradle from eclipse

haughty idol
#

idk i'm confused

heady spruce
#

Can someone tell my why my killer is always null?

@EventHandler
    public void onDeath(PlayerDeathEvent event) {
        Player player = event.getEntity();
        Player killer = player.getKiller();

        SOME MORE CODE
 }```
error ```
Caused by: java.lang.NullPointerException: Cannot invoke "org.bukkit.entity.Player.sendMessage(String)" because "killer" is null
        at koast.listeners.PlayerRespawn.onDeath(PlayerRespawn.java:29) ~[?:?]
        at jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:104) ~[?:?]
        at java.lang.reflect.Method.invoke(Method.java:577) ~[?:?]
        at org.bukkit.plugin.java.JavaPluginLoader$1.execute(JavaPluginLoader.java:306) ~[spigot.jar:git-Spigot-21fe707-741a1bd]
        ... 40 more``` Line in Code: `player.sendMessage(Main.prefix + "You were killed by§6 " + killer.getName());`
quiet ice
thin delta
quiet ice
#

Well m2e is the eclipse plugin

heady spruce
#

I can test, I also put a if statement if(killer != null) { do code } the code wont be executed

quiet ice
#

Maven is just a build tool, can be even used without an IDE

thin delta
#

Is there a dedicated ide for Maven

quiet ice
#

No

#

Why would you even do that

thin delta
#

And/or can I export with shading using the M2E plugin

heady spruce
torn shuttle
#

hey, anyone have any idea if I put a fake packet-only block on the map for a player and then fire an arrow from the server, how does the arrow resolve when going through the block client-side? Does it just get completely ignored?

chrome beacon
quiet ice
thin delta
shell finch
#

how could i remove a single block from the drops of a blockBreakEvent?

young knoll
#

BlockDropItemEvent

thin delta
#

Everywhere I look online says there should be a "convert to maven" ption

heady spruce
#

Anybody know how I cancel knockback? And without cancelling the knockback and adding the damage to the player? If yes please let me know.

quiet ice
#

Then you did not install the eclipse m2e plugin

#

Which is strange given that that is the default

shell finch
young knoll
heady spruce
#

okay I can try that

young knoll
quiet ice
warm light
#

how can I get the item I just selected from a inv?
getCursor or getOldCursor

young knoll
#

getCurrentItem

warm light
#

From InventoryDragEvent

shell finch
young knoll
#

Get the item stack from the entity, remove one, set it back to the entity

quiet ice
#

^

#

@thin delta Again, if you want to target only minecraft versions after 1.17.2, you can also declare the dependency in the plugin.yml, spigot will automatically download it at runtime then

thin delta
#

I'm doing version 1.16.5 😦

shell finch
#

thanks ill try that

quiet ice
thin delta
#

Yeah

#

Now I'm trying to figure out why my eclipse doesn't have m2e

quiet ice
#

At worst install eclipse eierlegende wollmilchsau

#

Another reason could be that you already have the maven nature set, in which case the "convert to maven project" option vanishes

warm light
#

Someone help me :")

I just put an item from bottom inv to upper inv. how can I get the item from InventoryDragEvent?

young knoll
#

It should have a method to get all the changed items

#

Or slots

dusk flicker
#

Check the Javadocs

young knoll
#

Oh boy that be old eclipse

quiet ice
#

If there is a "M" next to the "J" everything is okay - you just need to manually create the pom.xml

#

If it isn't we got a problem - gradle would be the next-easiest solution then

keen spindle
#

hey guys, how do we run dispatchCommand sync

quiet ice
#

?jd-s developers these days

undone axleBOT
keen spindle
#

which one in that lol

thin delta
young knoll
#

use runTask from the scheduler

thin delta
quiet ice
#

Or just callSyncMethod which is meant for that

keen spindle
#

btw got a question, what do we pass plugin as

#

this?

keen spindle
quiet ice
quiet ice
young knoll
#

callSyncMethod is for when you need the return value

tardy delta
#

?di

undone axleBOT
quiet ice
#

Ah, actually no

thin delta
quiet ice
#

They are basically suppliers

quaint mantle
#

how can i made it so when a PlayerChatEvent or AsyncPlayerChatEvent gets canceled a event gets triggered?

#

like a CancelListener(OnCancelEvent e)

young knoll
#

Listen for the event in the Monitor priority and check event.isCancelled

keen spindle
iron glade
#

yes

quiet ice
quaint mantle
quiet ice
#

You have only one plugin

#

What is so hard to understand with plugin

#

You have one plugin, not more

keen spindle
#

yes......... im just asking if its the class lmao

quiet ice
#

Not the class instance

iron glade
quiet ice
#

The plugin instance

#

MyFancyPlugin.class wont even compile

iron glade
#

but nothing to the event, just run your method or whatever

warm light
quaint mantle
#

Thanks very much!

quiet ice
iron glade
#

eclipse folders like from 1900

keen spindle
iron glade
#

no

quiet ice
#

MNOP <vzklhartvkjikgnygrj

#

Your plugin instance

#

You cannot create another instance

undone axleBOT
tardy delta
#

geol going crazy

iron glade
#

understandable

tardy delta
#

hope he understands anything of that guide tho

keen spindle
quiet ice
#

Possibly, possibly not

iron glade
#

if you're in your class extending JavaPlugin

keen spindle
#

....

quiet ice
#

If this is your plugin, yes

#

If it is not, no

keen spindle
iron glade
#

What's your main class called?

quiet ice
#

Or better said: If it compiles yes, otherwise no

young knoll
#

Lol

keen spindle
iron glade
#

and what is that..

keen spindle
#

MineauApi

iron glade
#

what's the name of your event class?

quiet ice
#

Okay I am done

#

Just pass in JavaPlugin.getPlugin(getClass())

keen spindle
#

ok

quiet ice
#

Performance be dammed, but it works

keen spindle
sudden robin
thin delta
iron glade
#

the name of your class

keen spindle
iron glade
#

with the event

sudden robin
#

You put this there, if it compiles then it's correct, if not it's probably wrong

keen spindle
sudden robin
#

Just try it dude

sudden robin
#

^

quiet ice
#

If you need to cast, something is wrong

iron glade
#

He trying to do di or what?

quaint mantle
warm light
#

I just put an item from bottom inv to upper inv. how can I get the item from InventoryDragEvent?
from docs I found getOldCursor() but its not working

iron glade
#

you can't iirc

quiet ice
young knoll
#

I think you can with some jank involving stack traces

quiet ice
#

Only if you are using a custom event though

sudden robin
quiet ice
#

And in that case stack traces are not the only option

quiet ice
quaint mantle
# sudden robin I think the better question is, why would you need that

i am making a plugin that detects event cancels for example if a server gets backdoored and someone is trying to run a command like !help or something in chat and it gets canceled i can easily know what plugin is causing that but if someone gets muted i want to know the name of the plugin before i tell the user that this event got canceled or something

thin delta
keen spindle
#

Bukkit.getScheduler().runTask(this, () -> Bukkit.dispatchCommand(player, "command args")); did this, is it correct?

iron glade
#

what are you trying to do?

keen spindle
#

ofcourse i will replace command args with my command

keen spindle
#

from my plugin

quiet ice
keen spindle
#

i.e crates/ranks

quiet ice
keen spindle
#

but basically im just tryna make buy-craft without tebex and stuff

chrome beacon
#

You can't as far as I'm aware

#

Is there a reason you need to?

quiet ice
quaint mantle
#

what do you mean?

chrome beacon
#

No

quiet ice
#

basically whether you can override the setCancelled method

chrome beacon
#

It's the chat event judging by the reason

#

So not a custom one

quiet ice
#

Then if you are willing to wait I can write a library that does exactly that, but that might take at least a day and I'll warn your upfront: the solution isn't exactly "sane"

quaint mantle
#

wait wait

#

are u sure u understand what i want to do?

#

i just want to make sure i can detect what plugin is doing setCanceled(true);

quiet ice
#

Yes

#

And I happen to know how to detect that

warm light
#

what does getOldCursor() return from InventoryDragEvent?

quaint mantle
#

How?

quiet ice
#

Mass ASM

quaint mantle
#

whats asm

quiet ice
#

As I said - the solution is not sane

heady spruce
#

Is there a better way to if the item with that name got clicked in a Inventory than if then else if and so on? If yea, please tell me

quiet ice
quaint mantle
#

ohh i think i know a library like it its called javassist

quiet ice
#

You cannot use the in bukkit

chrome beacon
quaint mantle
#

Okay thats okay

quaint mantle
#

thats how i know it

#

they use it to inject other plugins

#

listen if u can make something like that

#

thats great

quiet ice
#

Yeah, only that we actually don't inject into other plugins

quaint mantle
#

but i cant pay money for it

#

i dont have money to pay

quiet ice
#

Nah, I'd be willing to do it for free

quaint mantle
#

Okay great

quiet ice
#

I have most classes written for it, I'd just need to write the transformer

sudden robin
#

inb4 geol just infects you with malware now (just kidding)

quaint mantle
#

Thanks very much

young knoll
#

I wish I could figure out ASM

#

Must do cursed things to server

quiet ice
#

It is a double-edged sword

warm light
#

what does getOldCursor() return from InventoryDragEvent?
anyone can explain pls?

chrome beacon
young knoll
#

But we don’t have those

#

Well

#

Kinda

sudden robin
#

By the way, does anyone have any experience with the Minecraft plugin for IntelliJ? I used it to set up my plugin project, and when I compile it there's a plugin.yml in the JAR file, but it's not the plugin.yml that I have in my project, that one seems to get ignored.

chrome beacon
#

Where did you put the plugin.yml?

quaint mantle
#

Hey guys Can I get NBTData without NBT-API?

chrome beacon
#

Yeah you can rewrite what NBT API does

young knoll
chrome beacon
#

Which is a lot of work that isn't needed

sudden robin
chrome beacon
sudden robin
chrome beacon
warm light
#

what does getOldCursor() return from InventoryDragEvent?
anyone can explain pls?

sudden robin
chrome beacon
#

The Minecraft Dev plugin should already have put it there for you

sudden robin
#

Holy crap

quaint mantle
chrome beacon
#

Because there might be an API alternative

quaint mantle
#

Ahh

chrome beacon
#

Hopes you aren't using 1.8

quaint mantle
#

Yeah I'm using 1.18.2

chrome beacon
#

ah right

#

I forgot

warm light
#

How can I get the dragged item from InventoryDragEvent?

quaint mantle
chrome beacon
#

Depends

#

What are you trying to do

quaint mantle
#

can java.util.Scanner scanner accept alphabets?

#

?learnjava

undone axleBOT
young knoll
# chrome beacon ?

Are you using them with spigot? Because I know you need some kind of program for that to work

chrome beacon
#
  • Haven't actually used it
#

I use Mixins when modding never used it in a plugin

quaint mantle
chrome beacon
#

Yes

quaint mantle
#

Opps I want to save inventory

#

But just Itemstack it's not gonna save with nbt data So,, Yeah

chrome beacon
#

Do you want to save it on to any item?

quaint mantle
#

Yeah

chrome beacon
#

Or like a chest that keeps the inventory

#

?pdc You can use this

chrome beacon
quaint mantle
#

Ohh

#

It can be save Nbt data of item?

chrome beacon
#

Yeah

quaint mantle
#

Wow I'll try it tomorrow

#

Thank u 🙂

quaint mantle
chrome beacon
#

What I meant by that was the vanilla nbt that that allows placed tile entities (like chests) to have an inventory of items when placed

#

Sort of like a Shulker box

quaint mantle
#

Ahh

#

Unfortunately, i use spigot bukkit 😂

chrome beacon
#

?

quaint mantle
#

?? It work same as on it?

chrome beacon
#

What's spigot bukkit

quaint mantle
torpid sapphire
#

is it possible to add a second item as an output for anvil repairs without making a completely custom gui?

#

and if not, can i even make a functioning text input field in a custom gui

warm light
#

I did this simple code but its not working 🤦

#

I can still move item in inv

gray merlin
#

Does the spigot website have an API, and if so, can I upload new releases to my plugin automatically?

warm light
#

No

gray merlin
warm light
#

Its registered

gray merlin
#

Well, with the context you've given, nothing seems to be wrong then

warm light
#

I can't see anything that can block it. IDK what happening :/

gray merlin
#

Show the code...?

chrome beacon
warm light
gray merlin
gray merlin
warm light
#

Umm, I think I can do my task with clickevent. Let me check

upper crater
#

is Entity.getKiller(), null when the killer was in creative mode?

gray merlin
#

Is there a way to bulk delete all versions in the plugin page?

torn shuttle
#

so wait is it possible to make an arrow that doesn't stick to anything by creating that arrow only via packet?

chrome beacon
#

Yeah

torn shuttle
#

huh

#

I should probably do that

thin delta
quiet ice
#

You also need to add the shadow plugin (for gradle - not in eclipse)

#

It gets a bit more complicated than that in gradle I am afraid

thin delta
#

Excellent...

#

doesn't look like there's any decent guides

quiet ice
#

Just add (keeping previously existing plugins if there are any)

plugins {
    // Apply the java-library plugin to add support for Java Library
    id 'java-library'
    id "com.github.johnrengelman.shadow" version "7.0.0"
}

to the top of the build.gradle file

#

Then you need to declare dependencies with the right scope (so provided for anything you don't want to shade and implementation for everything you want to shade)

thin delta
#

Where do I find the build.gradle file?

#

nvm

#

refreshed the project and they are there

#

Ok, so this is what mine looks like now

plugins {
    // Apply the Java Gradle plugin development plugin to add support for developing Gradle plugins
    id 'java-gradle-plugin'
    id 'java-library'
    id "com.github.johnrengelman.shadow" version "7.0.0"
}


dependencies {
    // Use JUnit test framework for unit tests
    testImplementation 'junit:junit:4.12'
    compile 'org.apache.commons.io'
    compile group: 'commons-io', name: 'commons-io', version: '2.6'
}
#

Since org.apache.commons.io.jar is what I wanted included in the export?

chrome beacon
#

compile != implementation

#

Also you'll need to fix that dependency so it has groupId:ArtifactId:version

kind hatch
#

Oh my. What's with all the static usage?

quiet ice
#

Dependencies are shaded in on a per-dependency basis

kind hatch
#

You know that you can use classes in other files without the use of static right?

quiet ice
#

So line compile group: 'commons-io', name: 'commons-io', version: '2.6' would already include commons-io in your shaded jar

kind hatch
#

Potentially. The static keyword has very specific usecases and when it comes to plugin development, it's seldom used.

#

Also, some things to note about yml files.

  • Using #saveResource(string, true) will overwrite any existing file that is on the disk. It basically makes the config useless if you are going to overwrite changes every single time.
  • The use of quotation marks in yaml isn't actually necessary in most cases.
#Both are valid sections!
section: "Hello there!"
section2: Hello there!
#However, when you need to use single quotes, you need to surround your string in quotation marks.
section3: "Let's go!"
#Alternatively, you could use the double single quote method
section4: 'Let''s go!'
#

Probably because your instance of FileConfiguration is null.

odd wedge
#

Because you never define it before using it

upper vale
#
  • Using #saveResource(string, true) will overwrite any existing file that is on the disk. It basically makes the config useless if you are going to overwrite changes every single time.
    he checks if the file exists before saving resource
kind hatch
#

Oh, didn't catch that. 😛 He could replace it with a #saveResource(string, false) though. It takes care of that.

odd wedge
#

Well FileConfigurator returns null because it has no value

#

@knotty meteor

fervent gate
#
public enum FirstLevelDungeonStage {

    S0(0, 0),
    S1(1, 4),
    S2(2, 6),
    S3(3, 8),
    S4(4, 10),
    BOSS(5, 1);

    private int n;
    private int amountOfMobs;

    FirstLevelDungeonStage(int n, int amountOfMobs) {
        this.n = n;
        this.amountOfMobs = amountOfMobs;
    }

    public int getN() {
        return this.n;
    }

    public int getAmountOfMobs() {
        return this.amountOfMobs;
    }

}

If I wanted a method in another class called 'progress()', which moves the player to the next stage. How would I get the next item in this enum?

gray merlin
#


I have a multi module maven project with a "Commons" module, shared across the rest of the modules. For some reason, after an ide restart, Intellij/Maven added the module to the local repo and is now ignoring the "Commons" module, alongside any modifications I do. How do I make it assume the dependency from the project again?

kind hatch
gray merlin
#

Also valid

thin delta
#

Would having the version incorrect cause it to blow up?

#

im not 100% sure on the version

quiet ice
thin delta
#

Yeah I'm looking at the versions right now

quiet ice
thin delta
#

oh, so not compile group?

quiet ice
#

Best use implementation

thin delta
#
plugins {
    // Apply the Java Gradle plugin development plugin to add support for developing Gradle plugins
    id 'java-gradle-plugin'
    id 'java-library'
    id "com.github.johnrengelman.shadow" version "7.0.0"
}

dependencies {
    // Use JUnit test framework for unit tests
    testImplementation 'junit:junit:4.12'
    implementation group: 'commons-io', name: 'commons-io', version: '2.11.0'
}
quiet ice
#

compile is deprecated

thin delta
#

Yeah, it don't like that

tall dragon
#

capitals in packages FeelsStrongMan

crimson terrace
#

Will Entity#getHealth() always return <=0 in an EntityDeathEvent even when it was a creeper at full health exploding?

crimson terrace
#

asking cuz I dont have access to a test server rn

odd wedge
crimson terrace
#

cant rn, its complicated

#

I guess I will later

tall dragon
#

since im pretty sure when the event is fired the entity is not dead yet

#

its just about to happen

crimson terrace
#

fair enough, just gonna assume that for now 🙂

tall dragon
#

yea defo wanna test that out when you get a test server running tho

eternal oxide
#

The event is not cancellable so I'd assume it was after death, but before drops. So I would expect health to be 0

tall dragon
#

that could be an option as well

opal juniper
tall dragon
#

its all a big ruse!

crude portal
#

im trying to set an int to an item using nbt api and then gather the int
public int getTierFarmerMask(ItemStack stack) {
return new NBTItem(stack).getInteger("tier");
}

                Bukkit.broadcastMessage(String.valueOf(getTierFarmerMask(stack)));

and it is just returning 0 when i set it to 1

eternal oxide
#

too old to use pdc?

vocal cloud
#

It's a sad world we live in. Wen forge policy on versions sadge

eternal oxide
#

You are more than welcome to pull out your abacus and give advice 😉

thin delta
#

I think my gradle init screwed up....

crude portal
#

whats pdc

hazy parrot
#

?pdc

granite burrow
#

Hey why does "&r" not change the format of the string when in a Text element? It works perfectly when I send it as a string to the player, however, I'd like to send it as a hover event

lost matrix
#

You need to translate the color code.

granite burrow
lost matrix
#

This just means that the parent component has a style. Changing the style of a children wont do anything.

granite burrow
#

ah so in a Text component you can't have bold and unbold? Its just one or the other?

opal juniper
lost matrix
#

you can chain components. One bold and one not bold.

granite burrow
lost matrix
#

Yes

granite burrow
#

Alright ill try to find a way to make that work. Im trying to do it fully dynamic, so fun 😄

kind hatch
boreal python
#

How do I detect a specific item on itempickup? eg. I want to remove all tags from any type of wool block, plank, endstone, obsidian, terracotta, ladders, etc.

opal juniper
kind hatch
lost matrix
#

Item -> getItemStack -> getType -> check if the type is in a Set<Material>

boreal python
#

👍 ty!

torpid sapphire
#

is there a way to add a second item to the anvil output?
with a custom gui i wont be able to make the text input work and i dont think this is possible with the default gui

lost matrix
#

The anvil output is only one slot in size. How do you expect to add more items?

opal juniper
torpid sapphire
kind hatch
torpid sapphire
#

i thought maybe i could put a second item in the same slot after you take the first one out but theres no event for pulling the item out

lost matrix
kind hatch
#

Maybe you could cancel the output item on click. Then just let the player click the output until they get all the items they need.

torpid sapphire
#

wanna rework the way you repair tools
trying to implement left over scrap after repairing that you can later reuse

#

so i need some way to give the player that scrap

#

and just adding it into the player inventory feels cheap

lost matrix
#

Just add it to his inventory or put it in the output slot after you used the anvil

kind hatch
#

Why not use the input slots for that then? If you have extra repair material, they aren't removed.

torpid sapphire
#

theres no event for pulling the item out tho

#

just the prepare event

kind hatch
#

I'm assuming that you would take item + scrap = repaired item This is essential what the anvil is. Are you doing something different from this formula?

opal juniper
torpid sapphire
kind hatch
opal juniper
#

it will be first, but i was showing in the third

kind hatch
torpid sapphire
#

the scrap and the material isnt the same item

#

i cant just throw it in the input slot

kind hatch
#

Oh? Then can you give an example for this?

torpid sapphire
#

its a completely separate, second output item

kind hatch
opal juniper
torpid sapphire
# kind hatch Oh? Then can you give an example for this?

lets say you have a broken diamond pickaxe
you throw it in an anvil with some diamonds, it repairs the item and leaves you with the left over diamonds in the second input slot, the pickaxe in the output slot and some diamond scrap that isnt a diamond, but a custom item

#

where do i put the scraps

#

i need a second output slot or some way to reuse the first one

#

that would be possible if there was an event for pulling out the item from the anvil, but theres just the prepare event

kind hatch
#

Yea, I was going to say, you might be able to use the first slot if you are only putting in one item.

torpid sapphire
#

so youre saying throw the scrap in the first slot?

#

where the broken pickaxe used to be

kind hatch
#

Yes, but you would need to do it after the pickaxe is repaired.

torpid sapphire
#

exactly

#

how do i do that when theres no event for that

opal juniper
kind hatch
opal juniper
#

has no effect

wary harness
#

anyone can recommend good api for GUI

kind hatch
torpid sapphire
#

doubt it

lost matrix
lost matrix
torpid sapphire
#

that might work

opal juniper
thin delta
#

Why be error

#

in my build.gradle file

eternal night
#

did you mess with your setttings.gradle

thin delta
#

No. It was only generated from using the init task

eternal night
#

does running gradle manually compile ?

#

I don't think eclipse is known for great gradle integration

thin delta
#

I'm still trying to figure out gradle...

#

I just need it to use its shadow feature on my project to include a library in my exported jar...

eternal night
#

I mean, it might still work ?

#

have you tried just running gradle shadowJar from your terminal ?

thin delta
#

Oh, I think I need to update gradle?

eternal night
#

oh

#

yea might be worth it xD

#

7.5.1 should be latest

thin delta
eternal night
#

no of gradle xD

thin delta
#

well

#

something got screwed up

#

I no longer have the ability to show the gradle tasks view?

#

Yeah, gradle just got wiped from my eclipse IDE wtf

#

Yeah idk wtf happened... I just did updates on things that had updates and it screwed up my ide

green prism
#

I’m trying to read from the resource folder of my plug-in (Shaded) a txt file (updates.txt). I’m not succeeding, the only working method I found was taking too long to complete the execution. More than enough... Can you help me?

hazy parrot
#

What are you trying to do, you can retrieve InputStream quite easy

#

With #getResourceAsStream

green prism
# hazy parrot What are you trying to do, you can retrieve InputStream quite easy

I’m trying to read this text file that contains information about the new update features. Inside are subdivided UpdateType and UpdateDescription that are then analyzed and transformed into heads to be placed within an inventory... I’m not finding anything that goes, apparently, for 5 lines of text it blocks everything... (Just to read them, does not get to create the heads)

#

the classic java brick to read the file, it works and has always worked but in this case, it freezes everything

quaint mantle
#

anyone know how to fix this?

#

jitpack ^^

dusk flicker
#

wrong java ver

quaint mantle
#

so what should i change it to

#

it says 52.0

#

but how do i change it

young knoll
#

1.17 needs java 16 at least

quaint mantle
#

properties > java.version?

quaint mantle
young knoll
#

Mhm

green prism
#

[23:28:32 WARN]: java.io.FileNotFoundException: file:\C:\Users\andre\Servers\Server%20One\plugins\Identity-1.3.3-shaded.jar!\updates.txt (The filename, directory name, or volume label syntax is incorrect)

    public String readResource(String filename) throws IOException {
        ClassLoader classLoader = getClass().getClassLoader();
        File file = new File(classLoader.getResource(filename).getFile());
        String data = FileUtils.readFileToString(file, "UTF-8");
        return data.trim();
    }```

```java
    totalText = readResource("updates.txt");```

Hum, help?
young knoll
#

17 should also work, and it’s LTS

quaint mantle
#

okay so in maven

#

its

#

properties > java.version?

granite burrow
#

There isn't a good way to make it so that a plugin controls the message
"Player moved too quickly! x,y,z" huh?

quaint mantle
#

bro how do i change the java version

#

nor 17

viral temple
viral temple
quaint mantle
#

where?

#

pom.xml?

viral temple
#

In the ide?

quaint mantle
#

im trying to change my java version

#

so i can use jitpack

tall dragon
#

show pom

quaint mantle
tall dragon
#

well there you have it

#

1.17

quaint mantle
#

wdym ;-;

#

theres still an error

quaint mantle
viral temple
#

I'd love to see it

#

?paste

undone axleBOT
quaint mantle
tall dragon
quaint mantle
#

neither of them work

viral temple
quaint mantle
viral temple
undone axleBOT
quaint mantle
#

its 17 doe

viral temple
#

It would help

upper vale
#

should be 17

#

not 1.17

quaint mantle
viral temple
#

It depends

viral temple
quaint mantle
#

alr

#

i just did tha

viral temple
#

Does it work? Will never know

quaint mantle
#

same error

viral temple
#

?paste

undone axleBOT
quaint mantle
viral temple
#

Again

quaint mantle
#

that's all it is

#

idk why i need that

viral temple
#

Open project settings

#

Set your java to 18

upper vale
#

why does he need to change java home

quaint mantle
#

it is :/

viral temple
#

Look further

#

Some ide love to play pretend

#

Or show pom

#

You're compiling against java 17

#

With java 18

quaint mantle
viral temple
#

Java 1.17..?

quaint mantle
#

bro :/

#

it was 1.8

#

before

viral temple
#

It needs to be 18

#

Don't put 1.

#

That's java 8

quaint mantle
#

oh :/

#

im dumb

#

bro

#

this gay

viral temple
#

Go back and put "17*

#

Not 1.17

quaint mantle
#

i did

viral temple
#

It's java, not Minecraft

quaint mantle
drifting halo
#

do you actually have jdk 17 installed?

quaint mantle
#

yes

viral temple
drifting halo
#

is it your java home 👀

viral temple
#

🤣🤣🤣

quaint mantle
#

yes

drifting halo
#

check your project settings then

quaint mantle
#

thats 17

fluid river
#

i use thiz

#

to compile with java 17

quaint mantle
#

lets try that

#

nope

drifting halo
#

its clearly not on 17 then

quaint mantle
#

but that broke it

#

so i changed it back

#

Unsupported class file major version 61

#

everything is java 17

#

idk

#

¯_(ツ)_/¯

drifting halo
#

update maven

quaint mantle
#

how

upper vale
#

dont you need to add the java version to your maven compiler plugin or whatever

upper vale
#

like the

      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-compiler-plugin</artifactId>
        <version>3.8.1</version>
        <configuration>
          <source>${java.version}</source>
          <target>${java.version}</target>
        </configuration>
      </plugin>
upper vale
#

oh

quaint mantle
#

my java version is 17

drifting halo
#

what version is it on?

quaint mantle
#

17