#help-development

1 messages · Page 2185 of 1

lethal python
#

no no no no no no

#

no that's not why

humble tulip
#

remove it in the inventory close event

#

It is why

#

lol

#

youre removing it before the inventory is closed

lethal python
#

no matter what, the inventory close event always fires tru

humble tulip
#

remove the uuid in the inventory close event

lethal python
#

ok

brave sparrow
#

The inventory close event fires AFTER render

#

So you’re adding it and removing it before the inventory close event checks if it’s there

#

So it’s never there by the time it’s checked

lethal python
#

yay my plugin works now :)

#

thanks guys

humble tulip
lethal python
#

i know

#

i need to learn about the order things happen

humble tulip
brave sparrow
#

openInventory closes all existing inventories (firing the close event) and then opens the new one (firing the open event)

humble tulip
#

also pls tell you you stopped cloning and using the setter to set the set

lethal python
#

yes i removed those

#

back to get then =

humble tulip
#

ok

brave sparrow
#

What

lethal python
#

oops not even that

brave sparrow
#

Why are you using =

#

Lmao

lethal python
#

just getThing().add()

#

shhh

brave sparrow
#

Good

lethal python
#

it is 5:45am

spiral aurora
#

uh so im trying to get a villager to lower his prices down to 1 paper/emerald once he is healed but the villager somehow doesnt change his price at all


public class ChangeTradeEvent implements Listener {
    @EventHandler
    public void onCure(EntityTransformEvent e){
        if(e.getTransformedEntity() instanceof Villager){
            Villager villager = (Villager) e.getTransformedEntity();
            List<MerchantRecipe> recipes = Lists.newArrayList(villager.getRecipes());
            for(int j = 0; j<recipes.size(); j++){
                MerchantRecipe mr = recipes.get(j);
                List<ItemStack> ls = Lists.newArrayList(mr.getIngredients());
                for(int i = 0; i < ls.size(); i++){
                    ls.set(i, new ItemStack(ls.get(i).getType()));
                }
                mr.setIngredients(ls);
                recipes.set(j, mr);
            }
            villager.setRecipes(recipes);
        }
    }
}```
^here's my code
iron glade
humble tulip
iron glade
#

Thanks ^.^

#

Do you have an idea if there's a better suiting effect than Mobspawners?

humble tulip
iron glade
#

yes I like it too

#

probably gonna leave it like that

golden kelp
#

how do I tell maven that it should save the plugin at X path?

thorny dawn
#

put it inside <plugins>

golden kelp
#

thank you

thorny dawn
#

and replace the path

#

np

iron glade
#

I use

                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-shade-plugin</artifactId>
                <version>3.2.4</version>
                <executions>
                    <execution>
                        <phase>package</phase>
                        <goals>
                            <goal>shade</goal>
                        </goals>
                        <configuration>
                            <createDependencyReducedPom>false</createDependencyReducedPom>
                            <outputFile>C:\Users\You\Path...\plugins\YourPlugin_v${project.version}.jar</outputFile>
                        </configuration>
                    </execution>
                </executions>
            </plugin>``` all the time
iron glade
#

Since you have to shade spigot anyway you can just add <outputFile>C:\Users\You\Path...\plugins\YourPlugin_v${project.version}.jar</outputFile> to the maven shade plugin instead of adding the hole maven-jar plugin

chrome beacon
#

Never shade Spigot

iron glade
#

I always did this lol

#

or maybe I'm just saying garbage rn

chrome beacon
#

So all of your plugins are 50mb+ filled with useless classes that will prevent your plugin from loading

#

Ok

iron glade
#
            <groupId>io.papermc.paper</groupId>
            <artifactId>paper-api</artifactId>
            <version>1.18.2-R0.1-SNAPSHOT</version>
            <scope>provided</scope>
        </dependency>```

This means it's not shaded?
chrome beacon
#

No

iron glade
#

mb then got it wrong lol

#

what is this maven-shade plugin then for in my pom?

eternal oxide
#

a scope of provided prevents it shading that resource by default. You have the shade plugin though, so you are telling it to shade

#

unless you specify what you want shaded

iron glade
#

Can someone have a look over my pom I think it's a bit weird

vast pilot
#

Hey. I saw that classes like Sound or EntityType implement the Keyed interface. I wanted to use the key for serialization but could not find a method to get a sound or entitytype from namespacedKey. Is there a method yet that i havent found or should i implement one myself?

drowsy helm
#

show all oyur code

vast pilot
#

then theres already a variable named player defined in the scope

drowsy helm
#

as it says player is already defined

#
        if ((sender instanceof Player player)) {```
#

you are defining player twice

quaint mantle
#

you dont need to set the main class as the executor

drowsy helm
#

and checking after you cast it anyway lol

#

just remove Player player = (Player) sender;

quaint mantle
#

what the fuck

drowsy helm
#

code first echeck error log after? lol

vast pilot
#
if(!(sender instanceof Player)) {
  ...message
  return;
}
Player player = (Player) sender;
#

i think this will do

drowsy helm
#

in newer java versions java x instanceof Class y defines a new variable

quaint mantle
#

for some weird reason, occasionally i cant access player after a statement like that

vast pilot
#

i think he used player after closing the if

#

because he defined it earlier

quaint mantle
drowsy helm
#

oh it refuses to compile because of that?

#

strange

quaint mantle
#

sometimes it does and doesnt

#

i cant fully understand it

drowsy helm
#

thought that wouldve just been an ide error

#

dont see why it wouldnt compile

iron glade
#

Is there a way to replace a file in a player's resource pack, or like set his resource pack to a custom one, play a sound from it and set it back to is own resourcepack?

#

or what would be a good way to play a custom sound to him

drowsy helm
#

remove the player bit

#

you are defining a variable which is not of type Player

#

logically doesnt make sense

glossy venture
iron glade
#
    public boolean onCommand (CommandSender sender, Command cmd, String label, String[] args) {
       
 if ((sender instanceof Player)) {

        Player player = (Player) sender;
            player.sendMessage("§cThis command for only players."); //doesn't make sense but whatever
            return false;```
iron glade
#

first check then cast

drowsy helm
#

if thats what you mean

#

sorta like a try with resources

glossy venture
#

the inner scope

vast pilot
iron glade
#

ye

#

and?

vast pilot
#

🤷 anyone knowing something about the keyed interface and how to get enum constants from namespaced keys?

iron glade
#

Anything in the console?

undone axleBOT
vast pilot
#

java.lang.ClassCastException: class com.destroystokyo.paper.console.TerminalConsoleCommandSender cannot be cast to class org.bukkit.entity.Player

drowsy helm
#

you are casting console to player

#

meaning your instanceof check isnt correct

#

looks fine to me

iron glade
#

Show the whole command class as it is right now

vast pilot
#

als long as he only uses player in that if

drowsy helm
#
if ((sender instanceof Player)) {

            Player player = (Player) sender;
            player.sendMessage("§cThis command for only players.");
            return false;
        }
        Player player = (Player) sender;```
#

you are checking instanceof, returning then casting

iron glade
#

Player player = (Player) sender;

drowsy helm
#

so sender will always be console

iron glade
#

you are casting the sender to a player when the sender is not a player

drowsy helm
#

if (!(sender instanceof Player)) {

#

instead

#

change this whole thing

if ((sender instanceof Player)) {

            Player player = (Player) sender;
            player.sendMessage("§cThis command for only players.");
            return false;
        }

to

if (!(sender instanceof Player)) {

            sender.sendMessage("§cThis command for only players.");
            return false;
        }```
iron glade
#
if(sender instanceof Player) {

Player p = (Player) sender;
//do stuff

} else {

sender.sendMessage("You have to be a player!");

}```
drowsy helm
#

nws

#

also try and use translate color codes thingo

#

instead of that symbol

summer scroll
#

Is there in any way to convert 1.17 to 1.18 world without making the buildings fucked up or something?

sharp flare
#

save the buildings in a worldedit schematic then

summer scroll
#

Too big, it will crash the server

sharp flare
#

how big

summer scroll
#

2k x 2k

quaint mantle
#

Use fawe

#

Fawe wont crash it

#

Afak

sharp flare
#

oh shit I mean save them by chunks if u want

#

unless the whole 2k x 2k is occupied in every space

earnest forum
#

does anyone know how to format numbers with prefixes? e.g: 1,000 into 1k

summer scroll
#

I'll try save it to schematic part by part

iron glade
#

Does anyone know how to play that to a player? https://youtu.be/DzhhlHw2q2o?t=186

✔️ It's time to crown the SCARIEST SOUND in Minecraft... 👑

5️⃣ My Top 5 Series Playlist: https://www.youtube.com/watch?v=d2_9Z4ygwjs&list=PLX_aRMYRR9a6lU6tG1raGL2na2jwrTWoj&index=2

👉🏻 Facebook: http://www.facebook.com/mrcubey
👉🏻 Twitter: https://twitter.com/Cubey_YouTube
🎬 JOIN MY TEAM: https://cubezoneserver.enjin.com/

💎 Special Mentions:
• ...

▶ Play video
sharp flare
#

./sound ig

earnest forum
#

no its an effect

sharp flare
#

not sure if it has arguments

earnest forum
#

not a sound

#

im pretty sure

quaint mantle
#

Player.playSound?

sharp flare
#

oh ./effect

quaint mantle
#

Or smth

earnest forum
#

it will show the guardian on the screen though

iron glade
#

and the sound?

earnest forum
#

yes

sharp flare
#

you gotta find the right enum effect

iron glade
#

there is no effect.guardian

earnest forum
#

entity.elder_guardian.curse

#

try find this Sound enum

quaint mantle
#

Effect.monument ?

earnest forum
#

no im on the mc wiki

#

Sound.ENTITY_ELDER_GUARDIAN_CURSE

#

found it for u

#

@iron glade

summer scroll
earnest forum
#

its more hassle

sharp flare
#

well atleast you can preserve the buildings

drowsy helm
#

sometimes compiling with utf is iffy

earnest forum
#

you have to always copy paste it in where, with the translate you can make a static translate method and statically import it wherever you need to

iron glade
sharp flare
#

you can place blocks between the buildings height and width and save em into the schem

earnest forum
#
    public static String format(String s){
        return ChatColor.translateAlternateColorCodes('&', s);
    }
#

this is my method

#

in a Utils class

iron glade
sharp flare
#

kinda tedious doing per building but it will save u a lot of headache since restoring it is not that hard anymore

summer scroll
#

Particle.MOB_APPEARANCE

earnest forum
#

ye

#

i was looking for it

#

i knew it had an unrelated name

iron glade
#

I'll try it

#

Dumb question but how do I display that particle to the player?

#

ahh spawnParticle

earnest forum
#

Player#spawnParticle

iron glade
#

works, thanks ^.^

summer scroll
#

I wonder If you can change the guardian face particle with resource pack.

iron glade
#

hahaha it would be funny

#

to insert like a troll face

earnest forum
#

i havent programmed in long time

#

how do i find the output directory for my project

#

using intellij

drowsy helm
#

i just compile and it says the location

earnest forum
#

do i need to add an artifact to the module

blissful pumice
earnest forum
#

its not

#

"target" is the output for the compiled classes

#

you have to create a jar artifact in module settings and then it'll create a new folder in the directory called "out"

iron glade
#

Is there a way to play this specific sound to a player? https://youtu.be/DzhhlHw2q2o?t=367

✔️ It's time to crown the SCARIEST SOUND in Minecraft... 👑

5️⃣ My Top 5 Series Playlist: https://www.youtube.com/watch?v=d2_9Z4ygwjs&list=PLX_aRMYRR9a6lU6tG1raGL2na2jwrTWoj&index=2

👉🏻 Facebook: http://www.facebook.com/mrcubey
👉🏻 Twitter: https://twitter.com/Cubey_YouTube
🎬 JOIN MY TEAM: https://cubezoneserver.enjin.com/

💎 Special Mentions:
• ...

▶ Play video
earnest forum
#

play around with the /playsound command in game

#

try to find the sound you want

#

that sound doesn't have a clear name mapped to it

#

its gonna be somewhere under ambient cave

iron glade
#

-.-

#

so there's no way to play this sound everytime with a 100% chance?

earnest forum
#

no

#

use the playsound command to find the ID of that sound

iron glade
#

ok

earnest forum
#

wait no

#

unfortunately there's only 1 cave sound

#

and yes it is randomized

#

Sound.AMBIENT_CAVE

iron glade
#

bruh#

earnest forum
#

does anybody know why this is happening?

quaint mantle
#

it says its too large

earnest forum
#

its a long isn't it?

#

thats only 57 billion

quaint mantle
#

add L to the end of it

earnest forum
#

ah thats cringe

quaint mantle
earnest forum
#

thanks

quaint mantle
#

yeah java doesnt like implicit conversions

earnest forum
#
String numAfter = String.format("%,d", num);
#

is the number too big, or is the keyword wrong?

blissful pumice
#

d isn't a double

earnest forum
#

what should i use then

blissful pumice
#

a double

earnest forum
#

num is a double

quaint mantle
#

try %f

earnest forum
#

this isn't the formatted string

quaint mantle
#

it uses scientific notation

earnest forum
#

can i force it to use regular notation?

quaint mantle
#

just use Long.toString

#

or Double.toString

earnest forum
#

Double.toString still returns the scientific notation

short raptor
#

How can I return nothing as a tab complete for my command? Say it's a command like /msg Person and then they type whatever they want, how can I just make it blank

#

If I return null then it's the automatic name option things

iron glade
quaint mantle
summer scroll
#

Just return empty list

short raptor
#

Yea I'm gonna do that

short raptor
#

Inconvenient much

warm saddle
#

Hey I'm getting this error when trying to use my PlayerJoinEvent listener: https://pastebin.com/h0RiFC32
Here is the code for the PlayerJoinEvent Listener:

@EventHandler
    public void onPlayerJoin(PlayerJoinEvent e) {

        Player p = e.getPlayer();
        if(config.contains(p.getUniqueId() + ".joinMessage")) {
            e.setJoinMessage(customMessage.colourize(Objects.requireNonNull(config.get(p.getUniqueId() + ".joinmessage")).toString()));
        }
    }```

Any ideas would be greatly appreciated
iron glade
#

what's line 24?

#

.joinmessage

#

you have a typo there

#

capitalize the M

warm saddle
#

yeah i just found that

#

thank you :)

summer scroll
iron glade
#

np

ivory sleet
trail pilot
#

maybe should be like

if (cmd.getName().equalsIgnoreCase("bilgi")) {
if (!(sender instanceof Player)) {

            sender.sendMessage("§cThis command for only players.");
            return true;
        }
 Player player = (Player) sender;

 if (player.hasPermission("ServerOperator")) {
//code
}
}```
#

So what's you want to do?

earnest forum
#

get a player as an argument?

#

do Bukkit.getPlayer(args[0])

#

args[0] being the first argument

#

assumign that it is a correct name of a player you will get the object

#

if the name doesnt belong to a player it will be null

#

make sure to check if it is null and tel the player teh correct syntax

opal juniper
#

Yep ^

#

then, if you add a tab completer you can have it suggest all the names of online players

earnest forum
#

it automatically does that actually

#

as a default tab complete

#

its toggleable in server.properties

opal juniper
#

oh yeah ahahaa

#

forgot about that

earnest forum
#

thing is, that tab complete also comes up for any argument

#

(if the tab complete isnt overrided)

opal juniper
#

player.hasPermission("ServerOperator") == player.isOp()

earnest forum
#

really no need to send ur ENTIRE file

#

including imports and stuff

#

it's more something like

#
Player target = Bukkit.getPlayer(args[0])
#

here you get the player and assign it to a variable

#
if (target == null){
  player.sendMessage("Incorrect syntax! /command <player>");
}
#

make sure to check if the player is null

#

because if args[0] does not equal a name of a player

earnest forum
#

then you just tell the player how to correctly use the command

#

if target isn't null

#
if (target == null){
  player.sendMessage("Incorrect syntax! /command <player>");
} else {
  //DO SOMETHING COOL
}
#

use the target variable whenever you need to

iron glade
hybrid spoke
#

already over

iron glade
#

anyone knows how to make a better looking "N" with dimension 7x5?

hybrid spoke
iron glade
#

This is general so who cares

hybrid spoke
iron glade
#

no you don't understand

#

this is general

hybrid spoke
#

i do

#

but anyways

#

we are developers

#

we cant do anything else than that

#

what are blocks? code blocks?

iron glade
#

yes indeed

golden kelp
#

um guys, i m tryna add a custom inventory but my click events are returning when checking if its the same inv

golden kelp
#
public RewardGUI() {
        inv = Bukkit.createInventory(null, 9, "Daily Rewards");
        initializeItems();
    }

the contructor

@EventHandler
    public void onInventoryClick(final InventoryClickEvent e) {
        e.getWhoClicked().sendMessage("Clicked");
        if (!e.getInventory().equals(inv)) return;
        e.getWhoClicked().sendMessage("You clicked on an item!");
        e.setCancelled(true);
        
        int[] bgSlots = {0, 6, 8};
        for (int slot : bgSlots)
            if (e.getSlot() == slot) return;
        e.getWhoClicked().sendMessage(e.getSlot() + "");
        Util.reward(
            (Player) e.getWhoClicked(),
            Util.getPlayerRank(
                (Player) e.getWhoClicked()
            )
        );
    }

the event

#

and it is registered, it just returns on equal check

hybrid spoke
# iron glade

you could make the top left and top right to half stones

#

and remove some stairs so it looks less bend

iron glade
#

I'll try

thorny dawn
#

can i pass this in the task parameter on runTaskLater() to delay execution in a certain part in my runnable?

hybrid spoke
golden kelp
#

i mean it is, as i call the same inventory when i want to open it

hybrid spoke
#

probably not. e.getInventory() is the whole inventory (top and bottom) while your inv is just the top one

#

compare the top inventory with yours

hybrid spoke
#

or what do you mean

#

uppercase bukkit

iron glade
#

isn't something underlined in red for you?

earnest forum
#

Change the incorrect syntax message to whatever you like bro

#

I just put it there for example

iron glade
#

^

golden kelp
# hybrid spoke probably not. e.getInventory() is the whole inventory (top and bottom) while you...

Did some debugging
It says cant pass the event as its null (after line 4 in the func)

 @EventHandler
    public void onInventoryClick(final InventoryClickEvent e) {
        e.getWhoClicked().sendMessage("Clicked");
        e.getInventory().forEach(x -> e.getWhoClicked().sendMessage(x.getType().toString()));
        //its executed till the above line, and here it throws a error
        e.getWhoClicked().sendMessage("Clicked--");
iron glade
#

the syntax is correct, you should tell the executer that this player is not online or smth like that

golden kelp
#
[15:29:48] [Server thread/ERROR]: Could not pass event InventoryCreativeEvent to RewardsPlugin v1.0
org.bukkit.event.EventException: null
        at org.bukkit.plugin.java.JavaPluginLoader$1.execute(JavaPluginLoader.java:310) ~[spigot-api-1.18.2-R0.1-SNAPSHOT.jar:?]
        at org.bukkit.plugin.RegisteredListener.callEvent(RegisteredListener.java:70) ~[spigot-api-1.18.2-R0.1-SNAPSHOT.jar:?]
        at org.bukkit.plugin.SimplePluginManager.fireEvent(SimplePluginManager.java:589) ~[spigot-api-1.18.2-R0.1-SNAPSHOT.jar:?]
        at org.bukkit.plugin.SimplePluginManager.callEvent(SimplePluginManager.java:576) ~[spigot-api-1.18.2-R0.1-SNAPSHOT.jar:?]
        at net.minecraft.server.network.PlayerConnection.a(PlayerConnection.java:2611) ~[spigot-1.18.2-R0.1-SNAPSHOT.jar:3483-Spigot-42b6152-9cc7d76]
        at net.minecraft.network.protocol.game.PacketPlayInSetCreativeSlot.a(SourceFile:18) ~[spigot-1.18.2-R0.1-SNAPSHOT.jar:3483-Spigot-42b6152-9cc7d76]
        at net.minecraft.network.protocol.game.PacketPlayInSetCreativeSlot.a(SourceFile:7) ~[spigot-1.18.2-R0.1-SNAPSHOT.jar:3483-Spigot-42b6152-9cc7d76]
        at net.minecraft.network.protocol.PlayerConnectionUtils.lambda$0(PlayerConnectionUtils.java:31) ~[spigot-1.18.2-R0.1-SNAPSHOT.jar:3483-Spigot-42b6152-9cc7d76]
        at net.minecraft.server.TickTask.run(SourceFile:18) ~[spigot-1.18.2-R0.1-SNAPSHOT.jar:3483-Spigot-42b6152-9cc7d76]
        at net.minecraft.util.thread.IAsyncTaskHandler.d(SourceFile:157) ~[spigot-1.18.2-R0.1-SNAPSHOT.jar:3483-Spigot-42b6152-9cc7d76]
earnest forum
#

You can use getOfflinePlayer and then check if the player is online so the user can have more clarity

#

because if the user just doesn't exist at all a "player offline" message is a bit misleading

#

it isn't too big of a deal though

iron glade
earnest forum
#

Then again, the inverse is also true

hybrid spoke
earnest forum
#

if the player is offline it would say "can't find that player"

#

Also misleading

hybrid spoke
#

you want to use InventoryClickEvent#getView#getTopInventory

golden kelp
#

Oh

iron glade
#

but I know what you mean

thorny dawn
#

can someone help me with dependancy injection im punching my fucking head right now

hybrid spoke
#

getPlayer and checking for null is the best solution here

#

no need for getOfflinePlayer

undone axleBOT
thorny dawn
hybrid spoke
#

so whats the question

trail pilot
#

sad

#

im too slow and someone answered :'

thorny dawn
trail pilot
#

yes

opal juniper
#

?main

golden kelp
#
        if(!e.getView().getTopInventory().equals(inv)) return;

is same as well

thorny dawn
trail pilot
thorny dawn
#

like im trying to run runTaskLater(plugin, runnable, delay)

#

what would i put in plugin

hybrid spoke
trail pilot
golden kelp
trail pilot
#

its just basic code

hybrid spoke
#

not sure for what the equals method is checking

thorny dawn
golden kelp
#

nvm thats not what i thought it is

trail pilot
hybrid spoke
#

since the equals method of CraftInventory refers to the one of the IInventory impl

thorny dawn
#

and then i use pl?

trail pilot
earnest forum
opal juniper
earnest forum
#

has anyone else been having issues with Windows 11 freezing

#

been happening quite a lot recently

trail pilot
#

import?

earnest forum
#

is it imported

earnest forum
#

only if you want to use it in the future

trail pilot
earnest forum
#

so import it

#

lmao

eternal oxide
#

maven?

trail pilot
earnest forum
#

but how can they create a whole command executor class while being new

trail pilot
#

but minecraft need an good java basic

earnest forum
#

hover on Bukkit and click import

#

might need to press "more actions"

trail pilot
#

if you know whats an if is

earnest forum
#

So is importing something

thorny dawn
#

so far my CountdownInit class looks like this

#

what do i need to add to main?

trail pilot
#

omg why kotlin?

#

i dunno how to do that

trail pilot
#

ig

#

i dunno sorry, i really hate kotlin

thorny dawn
#

lol

trail pilot
#

yes

#

just use java

thorny dawn
#

myInstance being..?

hybrid spoke
opal juniper
#

oh aha, didnt see

trail pilot
# thorny dawn myInstance being..?

lemme do it in java

public Main plugin;

public CountdownInit(Main plugin) {
this.plugin = plugin:
}
}```


```public class Main extends JavaPlugin {

public CountdownInit countdownInit;

public Main() {
countdownInit =  new CountdownInit(this);
}
}```

translate it in kotlin
#

bad syntax but its work

thorny dawn
#

yeah i know basic java syntax ill convert it

trail pilot
#

alright

earnest forum
#

anyone know how to get the nms Level object

thorny dawn
# trail pilot alright

i converted what u sent to kotlin, now how would i do to get the plugin instance from the countdownInit class?

earnest forum
#

nvm

trail pilot
#

example

spigotMethod(plugin, param, param);

will be like

spigotMethod(this.plugin, "im cool", "idk");

#

in the class CountdownInit

thorny dawn
#

it seems to not shoot any errors, thanks a lot

#

coming from functional programming and being an amateur to oop, this hurt my brain so much lol

earnest forum
#

why 😭

trail pilot
earnest forum
#

spigot removed named methods in i think 1.17

#

for nms

trail pilot
#

ah

thorny dawn
trail pilot
#

i hate kotlin

thorny dawn
#

should i set it to null instead?

trail pilot
#

yes

#

yes

#

val main = Main: null?

#

like that ig

#

should work

harsh jasper
#

Hi, I'm trying to figure out why my entity randomly stops ticking. In the net.minecraft.world.entity.ai.control.MoveControl class public void tick() stops being called and my entity freezes. I've profiled and found nothing that is freezing the server. Everything continues as normal but my entity freezes for a few seconds.

thorny dawn
#
  • val main: Main? = null
#

but i like the spirit

#

haha

trail pilot
thorny dawn
#

o

trail pilot
#

kotlin is bad owo

#

but sometimes is better

thorny dawn
#

i have a love hate relationship with it

#

it helped me a lot with copying directories

#

instead of having to write an entire output stream or however yall java people call it

trail pilot
#

yes

#

@thorny dawn now its work?

thorny dawn
#

sec

#

im reloading the server

trail pilot
#

alright

thorny dawn
#

how nice

trail pilot
#

tf

#

remove else if at head

#

its if then else if and at the end else @quaint mantle

trail pilot
trail pilot
#

try this one

thorny dawn
#

on here?

trail pilot
#

where its say null

trail pilot
#

what the hell kotlin oop its hard af

ivory sleet
#

It’s not different from Java tho

#

A bit more concise

trail pilot
#

yes but its hard for me

#

like my kotlin plugin are copy and paste lol

earnest forum
#

looks a lot like js to me

trail pilot
#

or from java to kotlin

earnest forum
#

havent seen much kotlin tho

ivory sleet
earnest forum
#

its like java code represented through javascript syntax

trail pilot
#

never tested dart

#

@thorny dawn so now?

harsh jasper
#

Anyone know if theres a website for nms mappings?

#

this obfuscated shit is killing me

trail pilot
#

i dont think so

ivory sleet
#

And yes there are some websites

#

But they mostly just show the change throughout different versions, I’d recommend using some sort of remapper when you develop your project, much more convenient (gradle with paperweight or maven with specialsource)

harsh jasper
#

I wish this plugin was using paperweight but it seems their using spigotmc:minecraft-server

lament swallow
#

can i hide team prefix with team.setOption(Team.Option.NAME_TAG_VISIBILITY, Team.OptionStatus.NEVER);?

summer scroll
#

End your pain friend...

harsh jasper
#

saved me hours of effort

summer scroll
#

is that a compile error?

sage dragon
#

Please paste some more code

summer scroll
#

Maybe your code is outside the scope or something or maybe you have return on the above.

sage dragon
#

I actually meant the code above if (args.length....

summer scroll
#

Send full class

#

?paste

undone axleBOT
sage dragon
#

You wrote your if under return true; which makes it unreachable.

The code ends at Return

#

Also... Your Permission Check does basically nothing 😅

lament swallow
#
Scoreboard scoreboard = getServer().getScoreboardManager().getMainScoreboard();
Objective objective = scoreboard.registerNewObjective("test", "dummy", ChatColor.YELLOW + "Dev server");

objective.setDisplaySlot(DisplaySlot.PLAYER_LIST);
Score score = objective.getScore(ChatColor.GOLD + "A" + ChatColor.GREEN + 1);

score.setScore(1000);

for (Player player : getServer().getOnlinePlayers()) {
    player.setScoreboard(scoreboard);
}

For some reason my score is still 0 when i log on the server?

trail pilot
#

🟣Developer

#

lol

hybrid spoke
#

He/Him - Hetero - EUW

#

lol

earnest forum
#

maybe like 10

#

do you actually know what setting the score does.?

sage dragon
#

That looks better

lament swallow
earnest forum
#

it basically sets its position on the scoreboard

#

you use score as a value if you're using vanilla scoreboards

#

0 = top of the scoreboard

#

anything above 0 is presented chronologically downwards on the scoreboard

lament swallow
#

hmm

earnest forum
#

wait

#

let me find an example

lament swallow
#

when both my account join they still get '0' as their score

earnest forum
#

because im like 90% sure you cant have a score as 1000

#

nevermind

#

its the opposite

#

0 is at the bottom

#

and all scores above 0 go upwards

#

see the red numbers on the right

#

that is what setScore does

#

so if you want to show a line at the bottom of a scoreboard set it's score to 0

#

or 1

lament swallow
#

hmm

#

i'm using the main scoreboard

#

the tablist

summer scroll
#

I actually once saw scoreboard with all 0 scores and it has 10+ lines.

lament swallow
#

and displaying an objective

hybrid spoke
#

he probably wants to set the number to something bigger which is done by packets iirc

lament swallow
#

can't send files here?

hybrid spoke
#

not if you are not verified

earnest forum
#

ah wait you're using player list

#

never mind

#

ive never touched them before

summer scroll
#

?paste

undone axleBOT
sinful rapids
#

"tk/sourcenetwork/ProvaPlugin has been compiled by a more recent version of the Java Runtime (class file version 61.0), this version of the Java Runtime only recognizes class file versions up to 52.0"
How to install?
I use java18

earnest forum
#

what spigot version

#

are you using

lament swallow
#

me?

sinful rapids
#

1.12.2

lament swallow
#

lastest

earnest forum
sinful rapids
#

ah

#

java8?

earnest forum
#

yes

sinful rapids
#

Ok, thanks

lament swallow
#

so i can't display a score next to a player name in tablist?

#

or is it

#

like very hard

earnest forum
#

im not sure

#

like i said never touched them before

hybrid spoke
#

tablist?

#

does the tablist even have a score?

lament swallow
#

main scoreboard

earnest forum
#

i doubt it

hybrid spoke
#

just teams or not

lament swallow
#

i think it does

earnest forum
#

you cant add dummy scores to tablist i dont think

#

i mean like

#

ones that have text

sinful rapids
#

oh

earnest forum
#

those are for sidebar

lament swallow
#

a server i play on does it

earnest forum
#

show a screenshot of it?

hybrid spoke
#

you can sort the teams by a "score"

lament swallow
#

can't send files :/

earnest forum
#

dms

#

ill send it here

sinful rapids
summer scroll
#

Your have a code under a return statement, so it's unreachable, because the code stop at the return.

sinful rapids
earnest forum
lament swallow
#

yea so i have 0 score

#

as the yellow number

#

and i need to set it to a number but don't know how

summer scroll
#

Place the return in the correct location

hybrid spoke
lament swallow
#

enlighten me on how to do dis

lament swallow
summer scroll
#

?learnjava

undone axleBOT
summer scroll
#

It is a simple java syntax

hybrid spoke
lament swallow
#

ty

short raptor
#

It doesn't seem like getConfig().getString("music.2volt.desc"); will find this string. Am I missing something?

short raptor
#

Is that breaking it?

summer scroll
#

It should look like this

music:
  2volt:
    desc: "Test"
summer scroll
short raptor
#

Alright I'll try

short raptor
golden kelp
#

can anybody suggest a inventory gui plugin

drowsy helm
#

as in api?

eternal oxide
#

?stash

undone axleBOT
hybrid spoke
#

?notworking

undone axleBOT
#

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

hybrid spoke
#

you probably return anywhere before

#

so its not reachable

#

show us your code

#

?paste

undone axleBOT
eternal oxide
#
  • magic 8-ball says* before the code you just showed
hybrid spoke
eternal oxide
#

line 53

hybrid spoke
#
                } else {
                    player.sendMessage(ChatColor.DARK_GRAY + " " + ChatColor.BOLD + "⬛ " + ChatColor.GREEN + "Player's Authority Status: " + ChatColor.GOLD + "Not Operator");
                }
                }
        return true; // <--- anything past here isnt reachable
                if (args.length == 1) {
                    Player target = Bukkit.getPlayer(args[0]);
                        if (target == null) {
                             player.sendMessage("Incorrect syntax! /command <player>");
                        } else {
                            target.sendMessage(ChatColor.AQUA + getName());
                        }
                }
carmine valley
#

hey guys, I made the following class to gradually increase a player's knockback, the problem with that code is that it knocks the player to the direction they are looking at, not like natural knockback where it knocks based on the direction of the hitter when he hit, the second problem is that it stops knocking back more once it reaches 9 blocks of knockback, how can I fix these problems? ```cpp
public class Knockback implements Listener {
byte heatValue = 0;
@EventHandler
public void onPlayerHitPlayer(EntityDamageByEntityEvent event){
if(event.getDamager() instanceof Player && event.getEntity() instanceof Player){
heatValue++;
event.getEntity().setVelocity(event.getEntity().getLocation().getDirection().multiply(heatValue));
}
}

eternal oxide
#

you need to get teh Vector from the attacker to the defender, not getDirection()

carmine valley
hybrid spoke
#
  1. use the damagers direction
  2. you probably want to normalize it
  3. why are you increasing heatValue everytime there is a hit?
carmine valley
#
  • what about the +9 blocks knockback issue
eternal oxide
#

sample code for you to pull apart and use```java
public void setTarget(final Projectile projectile, final Location targetLoc) {

    final Vector velocityVector = targetLoc.toVector().subtract(projectile.getLocation().toVector());
    velocityVector.normalize().multiply(projectile.getVelocity().length());
    projectile.setVelocity(velocityVector);
}```
carmine valley
#

what's the purpose of normalizing it?

eternal oxide
#

ensures the vector has a length of 1

carmine valley
#

I see

#

would that solve the +9 blocks of KB?

hybrid spoke
eternal oxide
#

1 = 1 block, so multiply for whatever knockbak you want

carmine valley
hybrid spoke
#

but you do know that will apply for any player to be hit

carmine valley
#

like all players?

hybrid spoke
#

yes

carmine valley
#

yeah I understand that

hybrid spoke
#

if you hit me 10 times, the next hit on any player will throw him 11 blocks

carmine valley
#

I might narrow it down later to a certain tool, maybe like wooden shovel

#

and make it reset each time a player dies

#

the latter is still to be researched

hybrid spoke
#

so its player based and not global for everyone?

carmine valley
#

it's for a mini game basically

#

but I'm trying to make it global for now

hybrid spoke
#

smash

carmine valley
#

then I can narrow it down

hybrid spoke
#

alright

carmine valley
carmine valley
earnest forum
#

?paste

undone axleBOT
midnight shore
#

Can someone help me adding a new sound to minecraft? I have everything i need but it doesn't show up in minecraft

midnight shore
#

no this is with resourcepacks

#

and i'm using it in sp for testin

midnight shore
#

i'm not coding this

#

i just want to fix the resource pack

humble tulip
#

Ohh

#

I'm not sure then

#

Add it to sounds.json

humble tulip
#

Did you add it to sounds.json?

sinful rapids
#

How set color leather armor?

humble tulip
#

Get the meta

quaint mantle
#

any ideas how to add a simple delay for placing blocks

humble tulip
humble tulip
quaint mantle
#

Yes

midnight shore
quaint mantle
#

So a player can place a block every () seconds/ms

humble tulip
#

Ohh you mean a cooldown

quaint mantle
#

Yea

humble tulip
humble tulip
# quaint mantle Yea

When they place a block and u allow it, add them to a map<uuid, long> with currentimeinmillis

midnight shore
humble tulip
#

Then when they try to place again check if they're in the map

#

And check if the time in millis - map.get(player) > your cooldown in ms

#

If it is, allow to place and update the map

#

Else just cancel

#

Alternatively, you can add them to a set and schedule a runnable to remove themnafter x ticks

subtle folio
#

hey gamers

#

i got a question

humble tulip
#

Hey ntdi

#

I've got two hands

subtle folio
#

if i were to make custom mobs and want to keep em within a certain radius, what would be my approach?

carmine valley
#

I got the knockback how I wanted, but it knocks the player back to the opposite natural knockback direction, how do I reverse this movement / snippet: event.getEntity().setVelocity(event.getDamager().getLocation().toVector().normalize().subtract(event.getEntity().getLocation().toVector()).normalize().multiply(heatValue)); is there a method to reverse it? and if so where should I place it?

subtle folio
#

should i check if they are within a radius everytime they move?

humble tulip
crimson terrace
subtle folio
#

yeah

#

so they dont want outside of an area

eternal oxide
carmine valley
eternal oxide
#

yep

subtle folio
#

any thoughts or should i just do the ladder?

crimson terrace
#

hold on

#

this may help

subtle folio
#

Oh alright

crimson terrace
#

possibly set the target semi randomly near the center and set the navigation to that target whever they get close to or over the line you dont want them to cross

subtle folio
#

That looks fun, should I just use a radius to check if they've crossed over their line?

crimson terrace
#

you could stop their movement when they get close, then reverse it a bit and possibly let them walk back a bit in order to make it look more natural

#

as if they themselves decided to walk back

subtle folio
#

my issue was just checking if they get close to the radius

#

but yeah I hear you out

crimson terrace
#

move event

subtle folio
#

thats what I'll do

#

got it thanks 🙂

crimson terrace
#

np 😄

#

maybe make your own event which you fire whenever the entity, which you want to restrict, moves. thats probably the best way to keep the code clean in that

subtle folio
#

perhaps, I'm a messy code enjoyer 😛

crimson terrace
#

its nice having events which you can convey extra information with. possibly give the custom event the bounding box the entity is not supposed to leave

subtle folio
crimson terrace
#

😄

mellow edge
#

can I store hashmap into an FileConfiguration

#

and if I can how can I get it from config

eternal oxide
#

yes

#

getConfigurationSection(path).getValues(true)

#

Unless you just added it, then its still in a Map form

#

a Map added to the Config is not converted to a MemorySection until you save/reload

#

a bug

mellow edge
#

the user will manually add the strings in it

#

so thats not rly a problem

eternal oxide
#

I just throw it through this method to ensure I get a Map ```java
/**
* If loading from file the Maps in the data
* will be stored as a MemorySection not Maps.
*
* @param entry MemorySection or Map to check.
* @return Map containing the serialised data.
*/
@SuppressWarnings("unchecked")
protected Map<String, Object> castToMap(Object entry) {

    if (entry instanceof MemorySection) {
        return ((MemorySection) entry).getValues(true);
    } else {
        return (Map<String, Object>) entry;
    }
}```
carmine valley
# eternal oxide yep

I tried that and it didn't work, it now knocks back the entity to a fixed direction event.getEntity().setVelocity(event.getEntity().getLocation().toVector().normalize().subtract(event.getDamager().getLocation().toVector()).normalize().multiply(heatValue));

eternal oxide
#

it should reverse the direction. This code calculates the vector between two Entities

#

else just multiply by a negative value

#

-heatValue

carmine valley
#

I will try that

chrome beacon
#

?notworking

undone axleBOT
#

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

chrome beacon
#

Anyways did you register the listener

humble tulip
#

They probably didn't

vocal cloud
#

As is tradition

green prism
#

hey mike

vocal cloud
#

Sup

harsh totem
#

I know it isn't related to spigot but can anyone help me with js?

green prism
#

did u ever use the phoenix616's inventorygui api?

chrome beacon
#

?eventapi

undone axleBOT
harsh totem
vocal cloud
chrome beacon
green prism
#

olivo? and you?

#

did you ever used that api?

carmine valley
eternal oxide
#

it will be knocked back away from the hitter

#

Nothing wrong with the code. It has to be however you are implementing it

carmine valley
#

but why is the direction fixed

eternal oxide
#

its not fixed

#

every hit you recalculate

carmine valley
#

but it always knocks the player in a fixed direction, which happens to be the direction of the first hit

eternal oxide
#

you get teh correct direction by either subtracting the damager from entity or vice versa

#

each will give opposite directions

#

if you always go one direction you are not doing it correctly

#

you are not recalculating the vector

sharp flare
#

is there any way to add input barter for the piglin

carmine valley
#

when I changed them in places of each other it broke it and knocked in a fixed direction

eternal oxide
#

Show some code as you are not listening

#

?paste

undone axleBOT
carmine valley
#

what I sent is the only method in code

eternal oxide
#

Your implementation of that snippet is wrong. show how you are using it

carmine valley
# eternal oxide Your implementation of that snippet is wrong. show how you are using it
public class Knockback implements Listener {
    int heatValue = 0;
    @EventHandler
    public void onPlayerHitPlayer(EntityDamageByEntityEvent event){
        if(event.getDamager() instanceof Player && event.getEntity() instanceof Player){
            heatValue++;
     
event.getEntity().setVelocity(event.getEntity().getLocation().toVector().normalize().subtract(event.getDamager().getLocation().toVector()).normalize().multiply(heatValue));
eternal oxide
#

um

carmine valley
#

this is the snippet that "should" work but doesn't

eternal oxide
#

no ; after heatValue++

carmine valley
#

it's there

#

just a mistake while copying and pasting

eternal oxide
#

I must be blind

carmine valley
#

I meant in the code

eternal oxide
#

show me the actual full method

#

?paste

undone axleBOT
carmine valley
#

not what I pasted

ivory sleet
humble tulip
#

The knockbqck direction is gonna be away from the origin of the world

eternal oxide
#

yeah thats not going to work

humble tulip
#

GetLocation.getDirection.normalise

eternal oxide
#

you normalized the event.getEntity().getLocation().toVector().normalize()

humble tulip
#

Wait nvm

#

Just read ur code

eternal oxide
#

thats a Location vector not a direction

#

remove teh .normalize() on that

mellow edge
#

thanks @eternal oxide it worked!

#
command-list:
  dgf: KLEKLAM
  asd: kakam

carmine valley
#

so like that event.getEntity().setVelocity(event.getEntity().getLocation().toVector().subtract(event.getDamager().getLocation().toVector()).normalize().multiply(heatValue));

eternal oxide
#

yes

carmine valley
#

lemme try that

#

so the normalize method made it that it knocks back in a fixed direction?

eternal oxide
#

yes, it was calculating the Vector from near 0,0,0 to your other full location

humble tulip
#

Normalise makes the magnitude 1

#

I'm pretty sure

eternal oxide
#

yep, which move it to teh spawn chunk (basically)

#

a Listener has no onEnable

humble tulip
#

Extend javaplugin

iron glade
#

Is that your main class?

#

then remove the onEnable() part

tender shard
#

also

registerEvents(Join, this);

wtf is that supposed to be

iron glade
#

and put the event registration into your main class into your onEnable

#
PluginManager pm = Bukkit.getPluginManager();
        pm.registerEvents(new YourEventClass(), this);```
ivory sleet
humble tulip
iron glade
#

This code doesn't make much sense

ivory sleet
humble tulip
#

Did you give it to yourself?

ivory sleet
#

Yes

humble tulip
#

Also listen to the blockplaceevent

#

Check if the item in hand is similar to your item

#

If it is

#

Cancel event

ivory sleet
#

Okay thx ^^

eternal oxide
#

Note: they will be able to place it using a dropper

ivory sleet
#

I can disable that?

humble tulip
#

yes with blockdispenseevent

#

check if the block is a dropper

#

check if the item is your item

#

then cancel

carmine valley
# eternal oxide yes

it works great, thank you very much, but after it reaches 18 blocks of knockback it stops there and doesn't get any higher, is it possible to take it beyond that or is that some final variable I can't change?

carmine valley
#

is velocity the only thing that alters kb?

humble tulip
#

Well kb is just modifying the players velocity

#

How far back the player goes depends on their velocity

#

There is no set number of blocks

carmine valley
#

seeing that it stops at 18 blocks, it must be the maximum velocity right?

humble tulip
#

18 blocks is not a velocity

#

But u can try to hardcode some insane values

carmine valley
#

18 blocks is the result of the max velocity I understand that

humble tulip
#

Like set your velocity to 100,5,100

#

And see if you go 18 blocks

carmine valley
#

I will also check if a kb enchantment on a sword alters that too

humble tulip
#

Wait.. I used high kb enchants and players moved more than 18 blocks

carmine valley
#

because I know for a fact kb 1000 sends the entity so far

humble tulip
#

Yeah

#

Well print the velocity you're setting

#

And see if it stoos going up at some point

#

Or maybe you need to add a bit more to the y value

carmine valley
#

if that's the case, I will have to rely on gradually higher kb enchantments

humble tulip
#

Try adding some more to the y value

carmine valley
#

how tho? my code doesn't have an x or y value

humble tulip
#

So they take longer to hit the ground, thus more time to fly back

carmine valley
#

oh wait

#

setVelocity has more than one parameter?

humble tulip
#

it takes a vector

carmine valley
#

have I been using only the x parameter

humble tulip
#

U can add to the vector

#

.add(x,y,z)

carmine valley
#

I already have .subtract

humble tulip
#

U can do add(0,1,0

#

)

humble tulip
#

And see if the max increases

carmine valley
#

I can't add it

#

I get an error

#

or do I do new Vector(0,1,0)

#

yeah that worked

humble tulip
#

Yes

#

This is just to test btw

#

Won't give u desired results

carmine valley
#

yeah just so we see if it goes beyond 18

#

oh it sent them like 7 blocks high

#

maybe 1 is too big of a value

humble tulip
#

Yeah ik but did they go more than 18?

carmine valley
#

wait now it's back to normal

#

weird

#

lemme see the max and get back to ya

#

oooh I know why it sent them so high up at first

#

the /tp anti-vulnerability misses with the code for some reason, so I always have to wait before I hit an entity

hybrid spoke
#

try Integer.MAX_VALUE youknow

humble tulip
#

Lmfao imagine just constantly going up

carmine valley
#

nope still 18

humble tulip
carmine valley
#

nope, only if I hit shortly after /tp

humble tulip
#

Can i see where u set the velocity?

carmine valley
#

the code you mean?

humble tulip
#

Yes

carmine valley
#
event.getEntity().setVelocity(event.getEntity().getLocation().toVector().subtract(event.getDamager().getLocation().toVector()).normalize().multiply(heatValue).add(new Vector(0,1,0)));
humble tulip
#

That's weird

#

It should mkve them up

carmine valley
#

should I pump the number to 2 and see what happens?

humble tulip
#

Make it 5

#

And see what happens

carmine valley
#

aight

subtle folio
#

Is there a lib for making custom crafting recipes?

humble tulip
#

Spigot api😂😂

hybrid spoke
#

.setY

#

will make them go up

carmine valley
#

yup still 18 blocks and no change in the vertical velocity at all

hybrid spoke
#

or down

humble tulip
#

Not sure what

#

Print the velocity before you set it

carmine valley
#

yeah maybe the .add is not in the right place

humble tulip
#

It is

hybrid spoke
#

set the Y of the applied vector

humble tulip
#

Maybe the y is negative

carmine valley
#

so .setY(?)

hybrid spoke
#

<=0 means no movement up

#

so you probably want >=1

humble tulip
#

Set the y to 1 or 2

carmine valley
#

and where do I add that method? to the end also?

#
  • do I get rid of the .add?
hybrid spoke
carmine valley
#

oh to the vector

carmine valley
humble tulip
#

Yeah get rid of the add

#

And set the y

carmine valley
#

event.getEntity().setVelocity(event.getEntity().getLocation().toVector().setY(2).subtract(event.getDamager().getLocation().toVector()).normalize().multiply(heatValue));

humble tulip
#

No set the y last

#

After multiply

carmine valley
#

event.getEntity().setVelocity(event.getEntity().getLocation().toVector().subtract(event.getDamager().getLocation().toVector().setY(2)).normalize().multiply(heatValue));

#

?

#

oh after multiply?

humble tulip
#

Ye

carmine valley
#

any idea why I get this error when I try to build the jar?

tender shard
#

or the directory

carmine valley
#

nothing that I can see

tender shard
#

hm. anyway, it simply means that maven couldnt delete that file because windows is weird again. it can however overwrite existing files so shouldnt be any problem

carmine valley
#

so the build is done?

tender shard
#

depends, did it say BUILD SUCCESS at the end?

carmine valley
#

oop, it compiled fine now

#

all my homies hate windows

mellow cedar
#

Is updating a player's compass pointing location known to be buggy when you do it on player join? The compass location coords seem to be set correctly but it doesn't point in the right direction until I right click on the compass.

#

I think I probably need to trigger an inventory update of some sort so it updates on the client side, but not sure how (I tried Player#updateInventory, no luck). Any advice would be appreciated 🙂

quaint mantle
#

[Spectaculation] Task #206 for Spectaculation v0.0.1-HEALTH generated an exception
java.util.IllegalFormatConversionException: d != java.lang.Double
at java.util.Formatter$FormatSpecifier.failConversion(Unknown Source) ~[?:1.8.0_333]
at java.util.Formatter$FormatSpecifier.printInteger(Unknown Source) ~[?:1.8.0_333]
at java.util.Formatter$FormatSpecifier.print(Unknown Source) ~[?:1.8.0_333]
at java.util.Formatter.format(Unknown Source) ~[?:1.8.0_333]
at java.util.Formatter.format(Unknown Source) ~[?:1.8.0_333]
at java.lang.String.format(Unknown Source) ~[?:1.8.0_333]
at me.superischroma.spectaculation.util.SUtil.formatNumber(SUtil.java:152) ~[?:?]
at me.superischroma.spectaculation.entity.SEntity$3.run(SEntity.java:125) ~[?:?]
at org.bukkit.craftbukkit.v1_8_R3.scheduler.CraftTask.run(CraftTask.java:71) ~[spigot.jar:git-Spigot-21fe707-741a1bd]
at org.bukkit.craftbukkit.v1_8_R3.scheduler.CraftScheduler.mainThreadHeartbeat(CraftScheduler.java:350) [spigot.jar:git-Spigot-21fe707-741a1bd]
at net.minecraft.server.v1_8_R3.MinecraftServer.B(MinecraftServer.java:723) [spigot.jar:git-Spigot-21fe707-741a1bd]
at net.minecraft.server.v1_8_R3.DedicatedServer.B(DedicatedServer.java:374) [spigot.jar:git-Spigot-21fe707-741a1bd]
at net.minecraft.server.v1_8_R3.MinecraftServer.A(MinecraftServer.java:654) [spigot.jar:git-Spigot-21fe707-741a1bd]
at net.minecraft.server.v1_8_R3.MinecraftServer.run(MinecraftServer.java:557) [spigot.jar:git-Spigot-21fe707-741a1bd]
at java.lang.Thread.run(Unknown Source) [?:1.8.0_333]

#

wat does dis mean?

golden kelp
ivory sleet
#

I'm sorry to disturb you

humble tulip
#

The cystom item code doesn't matter

#

We need to see your listener

ivory sleet
#

I didn't write a listener, i think

Ps: I don't know java I'm trying to learn

tender shard
carmine valley
humble tulip
echo basalt
ivory sleet
tender shard
ivory sleet
#

How :/

tender shard
#

you should probably start with something a bit easier than custom items though if you never used the event api

ivory sleet
#

I'll try to get there x)

echo basalt
#

make code that doesn't look like a rap battle pls :)

carmine valley
humble tulip
#

Save whatever your setting the velocity to in a vector variable

#

And print it

#

Then set the velocity

unreal sandal
#

Hello, I'm trying to loop all entries of a SQL table but I have a problem : When I do a while(result.next), the algorithm goes to the second entry and forgets the first. Has someone an idea. Sorry for my bad English.

summer scroll
echo basalt
#

man's packing

carmine valley
quaint mantle
#
public static Map<Integer, String> prefixes = ImmutableMap.of(
            7, "k",
            10, "M",
            13, "B");
    public static String formatNumber(double num){

        int length = Double.toString(num).length();

        String numAfter = String.format("%,d", num);

        for (int i : prefixes.keySet()){
            if (length > i) continue;

            if (length < i && length > 3){
                String prefix = numAfter.split(",")[0];
                if (prefix.length() == 1){
                    prefix += "."+numAfter.split(",")[1].charAt(0);
                }
                numAfter = prefix + prefixes.get(i);
                break;
            }
        }
        return numAfter;
    }

this @tender shard

tender shard
humble tulip
#
Vector v = event.getEntity().getLocation().toVector().subtract(event.getDamager().getLocation().toVector()).normalize().multiply(heatValue).setY(2);
sout(v);
event.getEntity().setVelocity(v);

@carmine valley

quaint mantle
tender shard
#

you have a double

#

use %f instead of %d

quaint mantle
#

thats it?

tender shard
#

yes

#

btw your IDE would have told you that too

quaint mantle
#

but i wanted the health to be in 2m format

tender shard
#

2m format?

quaint mantle
#

like from 2,00,000

#

to 2m

#

will it work if I change it to f?

crisp steeple
#

use NumberFormat then

tender shard
#

no, it would then show 2,000,000.000000

carmine valley
#

@humble tulip

#

that's very weird

#

it's clearly changing

quaint mantle
#

wait which method shows that?

#
  this.entity.setCustomNameVisible(true);
            this.task = new BukkitRunnable()
            {
                public void run()
                {
                    entity.setCustomName(ChatColor.RED + statistics.getEntityName() + " " + ChatColor.GREEN + SUtil.formatNumber(entity.getHealth()) +
                            ChatColor.WHITE + "/" + ChatColor.GREEN + SUtil.formatNumber(entity.getMaxHealth()) + ChatColor.RED + "❤");
                }
            }.runTaskTimer(Spectaculation.getPlugin(), 0, 10);
        }
    }``` this one shows the health of a mob like the display
quaint mantle
ivory sleet
#

I find that:

@EventHandler
public void onBlockPlace(BlockPlaceEvent event) {
    NBTItem nbtItem = new NBTItem(event.getItemInHand());
    if (nbtItem.getBoolean("IsCustomItem")) {
        event.setCancelled(true);
    }

}

but when i put that on my listener he doesn't work

Its for @tender shard o @humble tulip or another guy we can help me

carmine valley
steep cove
#

https://www.spigotmc.org/wiki/config-files/ Okay so I'm looking into making a config file for my plugin but I need a little bit of guidance on this because I'm not sure I'm making sense of the article. Down below where I'm doing the "custom configurations" it implies I should put all of my own config stuff in Main.java because that's the class that extends JavaPlugin... But my issue with that is that in order to write to-and-from the config I would have to somehow get data from other classes passed back up TO the Main.java since I can't access these methods outside of Main.java.. Would it not make more sense to make my own Config.java or something in that area?

eternal oxide
#

you can or use dependency injection

#

?di

undone axleBOT
quaint mantle
#

mfanlex

#

help!

ivory sleet
tender shard
#

?pdc

tender shard
#

PDC > NBT

quaint mantle
ivory sleet
#

I replace NBT by PDC its that?

tender shard
#

you should really learn basic java, then learn the basics of spigot, and THEN you should do your custom item plugin

quaint mantle
#

and then you can eat pizza

ivory sleet
carmine valley
#

hey guys, any idea why it only knocks the player back up to 18 blocks and then stops increasing the knockback after that? here is the code and the console output```cpp
public class Knockback implements Listener {
int heatValue = 0;
@EventHandler
public void onPlayerHitPlayer(EntityDamageByEntityEvent event){
if(event.getDamager() instanceof Player && event.getEntity() instanceof Player){
heatValue++;
Vector v = event.getEntity().getLocation().toVector().subtract(event.getDamager().getLocation().toVector()).normalize().multiply(heatValue).setY(2);
System.out.println(v);
event.getEntity().setVelocity(v);
// event.getEntity().setVelocity(event.getEntity().getLocation().toVector().subtract(event.getDamager().getLocation().toVector()).normalize().multiply(heatValue).setY(2));
}
}

}


console output: https://prnt.sc/x-kAXp-0ViJd
quaint mantle
#

tf