#help-development

1 messages · Page 1682 of 1

tardy delta
#

like 'sorry you can't do this'

#

or do i need ""

ivory sleet
#

''

waxen plinth
#

You can also just escape with \

tardy delta
#

oh ok

woeful crescent
#

Can anyone help me with this?

ivory sleet
#

?

waxen plinth
woeful crescent
#

Does calling damage with a source entity on a damageable call entitydamagebyentityevent?

waxen plinth
#

I doubt it

#

But you can fire the event yourself

woeful crescent
#

I didn't want it to fire

heavy void
#

Someone help me pls

waxen plinth
#

Make sure mob griefing is enabled

#

And set the yield to 2 or something

heavy void
waxen plinth
#

setYield(2)

silver shuttle
#

Is there a way to cancel a player right clicking? So say I want him to be able to right click once and not hold it, so he has to continuously click?

#

Like i know PlayerInteractEvent is cancellable, but how could I make it so he has to click multiple times and can not hold it

heavy void
waxen plinth
#

2f

#

Learn basic java please

ivory sleet
#

?learnjava

undone axleBOT
silver shuttle
# waxen plinth You can't

Really? Not even by adding the player to a list and check if he is on that list and remove him once he stops clicking or something?

waxen plinth
#

You can't distinguish between that and them clicking regularly

#

I guess you could assume anyone clicking exactly every 5 ticks or however far apart it is is holding right click

#

But you can't be 100% accurate

silver shuttle
#

ugh that's just as stupid as not being able to check if left click is held down...

quaint mantle
#

its client sided, if its more than 5 ticks its another interaction

waxen plinth
#

The client doesn't tell the server every input

ivory sleet
#

I mean players would be able to spoof clicking

silver shuttle
#

damn, so I guess all pistols are fully automatic .-.

ivory sleet
#

You could have some sort of toggleable mode

#

Auto or semi auto or whatever it’s called when it’s nor of those

waxen plinth
#

Fire by pressing Q

#

Lol

silver shuttle
#

that's reload xd

ivory sleet
#

🥲

silver shuttle
#

also horrible

waxen plinth
#

That wouldn't work either with key repeat

summer scroll
#

Set the guns on cooldown or something like that.

quaint mantle
#

double shift to crawl

silver shuttle
#

well they have a cooldown

#

but i want it to be so they have to click each time :(

rapid meteor
#

Bois how do I add my plugin to my server?

#

Spigot?

#

With yml.

silver shuttle
silver shuttle
rapid meteor
#

Oh sorry.

silver shuttle
#

wait

#

what do you mean exactly

rapid meteor
#

Like how do I add my plugin that contains a yml file?

silver shuttle
#

You mean you want to implement a resource for your plugin

ivory sleet
#

Embed it when creating the jar

silver shuttle
ivory sleet
#

Do u use eclipse or IntelliJ?

silver shuttle
#

I never used eclipse, is there a big difference in the process of creating config files?

rapid meteor
rapid meteor
#

Like bois I want to add my plugin to my server?

#

How do I do that?

ivory sleet
#

@eternal oxide

rapid meteor
#

Please?

ivory sleet
#

We need u eclipse guy

eternal oxide
#

Exporting or using Maven?

silver shuttle
rapid meteor
silver shuttle
#

alright, listen to ElgarL then

rapid meteor
#

ElgarL my guy.

#

Help me from this nightmare of a plugin.

eternal oxide
#

If you are not using maven and manually exporting your jar, put your plugin.yml in the root of your project. Then you have an option to tick what files to include when you export

rapid meteor
eternal oxide
#

put it in teh root, same place your .classpath file is

silver shuttle
#

Use IntelliJ with the minecraft plugin .-. So simple

#

@unreal quartz @quaint mantle I'm listening

unreal quartz
#

to

silver shuttle
#

to?

rapid meteor
#

I'm here what now?

eternal oxide
#

If your plugin.yml was in teh correct place it would be available on the right

unreal quartz
silver shuttle
#

wat

eternal oxide
rapid meteor
#

Should I paste it in here?

eternal oxide
#

yes

rapid meteor
#

How?

silver shuttle
#

?paste

undone axleBOT
rapid meteor
#

What should I paste it in to?

silver shuttle
eternal oxide
#

No, don;t "paste" it in this channel

rapid meteor
#

No like in the folder.

eternal oxide
#

Its not in yoru project structure

rapid meteor
#

Should I paste it in to src?

#

Or in no folder?

#

Just raw in the directory?

eternal oxide
#

no folder it will 100% show up as an option. in a sub folder I don;t know.

#

Paste it in teh same place your .classpath is

rapid meteor
#

Yes.

#

I did let me try to see.

eternal oxide
#

then in Eclipse, F5 to refresh your project

rapid meteor
#

Then my plugin should work when I run?

#

Like with the .yml file?

eternal oxide
#

Working is a whole other kettle of fish

quaint mantle
#

What

rapid meteor
eternal oxide
rapid meteor
#

import org.bukkit.ChatColor;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.bukkit.plugin.java.JavaPlugin;

public class Main extends JavaPlugin {
    @Override
    public void onEnable()
    {
        
    }
    @Override
    public void onDisable()
    {
        
    }
    
    public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
        if(label.equalsIgnoreCase("hello")) {
            if(sender instanceof Player)
            {
                Player player = (Player) sender;
                player.sendMessage(ChatColor.RED + "Hey welcome to the server!");
                return true;
            } else {
                sender.sendMessage("Hey console!");
                return true;
            }
        }
        return false;
    }
}
rapid meteor
eternal oxide
#

Nothing in there outputs any number

quaint mantle
#

how might i get the server IP hte player is using when the serverlistping event is called

rapid meteor
quaint mantle
#

actually let me look

eternal oxide
rapid meteor
#

Ohhh the logs.

eternal oxide
#

You are going to have to speak english for me to understand

rapid meteor
#

What's wrong with my english?

eternal oxide
#

From all this I have yet to work out any question you have asked

rapid meteor
#

See no plugin?

#

I exported my plugin into my folder.

#

Not as a runnable jar file.

eternal oxide
#

Looks like part of an exception at the top of that screenshot

rapid meteor
#

But just a normal jar file.

quiet ice
#

could you provide the full logs?

rapid meteor
unreal quartz
#

gonna hack ur stacktraces sunglas

rapid meteor
quiet ice
#

I'm not able to do anything with logs anyways

rapid meteor
quiet ice
#

well, other than helping you of course

rapid meteor
#

You don't get my local ip?

eternal oxide
#

I saw it for a few seconds. You have an error but I didn;t get time to read it

rapid meteor
#

it says permission.yml is empty.

#

That might be the one.

eternal oxide
#

no

quiet ice
#

no

#

I would bet that the plugin.yml is invalid

eternal oxide
#

?paste us the log

undone axleBOT
rapid meteor
#

[Server thread/ERROR]: Could not load 'plugins\myplugin.jar' in folder 'plugins'

eternal oxide
#

We need to see it to help you

quiet ice
eternal oxide
#

We can do nothing unless you show us the full error

rapid meteor
quiet ice
#

it is not

eternal oxide
#

OK, good luck with your problem

rapid meteor
quiet ice
#

It is not

unreal quartz
#

and it is not

rapid meteor
#

But if you don't want then fine :)

#

org.bukkit.plugin.InvalidPluginException: Unsupported API version 1.16.5

#

That?

unreal quartz
#

you've got three people here telling you it's not the full error

quiet ice
#

THAT helps

#

and I was right (yay!)

unreal quartz
#

gold medal for you

eternal oxide
#

Yeah, I'm not fighting to get a simple log.

rapid meteor
quiet ice
#

use api-version: 1.16 instead of api.version: 1.16.5 (I think that was it at least)

#

could also be api: 1.16, but you'll know it when you see it

rapid meteor
#

Can I do /reload to apply changes?

#

Or do I have to export it again?

eternal oxide
#

export

quiet ice
#

you have to export it again, yes

#

Since the change must be present in your jar otherwise it's useless

#

just beware that you need to refresh your project because eclipse is dum with resources

rapid meteor
#

YOU'RE A FUCKING GOD

#

It works it wokrs.

unreal quartz
#

https://paste.md-5.net/liqukateti.sql
ftr @rapid meteor that bit is called a stacktrace, the whole thing is generally what people are looking for when they ask you to "send the error" as it shows what methods were called, the error and a short message explaining the error

rapid meteor
#

It finally works.

unreal quartz
#

and no, you can't get "hacked" from a stacktrace

rapid meteor
#

local ip?

quiet ice
#

not even that

#

and local ip is useless anyways

rapid meteor
#

Well I'm gonna do some spigot and do some C++.

#

At least I don't suck at C++ lol.

quiet ice
#

well, in C++ (or any other non-vm language) you do coredumps, but java is thankfully a lot more advanced there (although - it depends)

rapid meteor
#

C++ is kinda hard sometimes.

#

But I only make OpenGL and practical projects in C++.

rapid meteor
#

I never do Java tho.

#

C++ = everyday all day.

#

xD.

quiet ice
#

I will warn you that you will need to learn to read stack traces if you wish to continue developing java.

rapid meteor
ivory sleet
#

C++ pain

rapid meteor
quiet ice
#

You could be coding your stuff really defensively to avoid bothing to fix your crashes, but otherwise not something that is possible

ivory sleet
#

Nope

#

My very honest opinion

quiet ice
hushed fulcrum
#

@rapid meteor I would recommend you to use intelliJ because imo it is easier for beginners, and also learn the java structure + reading stack-traces.

rapid meteor
#

Eclipse is light.

quiet ice
#

IntelliJ is actually worse from what I heard

hushed fulcrum
#

and don't use windows

ivory sleet
#

Why not

hushed fulcrum
quiet ice
#

Eclipse is more beginner friendly overall

hushed fulcrum
#

opinons 🤷‍♂️

round python
#

Eclipse is beginner friendly but I use IntelliJ

#

I did start on eclipse though

ivory sleet
#

I mean choose whatever ide as long as you still allow yourself to be open for changes imo

unreal quartz
#

vscode

quiet ice
#

yeah, IDE won't matter in most cases

round python
#

Yup

#

Just use what’s comfortable really

rapid meteor
quaint mantle
round python
#

Bruh

rapid meteor
#

The conversation is ended mate.

rapid meteor
quiet ice
unreal quartz
#

yeah m a t e

rapid meteor
#

Mate is just my default word for saying guy.

#

What's up mate!

unreal quartz
#

'scuse me m a t e

quaint mantle
hushed fulcrum
#

from what I saw it seemed like he didn't know how to make a file

round python
#

Lmfao

hushed fulcrum
rapid meteor
quiet ice
#

they lacked in everything

rapid meteor
#

cmd is my friend.

hushed fulcrum
ivory sleet
#

UI > cli

hushed fulcrum
#

whatever

unreal quartz
#

yeah that makes a directory not a file Kek

quiet ice
#

then why use windows?

hushed fulcrum
#

no bullying

hushed fulcrum
#

cringe

rapid meteor
quiet ice
#

CLI and C++ should seal the deal

rapid meteor
#

Don't you think I mean't that?

rapid meteor
unreal quartz
#

microsoft™️

eternal oxide
#

Windows 7 is great. Everything else is junk

quiet ice
#

because windows and CLI AND C++ don't go well

#

most linux system have GCC natively, which is a gift from god

rapid meteor
#

You're also too late.

ivory sleet
#

Guys chill 🙂

quaint mantle
#

why are you so salty:(

rapid meteor
#

The conversation "has" ended a long time ago.

quaint mantle
#

so is it possible to get the server ip that the player is using in the ServerListPingEvent

ivory sleet
#

I’d say yes but unsure honestly

hushed fulcrum
rapid meteor
quaint mantle
#

BRO

#

SHUT UP

#

ABOUT YOUR "CONVERSATION"

#

please

rapid meteor
#

I won't :)

quaint mantle
#

the ServerListPingEvent is the most important right now

rapid meteor
#

I will if you ask nicely :)

quaint mantle
#

we must honour it

rapid meteor
quaint mantle
unreal quartz
#

from my 15 seconds at looking at the javadoc

ivory sleet
#

?jd-bc

rapid meteor
#

Guys how should I write "usage"?

#

usage: </command> ?

ivory sleet
#

Or was it for spigot ?

#

?jd-s

rapid meteor
#

Or usage: /<command> ?

undone axleBOT
eternal oxide
#

that needs to add the search box like Spigot has

unreal quartz
#

?jd

ivory sleet
unreal quartz
#

that's the playe raddress

rapid meteor
#

Guys is usage: </command> right?

ivory sleet
#

Wasn’t that what u wanted

unreal quartz
#

i think they meant the ip the player is using, which i dont think is possible as its resolved on the client

ivory sleet
#

Oh right

hushed fulcrum
#

no

ivory sleet
#

iirc just /<command>

hushed fulcrum
#

the latter one from the first

rapid meteor
unreal quartz
#

i know the client sends the hostname it used to connect to the server but i am not sure if or where the server stores that information

rapid meteor
#

"Here we go again" you might think xD.

unreal quartz
#

elaborate a bit more

ivory sleet
#

Send ur plugin.yml

rapid meteor
#

Alright!

ivory sleet
#

?paste fingergunsanimated

undone axleBOT
crimson terrace
#

Hey, how would I save a Map<String, Set<Block>> to a config file? I tried a couple things and Im not sure what else to try.

unreal quartz
#

doubt block is serializable

#

you may have to convert each set of blocks to a list of x, y, z for each block and set that under each key

crimson terrace
#

damn

ivory sleet
#

Wouldn’t it be more appropriate using Location?

#

Shreb

eternal oxide
#

Block has getLocation() which is seralizable

crimson terrace
#

ooo

#

then im saved

ivory sleet
#

So yeah not that much of a hassle lol

unreal quartz
#

will have problems loading that if the world does not exist

crimson terrace
#

just gonna change it to Location instead of Block

eternal oxide
#

Block is better for storing, in yoru use case

#

Location is too precise

ivory sleet
#

You could use the block values of a location

crimson terrace
#

Im confuzzled

unreal quartz
#

location allows decimal values

#

block locations, obviously, cannot have decimal values

#

but it shouldn't matter anyway

crimson terrace
#

Ill just paste the code so you can see what ive been trying

eternal oxide
#

If I were you, I'd keep using Block, but write a simple method to save and load yoru data to file. Block is perfect for your use

crimson terrace
eternal oxide
#

um

#

Why not just store teh players lockers in their PDC. then you have no data to save/load

crimson terrace
#

I just wanted to do the saving/loading from a file once so I could use it sometime later, but that would also work

tardy delta
#

?paste

undone axleBOT
tardy delta
eternal oxide
solid cargo
#

whats the event for 1st ever login

#

for a player

eternal oxide
#

same as for every player

opal juniper
#

i think there is just a method

#

hasPlayedBefore

#

or something

solid cargo
#

ahh

eternal oxide
#

PlayerJoinEvent, getPlayer and .hasPlayedBefore()

solid cargo
#

if player.hasPlayedBefore

#

dont do that

#

like so?

#

when you make the pc go to sleep

crimson terrace
lost matrix
opal juniper
#

what no

eternal oxide
#

?paste

undone axleBOT
opal juniper
#

that’s not what he meant lol

solid cargo
opal juniper
#

yeah basically

#

as in it has the same effect

lost matrix
rapid meteor
#

Guys I have an error.

crimson terrace
#

do you just have these lying around @eternal oxide ? XD

rapid meteor
#

There is my logs.

#

This is what my folder looks like here.

lost matrix
rapid meteor
#
name: HelloWorld
author: Erawan
version: 1.0
api-version: 1.16

commands:
 HelloWorld:
 usage: /<command>```
eternal oxide
#

indent useage

lost matrix
rapid meteor
rapid meteor
#

Like name:

lost matrix
rapid meteor
#

But what's the error?

#

When I do plugins.

#

It prints 0.

#

It should not throw an error.

lost matrix
rapid meteor
#

Let me try.

eternal oxide
#

If your plugins throws an Exception on startup it will not be loaded. So 0 plugins

outer crane
#

Is there any way to check when a player is within reach of an entity? Would be preferable if it was an event so I wouldn't have to deal with performance.

lost matrix
crimson terrace
outer crane
#

every tick?

crimson terrace
#

aka subtract the values

lost matrix
outer crane
#

within something like hitting range

#

and is looking at them

rapid meteor
lost matrix
lost matrix
eternal oxide
#

Are you planning on doing something when within hitting range?

rapid meteor
lost matrix
# rapid meteor

"Cannot find main class `dev.erawan.me.Main'"
Your path to the main class is wrong

rapid meteor
#

Ehm no it isn't?

eternal oxide
#

lol

rapid meteor
#

Weird.

crimson terrace
#

check for typos

eternal oxide
#

That told you 7smile7

#

btw 7smile7 is correct, don;t ague 🙂

rapid meteor
rapid meteor
crimson terrace
#

is there anything inside the Main?

lost matrix
rapid meteor
# crimson terrace is there anything inside the Main?

import org.bukkit.ChatColor;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.bukkit.plugin.java.JavaPlugin;

public class Main extends JavaPlugin {
    @Override
    public void onEnable()
    {
        System.out.println("Plugin is on!");
    }
    @Override
    public void onDisable()
    {
        
    }
    
    public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
        if(label.equalsIgnoreCase("hello")) {
            if(sender instanceof Player)
            {
                Player player = (Player) sender;
                player.sendMessage(ChatColor.RED + "Hey welcome to the server!");
                return true;
            } else {
                sender.sendMessage("Hey console!");
                return true;
            }
        }
        return false;
    }
}
sharp bough
undone axleBOT
outer crane
rapid meteor
rapid meteor
sharp bough
outer crane
#

no, but its much worse to use stdout

rapid meteor
#

Is it important to use spaces?

eternal oxide
#

yaml only accepts spaces

rapid meteor
#

LOL YAML is confusing,

eternal oxide
#

in multiples of 2

dusk flicker
#

I woulden't say its much worse to use sysout but like, you should use logger, won't change much tho

rapid meteor
#

Do they need whitespaces too?

eternal oxide
#

whitespace is to indent to indicate it is a child section

#

you only indent child nodes

crimson terrace
#

Elgar is this how you use that PersistentDataType you sent me?
private static final PersistentDataType<PersistentDataContainer, Location> PERSISTENT_DATA_TYPE = new PersistentDataType_LOCATION(Lockers.getInstance());

rapid meteor
quaint mantle
#

Im trying to replace the block created by cobblestone generators. Any help?

        if (event.getBlock().getType() == Material.COBBLESTONE) {
            double RNG = (int)(Math.random()*((5-1)+1))+1;
            if (RNG == 5) { event.getBlock().setType(Material.COBBLESTONE); }
            if (RNG == 4) { event.getBlock().setType(Material.IRON_ORE); }
            if (RNG == 3) { event.getBlock().setType(Material.GOLD_ORE); }
            if (RNG == 2) { event.getBlock().setType(Material.COAL_ORE); }
            if (RNG == 1) { event.getBlock().setType(Material.STONE); }
        }
rapid meteor
#

Thank you all of you!

#

God bless allll!

crimson terrace
#

crap. its not giving an error tho

eternal oxide
#

You use it eactly as you would any default data type

crimson terrace
#

.getPersistentDataContainer().has(lockersList, PERSISTENT_DATA_TYPE)
this?

eternal oxide
#

yes

dusk flicker
crimson terrace
#

so I have to make an object of the data type and then check that

quaint mantle
#

So it randomly chooses a block

#

"5 - 1 + 1 "

eternal oxide
quaint mantle
lost matrix
rapid meteor
#

Ehm bois when I do /helloworld it just logs /helloworld in the minecraft world.

dusk flicker
#

your math literally wont work

quaint mantle
#

thats a prime example of why you dont just copy and paste code

dusk flicker
#

thats the problem here

#

should be like int random = Math.random(1, 5)

lost matrix
dusk flicker
#

or some shit

crimson terrace
#

nvm figured it out

eternal oxide
#

in the set or get you use new PersistentDataType_LOCATION(plugin)

crimson terrace
#

thanks for the help. Id be so lost without this discord and you guys XD

lavish hemlock
quaint mantle
#

wtf ew

#

that shit can burn in a fire

dusk flicker
#

thats disgusting

lavish hemlock
#

it's a range in a parentheses expression with a method call on the end

dusk flicker
#

we can see that still disgusting

lavish hemlock
#

the parentheses are bc the parser isn't smart enough to 1..5.random()

quaint mantle
#
import random;
import standard as std;

call main() {
    std.println(random.randInt(5));
}
#

gotta use .ASS

lavish hemlock
#

I will never use .ass

quaint mantle
#

Ok

quaint mantle
quaint mantle
dusk flicker
#

it is

lavish hemlock
#

if the println method is literally standard.println() without an import alias, that's a weird design decision

quaint mantle
#

ThreadLocalRandom.current().nextInt(5);

dusk flicker
#

^ what imagine said, best way

lavish hemlock
#

it should just be println(), plain and simple

#

and why do you have to explicitly import standard

quaint mantle
#

Idk

#

i like how cpp handles namespaces

lavish hemlock
#

also: what is the point of the call keyword

quaint mantle
#

😆

lavish hemlock
#

why not something more conventional like fn or func

quaint mantle
#

i dont like func or fun

dusk flicker
#

function

ivory sleet
#

def (:

quaint mantle
#

too long

#

def is cool

dusk flicker
#

too bad

#

bitch

quaint mantle
#

short simple

lavish hemlock
#

def is fine

dusk flicker
#

❤️

quaint mantle
#

im dumb

ivory sleet
#

Same

lavish hemlock
#

call is just weird bc the function isn't a "call," it's a function

quaint mantle
#
def main() {
    println("Hallo");
}
#

functions are callable

ivory sleet
#

callable then.

quaint mantle
#

nah

#

too long

lavish hemlock
#

there's a difference between callable and call :)

eternal oxide
#

its a call because it pushes its return to the stack

rapid meteor
quaint mantle
#
int a
double b
string c;
callable d;
lavish hemlock
#

I do like the whole callable keyword thing tho

ivory sleet
#

maybe task

lavish hemlock
#

I dislike how function types like that are built into the standard library, not lang

quaint mantle
#

Didn't work, what did i do wrong?

    private static final Material[] MATERIALS = new Material[]{
            Material.COBBLESTONE,
            Material.STONE,
            Material.COAL_ORE
    };

    public Material getRandomMaterial() {
        final ThreadLocalRandom random = ThreadLocalRandom.current();
        return MATERIALS[random.nextInt(MATERIALS.length)];
    }
    @EventHandler
    public void onCobbleGen(BlockFormEvent event) {
        if (event.getBlock().getType() == Material.COBBLESTONE) {
            event.getBlock().setType(getRandomMaterial());
        }
    }
#

standard only include console stuff

lavish hemlock
#

could you use your brain for a second please

quaint mantle
#

Ok

lavish hemlock
#

and realize I was referring to other languages

#

not yours

#

when saying that sentence

quaint mantle
#

specify next time

lavish hemlock
quaint mantle
#

you're confusing

ivory sleet
#

method maybe

lavish hemlock
#

I like thing in this lang
I don't like this thing
you can assume that "I don't like this thing in other langs" bc I already said "I like thing in this lang"

quaint mantle
#

Ok

dusk flicker
#

debug it

#

we shoulden't have to code it for you

lavish hemlock
#

I imagine it's probably the onCobbleGen method but idk

silent timber
#

Why does this not cancel clicking in my GUI?

@EventHandler
public void onInventoryClick(final InventoryClickEvent e) {
  if (e.getInventory() != inv) {
    return;
  }
  e.setCancelled(true);
}

inv is opened via player.openInventory(inv);

lost matrix
# quaint mantle help please?

I think this is a better approach:

  private static final RangeMap<Double, Material> MATERIAL_RANGE_MAP = TreeRangeMap.create();

  static {
    MATERIAL_RANGE_MAP.put(Range.atMost(50.0), Material.STONE);
    MATERIAL_RANGE_MAP.put(Range.openClosed(50.0, 70.0), Material.COAL_ORE);
    MATERIAL_RANGE_MAP.put(Range.openClosed(70.0, 80.0), Material.IRON_ORE);
    MATERIAL_RANGE_MAP.put(Range.openClosed(80.0, 90.0), Material.GOLD_ORE);
    MATERIAL_RANGE_MAP.put(Range.open(90.0, 99.0), Material.LAPIS_ORE);
    MATERIAL_RANGE_MAP.put(Range.atLeast(99.0), Material.DIAMOND_ORE);
  }

  public Material getRandomMaterial() {
    final ThreadLocalRandom random = ThreadLocalRandom.current();
    return MATERIAL_RANGE_MAP.get(random.nextDouble(100.0));
  }
ivory sleet
#

Maybe if it’s a delegate

quaint mantle
ivory sleet
#

Help doesn’t inherently mean spoon feeding though

dusk flicker
#

as I said

#

debug it out

lavish hemlock
#

right?

ivory sleet
#

Inventory is an interface

lavish hemlock
#

enums aren't compared by equals

#

ah

#

well in that case

lost matrix
#

Inventory is not an enum

ivory sleet
#

Ye

lavish hemlock
#

oh I just realized I was looking at the wrong example

#

sorry

quaint mantle
#

!= works unless you're creating a new one

ivory sleet
#

Idk

lost matrix
ivory sleet
#

Bukkit does create delegates sometimes doesn’t it

quaint mantle
dusk flicker
#

that has to be the dumbest reason ive ever heard

lavish hemlock
ivory sleet
#

You don’t need to be a software engineer professor in order to debug stuff

lavish hemlock
#

also

#

we literally don't know what your problem is

silent timber
# lost matrix Use .equals instead of !=
@EventHandler
public void onInventoryClick(final InventoryClickEvent e) {
  if (e.getInventory().equals(inv)) {
    e.setCancelled(true);
  }
}

Still doesn't work 🤔

lavish hemlock
#

soooo "it doesn't work" isn't helpful

quaint mantle
ivory sleet
quaint mantle
#
public class MyInventory implements Listener {
    private Inventory inv = null;

    public void createInventory() {
        inv = Bukkit.createInventory(null, 27, "hey");
    }

    public void show(Player player) {
        if (inv == null) {
            this.createInventory();
        }
        player.openInventory(inv);
    }

    @EventHandler
    public void onInventoryClick(InventoryClickEvent event) {
        if (event.getInventory() != inv) {
            return;
        }
        event.setCancelled(true);
    }
}
#

this is how they teach it in the plugin wiki aswell

silent timber
quaint mantle
#

🤦‍♂️

rapid meteor
#

Anyone knows what I can put on the end at a "permission:" node?

quaint mantle
#

string

lavish hemlock
quaint mantle
#

"myplugin.permission"

rapid meteor
rapid meteor
quaint mantle
#

?

rapid meteor
#

permission: kit.owner

#

Is that valid?

silent timber
#

Yes, it is valid. I wouldn't follow that scheme though, do <plugin name>.permission instead (like pluginname.kit.owner)

ivory sleet
#

I’d dissuade you from doing that

lavish hemlock
quaint mantle
#

name it better

#
# <pluginName>.<parent>.<permission>
permission: kits.kit.owner
silent timber
#

🤦

Thank you...

ivory sleet
#

🥲

lost matrix
#

The classic

silent timber
#

lol

quaint mantle
#

Yike

rapid meteor
#

Bois why does it only print the command name????

#

it also did it at the other one.

#

It's stressing me!

quaint mantle
#

you're returning false

#

send code

rapid meteor
#

Alright.

lavish hemlock
#

@still kindle Put getRandomMaterial()'s return variable on its own line, print it. Put a print in onCobbleGen to see if it even runs, if it doesn't, it means you didn't register your events.

#

That's basic debugging.

#

Any programmer can do that.

rapid meteor
# quaint mantle you're returning false

import org.bukkit.ChatColor;
import org.bukkit.Material;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
import org.bukkit.plugin.java.JavaPlugin;

public class Main extends JavaPlugin {
    @Override
    public void onEnable()
    {
        this.getCommand("kit").setExecutor(new CommandKit());
    }
    @Override
    public void onDisable()
    {
        
    }
    
     @Override
        public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
            if (sender instanceof Player) {
                Player player = (Player) sender;

                // Create a new ItemStack (type: diamond)
                ItemStack diamond = new ItemStack(Material.DIAMOND);

                // Create a new ItemStack (type: brick)
                ItemStack bricks = new ItemStack(Material.BRICK);

                // Set the amount of the ItemStack
                bricks.setAmount(20);

                // Give the player our items (comma-seperated list of all ItemStack)
                player.getInventory().addItem(bricks, diamond);
            }

            // If the player (or console) uses our command correct, we can return true
            return true;
        }
}
lavish hemlock
unreal quartz
#

the command handler logic is in your main class, not the class you registered as the executor lol

dusk flicker
#

did they leave lol?

lavish hemlock
#

they're just offline

unreal quartz
#

CommandKit is the class

rapid meteor
#

import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;

public class CommandKit implements CommandExecutor {

    @Override
    public boolean onCommand(CommandSender arg0, Command arg1, String arg2, String[] arg3) {
        // TODO Auto-generated method stub
        return false;
    }

}
dusk flicker
#

they blocked me kek

rapid meteor
#

And?

quaint mantle
unreal quartz
#

false

rapid meteor
#

Should I return true?

silent timber
ivory sleet
lavish hemlock
quaint mantle
lost matrix
unreal quartz
#

the return indicates if the command was used correctly, so if you return false then it will send the usage to the sender

rapid meteor
quaint mantle
#

in your main class

#

its never ran

rapid meteor
#

How?

lavish hemlock
dusk flicker
#

thats one of the messages

rapid meteor
unreal quartz
#

move the command logic to the command class

unreal quartz
#

yes

quaint mantle
lavish hemlock
#

Nobody insulted you.

ivory sleet
#

Hmm I’d assert there’s a difference between insults and advice. We just want you to be able to teach your very self.

quaint mantle
#

Anyone teaching Java? I’m very new and want to get some help

unreal quartz
#

?learnjava

undone axleBOT
ivory sleet
#

Fuck off Toby

lavish hemlock
#

I mean you can kinda argue Rack was being a bit rude, but in all fairness, it was a dumb reason, he just should've been more helpful right then and there.

ivory sleet
#

Srsly lol

unreal quartz
quaint mantle
#

Honestly

#

😦

rapid meteor
#

Thank you everyone!

quaint mantle
#

hello i'm trying to get player ping in scoreboard
with out flicker
so a made a runnable to change the scoreboard line

but it's spamming like this
https://prnt.sc/1revepa

rapid meteor
#

For your help!

ivory sleet
#

You know more than most people here

#

Probably

quaint mantle
lavish hemlock
ivory sleet
#

Shouldn’t have cursed like that still hehe, but yeah

#

LMBi good call

unreal quartz
quaint mantle
lost matrix
quaint mantle
unreal quartz
opal juniper
#

why does KillerWolf remind me of floofsy

quaint mantle
#

well how to change it

ivory sleet
#

Hopefully he isn’t paranoid about his code jeff

opal juniper
#

lol

quaint mantle
#

😂

#

Stealing it 🤔

ivory sleet
unreal quartz
#

unfortunately i lack the capability of mind reading so i cannot see your code unless you send it

quaint mantle
#

@quaint mantle

ivory sleet
#

he goes under many names

quaint mantle
#

What do you need help with

ivory sleet
#

Some considered unnatural /s

unreal quartz
ivory sleet
quaint mantle
#

Oh Conclure you free actually?

ivory sleet
#

Uh not atm

#

Maybe tmrw (: what is it btw

#

Maybe ask here

quaint mantle
#

Uhh it’s the Enchants we was doing

quaint mantle
#
    Bukkit.getScheduler().scheduleSyncRepeatingTask(Main.getInstance(), new Runnable() {
        
            @Override
            public void run() {
                int ms = ((CraftPlayer)p).getHandle().ping;
            obj.getScore(ChatAPI.color("Status: " + ms)).setScore(2);
            }
        },0,20L;```
#

this is the code

#

Like skyblock servers

quaint mantle
ivory sleet
#

The sacrifice

#

But yeah nice of you (:

quaint mantle
ivory sleet
#

You could still type

quaint mantle
#

Well that makes it 10x harder without spoon feeding

ivory sleet
#

Just be in a vc

#

Muted

lavish hemlock
unreal quartz
quaint mantle
#

ok so how to change scoreboard line

#

with out flicker

unreal quartz
#

update a teams prefix and suffix

lavish hemlock
#

I should probably study Spigot's API

ivory sleet
#

Questionable question

quaint mantle
#

👍

lavish hemlock
quiet ice
#

if it is supid enough, yes

lavish hemlock
#

like your mom? X D

quaint mantle
#

-_-

lavish hemlock
#

you can't stop Maow

#

he's too funny

quaint mantle
pastel relic
#

hey

#

I'm coding my website, and i wanted to add something like the total downloads from spigot on there, is there like an api or something that i can add the total amount of downloads from my spigot plugins?

#

ex.

unreal quartz
#

yes

pastel relic
pastel relic
unreal quartz
#

two options

quiet ice
#

spiget is one API that I know of

unreal quartz
neat trellis
#

Is there a way to get the frozen overlay effect like the one used when in powder snow?

quaint mantle
#

Hello how to get top 10 essentials balance top
with out using /baltop

lost matrix
quaint mantle
#

okay thx

lost matrix
# quaint mantle okay thx

One way would be to implement your own CommandSender then let it run the command
and parse the given result.

lost matrix
#

This way you can basically poll the output of any command.

#

Could be used to fill holograms for example

quiet ice
#

I really wonder how many plugins you made in order to test what you are suggesting

lost matrix
#

Its just one with dozens of branches. "SpigotSandbox"

quiet ice
#

even worse

unreal quartz
#

couldn't imagine having a branch in my sandbox

#

yikes

crimson terrace
#

?paste

undone axleBOT
wary harness
#

any good suggestion to save

#

data on block

#

I need to save which tier block is on restart

#

I tried block metadata

#

but it is deleted on restart

eternal oxide
#

Shoo 1.8 pleb

wary harness
#

thati s PDC

#

so no xd

wary harness
eternal oxide
#

no, that uses the Chunk PDC to store the blocks data

#

its just a nice clean wrapper

wary harness
#

I am

#

stuck

#

making plugin for one server which is on 1.8

eternal oxide
#

Force them to update

wary harness
#

and limited api is pain in the ass

#

well it is not up to me

unreal quartz
#

convince them to update

eternal oxide
#

If you don't help then they have no choice

eternal night
#

or look at NBTAPI

wary harness
#

well they will just get other dev xd

#

NBTAPI support only tiles

eternal oxide
#

and when the next dev comes in for help we'll tell them to update

lost matrix
eternal night
#

idk ¯_(ツ)_/¯

#

not like I use nbt api a lot xD

wary harness
#

that could work

unreal quartz
wary harness
#

xd

eternal night
#

I mean, just storing something into a db is also pretty fine

wary harness
eternal night
#

obviously requires you to cache a lot more compared to a fully in memory PDC

wary harness
#

and then same block have change to go again to next tier

#

I will see probably some db will be solutin

#

I was looking for something simple xd

lost matrix
#

If its done with SQLite and you dont risk an external DB blocking then this is a viable option.

vast sapphire
#

how do I get the location from this configuration section? ```yaml
user:
7b5c354d-e997-4c27-b4bc-936c16c868fd:
world: world
X: 57
Y: 68
Z: 181

eternal oxide
#

Probably getConfig().getLocation("user.7b5c354d-e997-4c27-b4bc-936c16c868fd")

#

Should work

vast sapphire
eternal oxide
#

no

#

getLocation("user." + player.getUniqueId())

vague oracle
#

🧐

vast sapphire
#

ok

lost matrix
quiet ice
#

doesn't location has this deserialisation process built in?

eternal oxide
#

yes

lost matrix
vast sapphire
lost matrix
lost matrix
eternal oxide
#

ConfigurationSection getLocation just looks for keys I believe

#

not a true deserialization

vast sapphire
#

My structure is java this.getConfig().set("user." + event.getPlayer().getUniqueId() + ".world", event.getBlock().getLocation().getWorld().getName()); this.getConfig().set("user." + event.getPlayer().getUniqueId() + ".X", event.getBlock().getLocation().getBlockX()); this.getConfig().set("user." + event.getPlayer().getUniqueId() + ".Y", event.getBlock().getLocation().getBlockY()); this.getConfig().set("user." + event.getPlayer().getUniqueId() + ".Z", event.getBlock().getLocation().getBlockZ()); this.saveConfig();

eternal oxide
#

god no, if you are saving teh config on changes too

vast sapphire
#

any better suggestions?

eternal oxide
#

your server will crawl to a standstill on every block place

lost matrix
lost matrix
vast sapphire
#

ok

#

that's helpful, thanks

neat trellis
#

How do you spawn a falling block as world.spawnFallingBlock() is deprecated

eternal night
#

it isn't ?

lost matrix
eternal night
#

Yea, the one using magical sub ids is deprecated

lost matrix
#

The one using bytes as data...

crystal magnet
#

What is the velocity of gravity for players?

lost matrix
lost matrix
crystal magnet
lost matrix
# crystal magnet Yes

I believe ive written a test for that. It actually changes with the y velocity of the player.
The curve suggests that air friction increases quadratically with velocity.

vast sapphire
#

thanks

burnt current
#

Hey, quick question: I'm trying to connect my project to a MySQL database via a DataSource and have created the following class for it so far:

public class MySQL {
    
        private DataSource initMySQLDataSource() throws SQLException {
        MysqlDataSource dataSource = new MysqlConnectionPoolDataSource();

            File file = new File("D:\\Programming\\Plugins\\Config.yml");
            YamlConfiguration yamlConfiguration = YamlConfiguration.loadConfiguration(file);
                dataSource.setServerName(yamlConfiguration.getString("host"));
                dataSource.setPortNumber(yamlConfiguration.getInt("port"));
                dataSource.setDatabaseName(yamlConfiguration.getString("database"));
                dataSource.setUser(yamlConfiguration.getString("user"));
                dataSource.setPassword(yamlConfiguration.getString("password"));

                testDataSource(dataSource);
                return dataSource;
    }

    private void testDataSource(DataSource dataSource) throws SQLException {
        try (Connection conn = dataSource.getConnection()) {
            if(!conn.isValid(1000)) {
                throw new SQLException("Database not connected!");
            } else
                System.out.println("Database connected!");
        }
    }
}

Unfortunately, I do not know exactly how to establish a connection to my database in the Main class. (I created the class with the help of this tutorial: https://www.spigotmc.org/wiki/connecting-to-databases-mysql/?__cf_chl_jschl_tk__=pmd_iP2VT4IVi_Tkf4BAPtcQGHjdHLSTBiGBgJmCYQ3aHd0-1630959702-0-gqNtZGzNAfujcnBszQkR . However, I can't get any further at this point).
Could someone explain to me what exactly needs to be in my main class? Thanks in advance!

vast sapphire
#

how do I get the drops of e.getBlock.breakNaturally?

spark finch
#

Has anyone coded with GriefPrevention before?

spark finch
vast sapphire
#

yes, whatever drops when you break a block is what I need to add to the player's inventory

eternal night
#

don't think there is a straight forward way to grab it. You might be better off getting the drops for the used tool

#

and then just set the block to air and play some particles

spark finch
#

Question; Why would you want to drop the block naturally if you are going to add it?

vast sapphire
round python
#
    {
      event.getEntity().remove();
      ((CraftWorld) event.getLocation().getWorld()).addEntity(rideableDolpho, reason);
      event.setCancelled(true);
    }``` so I made this if statement and it works but literally no dolphins spawn now at all
spark finch
#

e.getBlock().getType()?

vast sapphire
eternal night
#

Block#getDrops(ItemStack, Entity)

unreal quartz
#

Block::getDrops

vast sapphire
unreal quartz
#

it will take into account fortune etc. if an item is passed

vast sapphire
round python
#

nvm dolphins still spawn but my custom ones arent replacing them

#

damn it

unreal quartz
#

why not listen for a block break event then

#

assuming you only want thsi behaviour when a player breaks a block

vast sapphire
#

I got it

round python
#

I feel like im doing something wrong

#

but idk what it is

#

can someone help me?

#

if they can

vast sapphire
#

how do I get 1 block above e.getBlock().getLocation()? do I use .add()?

eternal oxide
#

.add(0,1,0)

vast sapphire
#

how would I drop the item where there isn't a solid block? basically checking around all 6 sides

eternal oxide
#

use getRelative to check each location

vast sapphire
#

ok

vast sapphire
#

?paste

undone axleBOT
vast sapphire
#

it doesn't work and I get 1 item

eternal oxide
#

You are not spawnign at teh tested location

#

e.getBlock().getRelative(BF.get(i)) is your tested location. You are spawnign it at e.getBlock().getRelative(block.getFace(block))

vast sapphire
#

ah

#

doesn't seem to be working with e.getBlock().getLocation().getWorld().dropItem(e.getBlock().getRelative(BF.get(i)).getLocation()

eternal oxide
#

um, why are you looping these blockfaces, but if its not air you break the original block?

#

a better question, what exactly are you trying to do?

vast sapphire
eternal oxide
#

just 2 times?

vast sapphire
eternal oxide
#

Then use teh BlockDropItemEvent

vast sapphire
vast sapphire
eternal oxide
#

Why are you using any of that if all you want to do is drop 2 of something?

vast sapphire
eternal oxide
#

then use teh correct event

#
    @EventHandler
    public void onDropItem(BlockDropItemEvent event) {

        for(Item item: event.getItems()) {
            ItemStack drop = item.getItemStack();
            drop.setAmount(drop.getAmount() * 2);
            item.setItemStack(drop);
        }
    }```
vast sapphire
#

ok

eternal oxide
#

rather than setting the amount you could simply use two drop method calls

#

but that will do what you want and simpler

#

it will also double up anything extra gained from enchantments

vast sapphire
#

ok

#

works perfectly, thanks

eternal oxide
#

tidier

neat trellis
#

How to make frosted ice that ages and doesn't leave water behind?

round python
#

still having issues with replacing an entity with my custom one

#

I seriously don't know why this is happening

vague oracle
#

Maybe store ID of custom entity and if a list/set doesn't contain the ID, then stop the dolphin from spawning

round python
#

the thing is like it either gets rid of any dolphins or the dolphins stay the same

#

Im just checking whether event.getEntity.equals(Dolphin.class)

#

but im not sure if that will check for subclasses too

#

like instanceof

eternal oxide
#

comparing an Entity instance to a Class with .equals? Not good

#

if (event.getEntity().getType() == EntityType.DOLPHIN)

round python
#

but my custom dolphin shares the same entitytype

#

so it will then remove the customdolphin as well wouldn't it

#

should I give it a different EntityType?

eternal oxide
#

first make sure its actually a dolphin properly, then check instanceof to Your entity class

round python
#

check instanceof?

eternal oxide
#

yes

round python
#

could you elaborate im a bit confused sorry

eternal oxide
#

instanceof is a class type comparison

round python
#

yeah

#

but do you want me to check whether it is an instance of my dolphin?

eternal oxide
#

you have to see if its your dolphin or not

round python
#

or the minecraft dolphin

eternal oxide
#

your dolphin as they are both instances of an MC dolphin

#

I'm assuming you have extended the MC dolphin

round python
#

yes

eternal oxide
#

in your own class

round python
#

I get what your saying now

#

sorry

subtle kite
#

How do I make a public Inventory so all classes can see it.

proud basin
#

add public in front of the method or variable

eternal oxide
#

add a getter

proud basin
#

Wouldn’t use a getter in this case

eternal oxide
#

I'd only ever expose a Constant

#

all fields shoudl be via a getter

subtle kite
#

...

ionic haven
#

im trying to log when players take items from an inventory block but get stuck when they double click and shift an item moving more than a stack into their inventory and InventoryClickEvent goes off for how many stacks was moved. how can i get around this

crude charm
#

Just remove it its going confuse people

#

and only include what you're trying to do

#

but as for your answer

ionic haven
#

ok thanks

quaint mantle
#

Can someone help me please. I was trying to follow a tutorial on how to create something in a plugin and I did everything and loaded in the game, but when I type in /plugins to see if my plugin is there it does not show up there. Just to say it is in my plugins directory for my server. In the plugin I attempted to create a custom command and that does not work too, I think the plugin isnt running or getting used for some reason.

vague oracle
#

Well if its in the plugins folder and doesn't say in the "pl" command, then there is 100% an error in the console.

#

And without seeing it, we can't help you

quaint mantle
#

I can send a screenshot of the console if you want

vague oracle
#

No, we need the error it shows above that

quaint mantle
#

Ill just send my entire console in a pastebin

#

If thats ok

vast sapphire
#

?paste

undone axleBOT
quaint mantle
outer sorrel
#

how could i raycast the players line of sight? never done raycasting befpre

vague oracle
#

You need to update your java version on the server

#

or downgrade the java version on your plugin

quaint mantle
#

Both of them use 1.16.5 minecraft version

quaint mantle
vague oracle
#

well one is 59 and other is 52 i think 52 is Java 8 and 59 is Java 15

vast sapphire
#

I have a method that drops 2x the blocks, I use the api PlayerBlockTracker which tracks blocks placed and I untrack the block when it's broken. I get 2x the blocks either way however.
https://paste.md-5.net/fasihijuyi.cs

quaint mantle
vague oracle
#

Are you using maven?

quaint mantle
#

whats that again?

#

Sorry Im being dumb

quaint mantle
burnt kettle
#

is there a file called pom.xml@quaint mantle

quaint mantle
#

Where would that be located?

burnt kettle
#

ill take that as a no

quaint mantle
burnt kettle
#

a no then ok

quaint mantle
#

ok

burnt kettle
#

check when the server starts up is there any errors that come up

quaint mantle
vast sapphire
vast sapphire
quaint mantle
#

Do I have to recode my entire plugin?

vast sapphire
quaint mantle
waxen plinth
#

You don't have to copy anything, just change the project to java 8

quaint mantle
#

How do I do that?

#

This is literally my first time ever using this...

waxen plinth
#

I don't know, I haven't used eclipse in forever

#

Just look up how to change the java version of a project in eclipse

quaint mantle
#

Ok

vast sapphire
# quaint mantle This is literally my first time ever using this...

you should use intellij then unless you're set on eclipse, intellij is able to create a maven project for you or you can install https://plugins.jetbrains.com/plugin/8327-minecraft-development for intellij

echo basalt
#

ehh

#

I don't use it personally

vast sapphire
#

with that plugin you can create a spigot skeleton project

quaint mantle
echo basalt
#

that disappoints me

#

I gotta make a proper tutorial in intellij screaming at static abuse one day

vast sapphire
quaint mantle
#

ok

vast sapphire
#

you just need to get familiar with your ide

vast sapphire
crude charm
echo basalt
#

ehh

#

Doesn't really

crude charm
#

I suppose if you have a template with all ur utils and stuff then yeah

#

but otherwise it's really good

echo basalt
#

ehh not really

#

I kinda have a folder with utils but I copy it over manually

#

Each customer has their own needs and not everything is done the same

#

Even then maybe half my plugins work on spigot

unreal quartz
#

that plugin has only ever caused me issues

crude charm
#

Odd

#

I love it

echo basalt
#

welp

#

time to test custom combat range

waxen plinth
#

I don't use the spigot intellij plugin

eternal oxide
#

I'd never recommend the InteliJ MC plugin to any beginner

waxen plinth
#

What does it do?

eternal oxide
#

learn to walk before you take shortcuts

crude charm
#

yeah ofc

#

I can defo agree

waxen plinth
#

What does it do though

crude charm
#

setup maven and stuff

echo basalt
#

screw you spigot

eternal oxide
#

Creates a plugin template you build on

crude charm
#

yeah

eternal oxide
#

But it uses Main as teh main class for a start 😭

crude charm
echo basalt
#

bruh

#

I hate classes named Main

eternal oxide
#

teaches bad habits from the outset.

crude charm
echo basalt
#

I always name mine like