#help-archived

1 messages ยท Page 96 of 1

red zenith
#

in game

strange grove
#

but secretly deleinting it

#

and making a new one completly with a new name!

#

i mean with it's oldd name

red zenith
#

so you don't want to keep the one that was there at all? not even the image in your plugin directory?

strange grove
#

sry for the confusion

#

๐Ÿ™‚

#

but a new image

#

not the old one

red zenith
#

It seems to me that you plugin should be able to download a remote file, maybe add that to AnimatedFrames.
If you've got that working, then you just need to tie your plugin into AnimatedFrames.

#

That way you can interact with FrameManager

strange grove
#

umm

#

tha's complicated friend

#

im a newbiwe

#

so i gotta improvis

red zenith
#

yeah, I'm just trying to figure out if you can even do that

strange grove
#

turning right by turning left

red zenith
#

because the functionality is already in place

strange grove
#

im using play.chat

#

player.chat

rough hare
#

Don't reply to me frost because ik your busy...

#
            TextComponent message = new TextComponent( "Click me" );
            message.setClickEvent( new ClickEvent( ClickEvent.Action.OPEN_URL, "https://www.spigotmc.org" ) );
            message.setHoverEvent( new HoverEvent( HoverEvent.Action.SHOW_TEXT, new ComponentBuilder( "Visit the Spigot website!" ).create() ) );
            return true;``` This doesn't output anything when I do the command
strange grove
#

so

red zenith
#

did you send the output?

strange grove
#

im forcing the player to type out the command

red zenith
#

you create the TextComponent but I don't see anything that sends it to the player (p)

strange grove
#

oof

#

i will wait

#

๐Ÿ˜

#

just go on

#

๐Ÿ™‚

red zenith
#

๐Ÿ˜›

rough hare
#

no

#

lol I said don't reply frost!

red zenith
#

sorry, helping myself right now

rough hare
#

Thats fine!

strange grove
#

are yo uguys buds?

#

sry for the typing

#

im typing so fast

#

๐Ÿ˜

rough hare
#

me?

strange grove
#

yea

#

and frost

rough hare
#

no y?

strange grove
#

oof

#

you sound like it

#

๐Ÿ™‚

rough hare
#

yeah bro thanks

#

by frost's formal language

strange grove
#

well the things you consider

rough hare
#

?

strange grove
#

you are a considerate dude

#

๐Ÿ™‚

rough hare
#

haha thanks

#

whats the output meant to be?

strange grove
#

that not my question to answer but i dunno

rough hare
#

liek this p.sendMessage(ChatColor.AQUA+" Hey " + p.getName() + ", here is our social media!");

strange grove
#

just imangine blue text

rough hare
#

thing is I had that and the text I sent before, but the output wasn't a hover event

strange grove
#

Hey Yodeling_Goat here is our social media!

#

well actually

rough hare
#

yes?

strange grove
#

wait nvm

rough hare
#

lol

strange grove
#

hey what happend to frost?

rough hare
#

why does it say 1000 verified on and not even 1 is on the chat ๐Ÿ˜ญ

#

XD

strange grove
#

is he trying to figure out your code

#

?

rough hare
#

its because they're tired of idiots like me

strange grove
#

๐Ÿ˜

#

wdym?

rough hare
#

no,

sorry, helping myself right now

red zenith
#

omw to antarctica

#

j/k

rough hare
#

xd

red zenith
#

Are you using maven or gradle to build your plugin?

strange grove
#

i personally would use maven

rough hare
#

me?

strange grove
#

but

red zenith
#

H311

strange grove
#

yeah?

red zenith
#

I meant your plugin

strange grove
#

maven

#

always maven

#

๐Ÿ™‚

red zenith
#

have you already included AnimatedFrames as a dependency?

strange grove
#

well

#

i loaded the plugins dependencies

#

but it's not a dependency itself

red zenith
#

you want to add AnimatedFrames, and then in your plugin's onEnable, check to see that it's loaded and then access it

strange grove
#

hmm ok

red zenith
#

because you'll then be able to access it's FrameManager

#

which is what handles changing/creating frames

#

then it's just a matter of creating your own command to find the frame you want to update

#

and replace it with the new source

strange grove
#

no it's not a specific frame

#

it's any frame i want

red zenith
#

what's the point of replace then? if it doesn't target a specific frame?

strange grove
#

well your right

#

but

#

i want to transport what i said to the other commands

#

to make a new one

#

it will take the name of the image then remove it

red zenith
#

as long as you include AnimatedFrames as a dependency, and it's loaded for your plugin to use, you should be able to tie into it's code

strange grove
#

then it will take the new url and same name a put it into the creat commmand

red zenith
#

Make adjustments via the FrameManager class that it provides

strange grove
#

my friend

red zenith
#

just look at the code for its commands

strange grove
#

i can make the player say what i want him/her to say

#

with player.chat

#

if i want it to dispense both commands it will

red zenith
#

you can use events

strange grove
#

yes

#

but

red zenith
#

player issues a command, create a new, custom event, with properties for the information you want to share

strange grove
#

i need to transport the commands contents that i gave it

red zenith
#

or just schedule it in the command

#

right, that's what you do with your custom event

#

whatever things you need to transfer

strange grove
#

how do i make one

red zenith
strange grove
#

ok i'll check this brb

red zenith
#

Anyhow, I have to go, good luck ๐Ÿ˜›

strange grove
#

oh ๐Ÿ˜ฆ

rough hare
#

cya

strange grove
#

but thank you for the help

red zenith
#

no problem, just work at it, I'm sure you'll figure it out in steps.

strange grove
#

yeah

#

i guess

#

๐Ÿ™‚

rough hare
#

Anyone know how click/hover events work, I can't figure it out

strange grove
#

I do not knwo this

rough hare
#

np

strange grove
#

im sry my friedn

#

๐Ÿ˜ฆ

#

๐Ÿ˜Ÿ

rough hare
#

I can't ask more than what you know

strange grove
#

yeah your right fo sure

#

if you want i can suggest a discord channel you cna join for more help

rough hare
#

I shall chill in MC until I get tagged for help

strange grove
#

well for more access

#

to help

rough hare
#

sure!

strange grove
#

i htink it's called cortex development?

#

let me see if i can invite

rough hare
#

for just general plugin development

strange grove
#

yeah

rough hare
#

yes please!

strange grove
#

there is a help section

#

lemme friend first

#

accept plz

#

so i can send

frosty plank
#

Why can no one access my server?

worldly horizon
naive goblet
#

Wouldn't Block#getRelative result in null if the relative block is air? Or is an air block handled as any other blocks?

#

Jds says it's a non null method.

bronze marten
#

will be air yea

naive goblet
#

hmm that's intressting as other stuff in the api handles air related material as null on getters.

midnight summit
#

when i try to go in the website it says bad gateway

rough hare
#

@worldly horizon it's in the config.json

worldly horizon
#

yea i know and i finally found it but i can open it

#

now

#

there is something written like "try to contact the admin of that file or the system adminestrator....

rough hare
#

you should join the iridiumskyblock discord

worldly horizon
#

i am already they cant really help me :c

rough hare
#

oof

worldly horizon
#

yy

rough hare
#

I'm trying to implement a hoverEvent, but can't. I copied the spigot example one and that didn't work. If I send the code, do you think you could tell me where I'm going wrong?

worldly horizon
#

Think i got it rn :3

rough hare
#

damn

worldly horizon
#

I dont really think i can help y sorry that Iridium Plugin is the first one I ever interacted with but good luck ๐Ÿ™‚

frigid ember
#

Is there a way to replace all default mobs in your world with your custom one?

rough hare
#

np

worldly horizon
#

Nvw i broke the whole plugin.... noteven one command work anymore x

#

d

rough hare
#

gg

worldly horizon
#

๐ŸŒš

winged umbra
#

I was reading a tutorial on how to make custom entities on 1.13.2

#

Somehow the NMS changed and I can't seem to figure how to "get the world version"

mild gazelle
#

so i keep getting a null pointer exception on this

#

this.getCommand("skills").setExecutor(new CoreCommand(this));

#

^^ thats the class that is the executor

#

^^Thats the error

#
  main: me.joseph.hexion.hexioncore.HexionCore
  version: 1.0
  commands:
    skills:```
#

thats my plugin.yml

subtle blade
#

Somehow the NMS changed
Fun fact. NMS changes every version. That's why the Bukkit API exists. To prevent plugin breakages. Vanilla code is volatile and ever-changing

thats my plugin.yml
That's your whole plugin.yml?

mild gazelle
#

yeah i just started this plugin

warm carbon
#

hey guys, wanted to ask you something in theory. When having a game (for example SG), when is it the smartest to update the MySQL database async? Instantly after the kill? Cache it and update it at the end?

#

since that is something I'm not really sure about what the smartest way is to do

frosty plank
#

Is there a Spanish helper?

rough hare
#

how do I name several aliases?

#

like atm I can only add one like this "[social]"

#

but I also want to add socials

silk gate
#

@warm carbon after the kill

#
  1. data is saved instantly so doesnt matter if server crashes later
  2. updated data instantly accessible by other applications / servers
  3. you're dealing with such a tiny, tiny, tiny amount of queries, batch requests will have 0 performance impact
warm carbon
#

@silk gate awesome, thanks for your reply man!

silk gate
#

๐Ÿ‘

warm carbon
#

another question, it is a long time since I used mysql. Do you save UUID's by VARCHAR, if so which length? I assume you save the uuid with uuid.toString() then, right? @silk gate

frosty plank
#

Why can no one access my server? :c

silk gate
#

@warm carbon yeah unfortunately with mysql you dont have a native uuid type unlike postgres

#

you have 2 options

#
  1. simple option, uses more bytes - varchar(36)
#
  1. store the uuid as a 128 bit int
#

mysql has some helper functions

mild gazelle
#

@silk gate do you know why im getting the error

silk gate
#

why are you asking me

warm carbon
#

thanks fam @silk gate

mild gazelle
#

idk u seem smart

rough hare
#

thanks

#

but I'm new to java programming, I've searched online but it looks so simple that noone bothers to answer it

silk gate
#

@mild gazelle uh make sure your plugin.yml is included in the jar

mild gazelle
#

yeah

errant valve
#

Ughhh

#

SilkSpawners the monster inside it disappears..

paper compass
#

How would I change the speed of a zombie? [1.8.8]

rough hare
#

por favor

tardy lance
#

so what event do i need to check if a player wants to interact with a horse? because i want that only players who own a horse can interact with their horse and ride it and not others

mild gazelle
#

playerinteractentityevent or playerinteractatentityevent

#

its one of those

tardy lance
#

okay

#

i will try

red bolt
#

.

frigid ember
#

Hey guys, there is a /msg /tell functionnality with spigot ? Because i can use it but i have no chat plugin, its normal ?

subtle blade
#

afaik vanilla supplies you with /tell

frigid ember
#

AND NO /MSG ,

subtle blade
#

No

frigid ember
#

and no /mdg*

#

oh

pastel condor
#

any reason as to why this isn't working? ``` public void gui (InventoryClickEvent event) {

    final Player player = (Player) event.getWhoClicked();
    final Inventory inv = createGUI(player);
     if (!Arrays.equals(event.getInventory().getContents(), inv.getContents())) return;
    
    event.setCancelled(true);

}```

frigid ember
#

So it cant be that

pastel condor
#

the event isn't being canceled

frigid ember
#

how can i find where that /msg come ?

pastel condor
#

just create your own /msg plugin then you can get the sender

#

of the command

frigid ember
#

Well no knowledge for that

subtle blade
#

That is a seriously poor way to handle GUIs

pastel condor
#

really?

subtle blade
#

Make use of the InventoryView

#

Yea, you're creating an inventory every single time you want to check if it's your GUI, then you're comparing every single item within it

pastel condor
#

I'll check out InventoryView, thanks

subtle blade
#

openInventory() will return an InventoryView and all inventory events will have a getView(). They should be == comparable

pastel condor
#

but I will have to cycle through and check?

subtle blade
#

Or map from players to inventory views, whatever. Yea

pastel condor
#

should I just check the title?

rough hare
#

how do I add several aliases? ATM I can only add one like this "[social]" but I also want to add socials

subtle blade
#

Titles are not well defined in inventories and should not be relied upon

pastel condor
#

oh okay

#

thanks

limber marlin
pastel condor
#

go to paper help lol

subtle blade
pastel condor
#

would this work? event.getView().equals(inv) (or is that very inefficient)

subtle blade
#

== the view

#

Hold reference to the views when you open them

pastel condor
#

oh like in a map? (thats what you said earlier xD)

subtle blade
#

Map, Set, yea whatever

pastel condor
#

thanks

subtle blade
#

I would say use a HashSet or something so you can quickly do referencedInventoryViews.contains(event.getView())

pastel condor
#

oh okay

subtle blade
#

InventoryView then has getPlayer()

pastel condor
#

I was thinking player.openInventory(createGUI(player)); player.getOpenInventory() then checking the view

subtle blade
#

player.openInventory(createGUI(player)); quite literally returns an InventoryView

#

InventoryView view = player.openInventory(createGUI(player));

#

Add that view to a HashSet or something, work from that

#

When the inventory closes, remove it

pastel condor
#

thanks a lot! Now I don't have to check every item lol

subtle blade
#

Handling inventories is a lot easier than people think. But instead we have people going about implementing InventoryHolder like they shouldn't

pastel condor
#

thats me ๐Ÿ™‚

#

eclipse told me to implement it so I blindly followed

#

always use your brain before trusting an ide

gaunt thorn
#

Kept getting the same error no matter what I did

#

Spending hours with a friend only to realize it's not the code it's the jar we used in the build path and server

subtle blade
#

No

#

Do not do that

#

It's an illegal mirror

#

BuildTools works just fine for tens of thousands of other people. If something's broken, it's your fault not BuildTools'

pastel condor
#

oh the get bukkit thingy?

gaunt thorn
#

And it works just fine for me except when I want an srmor stand to spawn ๐Ÿ™‚

subtle blade
#

java.lang.Error: Unresolved compilation problem:
EntityEquipment cannot be resolved or is not a field
This implies your plugin is not compiled properly

#

What part of illegal mirror did you not understand? lol

gaunt thorn
#

Rofl this guy "your plugin works completely fine except when using latest buildtools jar it must be his fault"

#

Explain what compilation error is there?

subtle blade
#
    public interface EntityEquipment extends LivingEntity {
        
    }```
#

The fuck is this?

#

You're extending Bukkit

cloud sparrow
#

idiot lol

subtle blade
#

That's not how this works

pastel condor
#

lmao

subtle blade
#

So yes. This guy is right, you're being a dumbass

#

It IS your plugin's fault

#

Do not use illegal mirrors. Use BuildTools and write your code properly

gaunt thorn
#

"Hey guy some methods were changed in the latest update and here's how it works now"

"Fuck you you're stupid, fuck you idiot, fuck anyone who tries to learn plugin development I'mma just be toxic and deter people from learning coding or coming here for support"

subtle blade
#

Bukkit has never been extendable

#

Never

#

If you're extending anything from Bukkit that isn't explicitly declared as extendable, you're doing it wrong

finite belfry
#

so is there any plugins that i can make 1.8-1.14 players join my 1.15.2 server
(bungeecord)

#

so i tried to use viaversion

gaunt thorn
#

That line of code was added last second as we were trying different things that worked. EVEN WITH that line removed you get the same error

finite belfry
#

with viabackwards and viarewind

#

but the whole minecraft game crashed

gaunt thorn
#

Why are we getting entityequipment errors when all we are doing is making an armor stand entity spawn at a location?

#

ONLY having this issue with the latest build tools jar

#

Not the other 1.15.2 spigot jar

subtle blade
#

That stacktrace you sent can only be caused by what you sent above

gaunt thorn
#

That stack trace is from last night

#

That line of code was added 4 hours ago

#

So no it's not only caused by it

cloud sparrow
#

totally my guy lol

subtle blade
#

Give me 5 minutes

cloud sparrow
#

Then show the code you had from last night that caused the stack trace.

gaunt thorn
#

This is the code that caused it

#

All I'm trying to do is make an armor stand in a specific location

#

It works on an older 1.15.2 jar but on the latest one through build tools it throws entityequipment errors

subtle blade
#

Just ran your code

#

No errors

cloud sparrow
#

About to double check the code as well.

subtle blade
#

So yet again, I go back to you doing something you shouldn't

naive goblet
#

Danny the error seemed to come from that equipement method

gaunt thorn
#

sigh

subtle blade
#

I also second that because the code you sent that you claim threw that error states that the error was thrown on a closing bracket

#

lol

cloud sparrow
subtle blade
#

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

cloud sparrow
subtle blade
#

BuildTools has been working for 5 years now

#

If you genuinely believe there's a bug in the server (which there doesn't seem to be, neither Solo nor I can replicate your issue), create an issue on the jira

#

?jira

worldly heathBOT
subtle blade
#

Though as far as I can tell, you're misusing the API and blaming it on BuildTools

#

We do not condone the use of illegal mirrors and we will not allow them to be linked here or on the forums because it's distribution of Mojang's proprietary code

#

It's a violation of the EULA. BuildTools is Spigot's legal workaround to ensure that it is not being broken

#

Do whatever you want to do, but do not encourage others to use it. Use mirrored builds at your own risk, though we advise the use of BuildTools

red bolt
#

if i copy a player's inventory
do all items get copied too ?

subtle blade
#

I'd hope so

#

Though last I recall, Inventories are not cloneable

pastel condor
#

just wondering is this a good way to check if I should cancel shift click? public void preventShiftgui (InventoryMoveItemEvent event) { if ( ((Player)event.getSource().getHolder()).getOpenInventory() != Main.openGUI.get(((Player)event.getSource().getHolder()).getName()) ) return; event.setCancelled(true); }

agile girder
#

I need help with a thing, Im kinda dumb and the person that can help me only knows c++ and csharp

#

how do I loop this 'arraylist'

#
    public void onPlayerChat(AsyncPlayerChatEvent e) {
        ArrayList<String> words = new ArrayList<String>();
        words.add("9b9t");
        words.add("l2x9");
        words.add("scratchem");
        words.add("scratchem-as");
        words.add("dementeranarchy");
        words.add("virginanarchy");
        words.add("earthanarchy");
        words.add("10b10t");
        words.add("66.55.158.15");
        words.add("orbis");
        words.add("2Cry2Baby");
        words.add("alt169");
        words.add("AltCraft");
        words.add("altcraft");
        words.add("sorryanarchy");
        words.add("quaggacraft");
        words.add("abx4");
        words.add("infernoberry");
        words.add("6b0t");
        words.add("solvenda");
        words.add("7b7t");
        words.add("anarchy.bar");
        words.add("anarchy,bar");
        words.add("anarchy-mc");
        words.add("minetexas");
              e.setCancelled(true); {
            }
        
    }
}```
#

ignore the e.setCancelled

gaunt thorn
#

My intent was to try to help, I will admit I did not know "GB" was an illegal mirror there was no malicious intent there and I do apologize for that. Secondly, after re-downloading the buildtools package the spigot jar file there works and plugin runs fine.

The culprit is I'm assuming when the packages were downloading it got interrupted somehow and I was using a faulty jar file as when I try to use the one I previously downloaded it gives me that error with nothing changed. (Just tested it)

#

It's not always someone using it wrong.

pastel condor
#

just wondering, why would you use bukkit?

#

why not spigot or paper?

gaunt thorn
#

I am using spigot?

naive goblet
#

@agile girder

for (Object o : Iterable<Object> io) {
  o.clone();
}
for (int i = 0; i < Collection<Object> co.size(); i++) {
  co.get(i).clone();
}
#

or Iterable<E>#forEach

#

Stream<E>#forEach

#

Stream can be obtained through Stream.of(T...) or Stream.of(T[])

#

You also get an ArrayList by Arrays.asList(T...)

#

So you could actually do something like this

#
Stream.of("rabbit", 
          "bunny", 
          "snowman").forEach(str -> {
  System.out.println(str);
}```
agile girder
#

Sorry I'm dumb, where do I add that?

naive goblet
#
//EventHandler
Stream<String> stream = Stream.of("9b9t", "das" /*more strings*/);

//reference "stream" and loop through it
stream.forEach(str /*str is our reference when iterating over the stream*/-> {
  //do stuff with "str"
}
e.setCancelled(true);
#

I mean you could just do this as well:

for (String word : words) {
  //"word" is now our reference when iterating over the list
}```
pastel condor
#

for some odd reason this doesn't seem to work ``` public void gui (InventoryClickEvent event) {

    final Player player = (Player) event.getWhoClicked();
     if (event.getView() != Main.openGUI.get(player.getName())) return;
    
    event.setCancelled(true);

}Note: I open my inventory using public void openInventory(final Player player) {
InventoryView view = player.openInventory(createGUI(player));
Main.openGUI.put(player.getName(), view);
}
```

naive goblet
#

How are you managing inventories?

#

Why do you nee the inventoryview?

subtle blade
#

Best way to keep track of GUIs

#

Is that gui method called?

naive goblet
#

I mean encapsulate a class with an inventory and inventoryview?

pastel condor
#

thats my code for that class

subtle blade
#

Yea that listener doesn't seem to be registered anywhere

pastel condor
#

xD

naive goblet
#

fierceeo is openGui a static map?

pastel condor
#

yes

naive goblet
#

You may want to use dependency injection instead

#

and avoid the static map

pastel condor
#

sorry, but whats dependency injection?

jaunty night
#

Look up Guice

naive goblet
#
class Main extends JavaPlugin {
  private Map<Player, Integer>;
  @Override public void onEnable() {
    map = new HashMap<>();
    new EventListener(this);
  }
  public Map<Player, Integer> getMap() {
    return map;
  }
}
class EventListener implements Listener {
  private final Main main;

  public EventListener(Main instance) {
    this.main = instance;
  }

  @EventHandler public void onJoin(PlayerJoinEvent e) {
    main.getMap().put(e.getPlayer(), 0);
  }
}```
#

Guice is little overkill?

jaunty night
#

But it will give an idea of how dependency injection works

naive goblet
#

yeah tru

jaunty night
#

But for this case yeah it's overkill

pastel condor
#

is it an overkill?

naive goblet
#

Some if the lib from guice are in my opinion

jaunty night
#

It's like cutting butter with a chainsaw

naive goblet
#

fierceeo but dependency injection is when we're passing objects through constructors.

#

pretty much

red zenith
#

I prefer making lots of butter in a consistent, maintainable way.

naive goblet
#

like ?

red zenith
#

Using guice for dependency injection vs creating a lot of object instances and explicitly passing a bunch of dependencies. Just depends upon how complicated your project is

naive goblet
#

If you're smart you don't make your code passing a bunch of different dependencies in the first place.

#

But yeah I get your point.

red zenith
#

Well, no matter how you handle it, the dependencies are still there

naive goblet
#

I mean there is ways to keep maintainability without using guice.

jaunty night
#

Guice makes it a lot easier though

red zenith
#

I can associate all the dependencies in just a few lines, whether itโ€™s commands or classes that are handlers/managers. Makes it a lot easier to add additional features

minor spruce
#

are the patch things in build tools a part of build tools or are they something else?

red zenith
#

The patches are what makes spigot, spigot

#

They are additions that get inserted into the code of vanilla

minor spruce
#

but are patches a part of maven or git? or are they specifically made for build tools

#

i'm just trying to get a better understanding of how build tools works so i get better use out of it, but i don't really know where i can find that information

wanton delta
#

errr

#

anyone know why i cant run buildtools on centos

gentle shadow
#

spigot's codebase is stored as a bunch of patches to the actual server @minor spruce

#

due to like legal reasons

#

so it's distributed that way & you have to apply the patches yourself

wanton delta
#

Could not successfully run git. Please ensure it is installed and functioning. Cannot run program "git" (in directory "."): error=2, No such file or directory

gentle shadow
#

buildtools just does that for you automatically

wanton delta
#

this isnt on windows

gentle shadow
#

you don't have git

#

that's the issue

wanton delta
#

i need git... even when on linux?

gentle shadow
#

buildtools depends on git

wanton delta
#

im fairly certain you only need git if youre on windows

gentle shadow
#

git does not come on linux by default so yes you need to install it

minor spruce
#

and if i wanted to make my own patches, they're a part of git right?

gentle shadow
#

buildtools applies git patches to the server codebase so you need git to use it

#

buildtools doesn't come with git built in

wanton delta
#

Open your terminal if you are on Linux, or git bash on Windows.

gentle shadow
#

additionally, it's the same jar for windows & linux

wanton delta
#

or

gentle shadow
#

on linux, the default shell is bash, but on windows, it's not, so you have to use git bash to use the bash shell

wanton delta
#

oh i understand now

#

yes

#

sorry

gentle shadow
#

git bash lets you run linux utilities and commands on windows

wanton delta
#

for being

gentle shadow
#

@minor spruce you wouldn't use buildtools for that

subtle blade
#

The concept of patches is supplied by git

#

It is a git feature

gentle shadow
#

you'd clone the spigot repository, run a script to decompile the source & apply patches, then modify the source, then use a script to turn your changes into a patch

#

buildtools is meant for building

red zenith
jaunty night
#

I mean I tend to use WSL over git bash

gentle shadow
#

yeah you don't have to use git bash @wanton delta , you can use other programs too

wanton delta
#

no i understand now

#

i got bash confused with git

minor spruce
#

thanks for the help, i think i know what i need to do, guess i'll just play about with it for a bit

frigid ember
#

Does anyone know how I can use Coord coord = townBlock.getCoord(); with player.teleport? just a bit confused here.

#

townyapi.

barren abyss
#

Hi!, I have a config.yml that ask for a number like:

# Number between 1 and 100
Number: '6'

How can I make that if the number is higher than 100 or lower than 1 throws an error? Just a console.log or should I add something else?

red zenith
#

Do you know how to throw an exception?

frigid ember
keen compass
#

o.O

#

secondary drives has been a thing since the late 90's

#

why would using a second hard drive mess it up?

frigid ember
#

idk that's what I'm curios about

keen compass
#

I mean, if you plan to use it to install stuff, then you can run into issues when you remove the HDD. But if its a permanent internal one, then not much to really worry about

#

I have 5 externals for my computer XD

frigid ember
#

Hi. Excuse me. I have a problem with the Anti-Lag that comes by default from Spigot. What happens is that I don't know how to remove it. I don't know if they understand me very well, but the Anti-Lag makes the Spawn of mobs too weak, making the farms not work very well. It also happens that the drops of experience come together in one, instead of being several drops. Could you tell me how that Anti-Lag is removed?

keen compass
#

o.O

#

not aware of plugins that come with spigot by default, especially not anti-lag ones lol

#

what did you do download a pre-built jar from somewhere?

frigid ember
#

No. I do not download it from anywhere. Spigot comes with a kind of anti-lag so that it doesn't Spawneen so many mobs. But I don't know how to remove it

keen compass
#

are you referring to the config options?

#

if so just modify the configs in the spigot.yml

#

you don't really remove it as it isn't a plugin o.O

frigid ember
#

oh, ok. Thank you!

ashen stirrup
#

Do you know how to throw an exception?
Iโ€™m also interested in this

crimson cairn
#

i thought spigot wasnt supposed to affect vanilla mechanics

keen compass
#
example throw new IOException("message");
red zenith
#

Spigot can be configured to adjust the spawn mechanics

#

if you're expecting a number within a certain range for a config value, would it make sense to use an InvalidArgumentException?

#

@barren abyss You could also hardcode the range you expect the value to be and clamp it, so if the input is <1, then make it 1, or if it's >100, make it 100

barren abyss
#

I add some error throw stuff

#

im working with probability, cant change the numb to a random value, the plugin wouldnt make any sense hahaha, but thanks for the tip

red zenith
#

Well, in the case of the value only being valid within a range, you could enforce it and still give an error message. Was going based off your example.

atomic imp
vocal phoenix
#

hello to all

#

i need help

#

with a command i want to give someone an diamond sword with a custom name but not working

#

this is what i got /give @p diamond_sword 1 [{display{Name:test}}]

red zenith
keen compass
atomic imp
#

where?

red zenith
#

at the bottom

vocal phoenix
#

i tryed that it dont work

pastel condor
#

for some reason it seems like when using inventory view, all guis are equal

atomic imp
#

oh i see

red zenith
#

expand the spoiler

atomic imp
#

but my friend doesnt want to give us OP

vocal phoenix
#

@red zenith i have tryed that it dont work

red zenith
#

how does your friend manage permissions

keen compass
#

then you must not be using 1.15 mc

barren abyss
atomic imp
#

we dont have any permissions

keen compass
#

in which case I can't really help if you are using an outdated version

red zenith
#

well, then that's a problem

atomic imp
#

we need to set it up so we dont have op but can still use the shops

red zenith
#

I would use a permission plugin

atomic imp
#

like?

red zenith
#

LuckPerms is what I use

atomic imp
#

how would I use that for the shop plugin

vocal phoenix
#

@barren abyss i have tryed that as well

#

dows not work

red zenith
#

it comes with a default group, which all users have

vocal phoenix
#

i have tryed four dif web sites

barren abyss
#

@atomic imp you mean you dont have a permissions plugin or the plugin for the shop dont have any permission node?

red zenith
#

so you just add the permissions to that group

keen compass
#

@vocal phoenix would probably help more if you state what version of mc you are using because obviously you are using an outdated one if none of the generators work for you

red zenith
#

/lp group default permission set simpleshopx.buy true global

atomic imp
#

we use luckyperms

vocal phoenix
#

1.15.2

barren abyss
#

@barren abyss i have tryed that as well
@vocal phoenix Are you using essentials or any plugin that modifies give?

vocal phoenix
#

yes essentials

red zenith
#

/lp group default permission set simpleshopx.own true global

atomic imp
#

im so confused

red zenith
#

if you install luckperms on the server

keen compass
#

ah, you need to do /minecraft:give instead to use the mc give command instead of essentials @vocal phoenix

barren abyss
#

Yeah... essentials change /give arguments

red zenith
#

then your friend just needs to issue those commands, either in console or from in game, once they give themselves the permission to use luckperms

barren abyss
#

do what frostalf said

vocal phoenix
#

no im using /give @p

barren abyss
#

but /give is modified by essentials

#

use /minecraft:give

#

to use the default command set by minecraft

red zenith
#

the selector may not work if essentials has overriden the command

atomic imp
#

I still dont know what to do

#

I use lucky perms

barren abyss
#

Essentials override a lot of minecraft default plugins, thats a mess ๐Ÿ˜„

atomic imp
#

but dont know how to use it

red zenith
vocal phoenix
#

ok look i can give a sword with a name by using /give @p minecraft:diamond_sword name:test this works but i want ot add other things like enchantments but it does not work

barren abyss
#

@atomic imp add the permission node of simpleshop into the group that you want to have acces to

red zenith
#

I think the format you linked earlier is wrong

#

what version of mc are you running?

#

Aka

keen compass
#

@vocal phoenix if you are not going to use the commands as mentioned and instead want to insist on using essentials give command then you need to go look at essentials wiki for that

barren abyss
#

@vocal phoenix do not use /give if you are using default arguments, instead use /minecraft:give, and those websites generators will then work.

keen compass
#

^

pastel condor
#

is there any reason why inventory view is the same for every gui a player opens? public void openInventory(final Player player) { InventoryView view = player.openInventory(createGUI(player)); Main.openGUI.put(player.getName(), view); }
and ```
public void gui (InventoryClickEvent event) {
final Player player = (Player) event.getWhoClicked();
if (event.getView() != Main.openGUI.get(player.getName())) return;

    event.setCancelled(true);

}```

atomic imp
#

whats a permission node

#

lol

#

me big dumb

barren abyss
#

๐Ÿ˜•

atomic imp
#

what do I put in the luckyperms config file

barren abyss
atomic imp
#

simpleshopx.buy
Allows players to buy items from shops
Default: op
simpleshopx.own
Allows players create and run shops
Default: op
simpleshopx.admin
Allows players to destroy and the shops of others
Default: op

keen compass
#

@pastel condor need to set the owner as not null

atomic imp
#

this is simple shop perms

vocal phoenix
#

ok i have tryed it woth /mincracft:give still nothing

red zenith
#

you don't change the config file for luckperms

atomic imp
#

then what do I do

red zenith
#

you use the commands provided by luckperms from your server console

atomic imp
#

what are the commands

red zenith
#

or you give your player the permission to use the commands in game

pastel condor
#

who would be the owner then? because I was told not to implement inventory holder @keen compass

red zenith
#

it's all on that website

barren abyss
#

ok i have tryed it woth /mincracft:give still nothing
@vocal phoenix Can I check it on your server?. you can also check the version of your minecraft.

vocal phoenix
#

sure

red zenith
#

If you can't read that page how are you going to understand it if i tell you?

keen compass
#

@pastel condor if the inventory being opened has a null owner, then all players can see it

barren abyss
#

arguments are changed in some versions i guess

vocal phoenix
#

my server is 1.15.2 and spigot 1.15.2

keen compass
#

if you instead just make up an owner you can selectively add players to see it instead

pastel condor
#

but I then have to make a class that implements inventory holder

#

should I just use inventory.equals(inventory)

keen compass
#

In order to have an intventory view, you need an inventory

#

the inventory you create needs an owner

atomic imp
#

so /lp then what

pastel condor
#

I just want to create a gui

red zenith
#

help

pastel condor
#

should I use inventoryview or check inventories with .equals for guis?

red zenith
#

@atomic imp for any user to be able to buy and create shops you just need to do the commands I shared earlier

#

Whoever runs the server and has op probably has the permission/ability to use the commands for /lp

#

@vocal phoenix /minecraft:give @p diamond_sword{display:{Name:"\"Big Sticker\"",Lore:["\"Stabby stab stab\""]},Enchantments:[{id:sharpness,lvl:5},{id:fire_aspect,lvl:2},{id:looting,lvl:3},{id:sweeping,lvl:3},{id:unbreaking,lvl:3},{id:mending,lvl:1}]}

small citrus
#

what is the best way to reload a plugin? i dont want to keep having to restart my server everytime i update it and test it

pastel condor
#

get plugman reload then /plugman reload (plugin name)

barren abyss
#

plugins are not ment to be reloaded when the server is running but yeh plugman

keen compass
#

generally that is down to poor design if it can't handle reloading

barren abyss
#

Not necessary

#

If 2 plugins are working together and you reload one, it might cause any error

keen compass
#

then that second plugin shouldn't be making assumptions and should be checking that what they have is valid

barren abyss
#

Im not saying that you cant handle those errors, im just saying that even essentials have errors when reloading something

keen compass
#

well even popular plugins make mistakes or poor design choices

#

if there is something that the server provides to the server ops, then you probably should design your plugin to handle such scenarios if they are something to possibly happen

barren abyss
#

Right

#

I have a question, I didnt try it yet im just messing with itemstack, but if I want to drop the custom item I just have to add the item name to the drop? ^^

opal bramble
#

@zenith palm i need help please

keen compass
#

Depends what methods you are using to drop the itemstack

pastel condor
#

for some reason this map seems to have messed up values static HashMap<String, Inventory> openGUIs = new HashMap<String, Inventory>();

keen compass
#

well you are putting an object as a value, but what messed up values does it have?

barren abyss
#

Help with ItemStack.
Im trying to change a Helmet default protection, is there any way to do it? didn't find anything in the docs.

frigid ember
#

should project be com.domain.pluginName.MainClass or com.domain.MainClass?

keen compass
#

what do you mean project?

#

packages should be lower case, while classes it is alright to have capitals

#

I would probably opt for the first on in case you make more plugins

rain plank
#

Does anyone know what the command is for all players since @a isn't working?

pastel condor
#

/minecraft:minecraft command ex /minecraft:kill @a

tiny dagger
#

pluginname is a must to prevent clashes with your other projects

pastel condor
#

this gui system doesn't seem to work ``` public void gui (InventoryClickEvent event) {
final Player player = (Player) event.getWhoClicked();
if (!(event.getInventory().equals(Main.openGUI.get(player.getName())))) return;

    event.setCancelled(true);

}and public void openInventory(final Player player) {
Inventory inv = createGUI(player);
player.openInventory(inv);
Main.openGUI.remove(player.getName());
Main.openGUI.put(player.getName(), inv);
}```

rain plank
#

Well, I'm trying to have a crate for all online players but @a doesn't work.

heady jolt
#

@a don't exists on lower Minecraft version, such as 1.7.10

pastel condor
#

how can I check if a player clicked in my gui?

#

event.getSource() != Main.openGUI.get(((Player)event.getSource().getHolder()).getName()) doesn't seem to work

rain plank
#

I have 1.15.2

heady jolt
#

I always do this.

InventoryClickEvent e {
  if(e.getInventory().getHolder instanceOf MyGUI)
      // ...
}

Also don't compare Inventory name, it can easy to exploit

frigid ember
#

looking for a lootcrate system?

#

like give keys to everyone and let them unlock a crate @ spawn?

pastel condor
#

@heady jolt but then you're implementing inventoryhandler?

#

and thats considered bad I though

heady jolt
#

InventoryHolder

pastel condor
#

yes

heady jolt
#

Nah. It's works fine

pastel condor
#

idk, I mean I used to use it

#

choco got mad at me

heady jolt
#

You must reading someone on spigot said: You abuse this you abuse that

#

but in the end, comparing inventory name is bad. from what I know

pastel condor
#

idk then

#

I mean instanceof is the fastest way

heady jolt
#

Do what fit you the most. I test it on the server, I see no exploit.

pastel condor
#

oh okay

#

thanks

stable escarp
#

anyone able to help?

keen compass
#

?ask

worldly heathBOT
#

If you have a question, please just ask it. Don't look for staff or topic experts. Don't ask to ask or ask if people are awake or available. Just ask the question to the channel straight out, and wait patiently for a reply.

frigid ember
#

Yo guys, I'm messing around with TNT fuse lengths

#

I want my TNT to detonate at after 1200 ticks (1 minute)

#

However, it detonates after its "normal" number of ticks, with no respect to my fuse timer

#

It also does not decrease the number of ticks - it would seem strange for me to manage the reduction of ticks

tiny dagger
#

use nms

frigid ember
#

kill me

tiny dagger
#

i don't know what you change but i'm pretty sure it's not exposed in the api

keen compass
#

you need to swap the TNT for a TNTPrimed which is an entity if I recall

frigid ember
#

@keen compass Well aware of that one, the problem is Minecraft does not reduce the tick count

keen compass
#

what do you mean reduce the tick count?

frigid ember
#

private TNTPrimed tnt;

...

tnt = (TNTPrimed) Bukkit.getWorld(Statics.worldName).spawnEntity(newLocation, EntityType.PRIMED_TNT);

...

    tnt.setCustomName("the region that the player is in + tnt");
    tnt.setCustomNameVisible(false);
    tnt.setFuseTicks(SiegeUtilities.getBombTicksByLocation(tnt.getLocation()));
    defuseClicks = SiegeUtilities.getDefuseClicksByLocation(tnt.getLocation());
    tnt.setInvulnerable(true);
iron kiln
#

Hey everyone, I own a 1.7/1.8 hcf server and was wondering how to fix a glitch. People can put a sand or gravel above their head in a 1 by 1 and then break blocks while walking forward to go into peoples claims/bases. Is there a way to fix this block glitch? Unfortunately disabling the blocks or block falling is not an option for us on hcf.

keen compass
#

next time, please surround your code with 3 back ticks so that it looks better

#

are you certain the ticks being set are actually correct?

frigid ember
#

Bro, I am fully aware of proper code syntax

keen compass
#

I mean when posting it to discord

#

surround your code with 3 `

frigid ember
#

k

#

yes, I am certain the ticks being sent are correct.

keen compass
#

Anyways, only thing I can think of is that the number of ticks you are setting are not what you think it is

frigid ember
#

Trust me, that is not the issue. I believe this is something deeper.

#

I found this^, not sure if its still relevant

keen compass
#

interesting, will have to open my IDE up to see

stable escarp
#

Answer already found but ty

keen compass
#

think you can probably resolve it by sending an extra Metadata packet to the client

#

Metadata packets for entities are not required when they spawn, so probably could just send that packet with your values to the client to see if the client updates as expected

#

not the ideal solution, but if it works then it solves your problem lol

tiny dagger
#

they are in 1.15 frostalf

#

they are completly separated

keen compass
#

Metadata packets are not required, they are optional

tiny dagger
#

optional

#

but spawn doesn't crarry them

#

at all anymore

frigid ember
#

Do you guys know of some resource for nms packets. Reflecting into each class invidually & reading its methods sucks

keen compass
#

Spawn packet doesn't contain the metadata anymore you are right, but they are not required to be sent either when an entity does spawn

frigid ember
#

And is a hugeeee damper on productivity

keen compass
#

I know this because I had to fix a plugin I maintain for this specific scenario

#

Where an entity spawns but no metadata given

#

the handy thing is though since it is a separate packet, you can send metadata anyways or a duplicate metadata packet

#

@frigid ember could use protocollib to send metadata packets for entities if you just want to test really quick

#

but would recommend if it does work that you implement that yourself instead of using a large lib for that one thing

chrome edge
#

Is there a way to check chunk is in loading process or not?

keen compass
#

not entirely sure you can do that without nms, only thing I can think of that wouldn't require nms is to see if a region file has a lock on it to determine that

#

if the lock is present, it means the server has it loaded

chrome edge
#

I'm trying to check location's block on PacketFly and want to wait if chunk is in loading.

#

And I also don't want to sync check. It's delaying the check

keen compass
#

just use the isLoaded() check, if it isn't loaded just wait till it is loaded

#

create a boolean function that does the checking

#

and then you can implement it into whatever task you have to wait till that boolean function comes back true. But might want to implement a timer on it though in case it never does load so a max wait time lol

chrome edge
#

I'm checking next location so system cannot be sure the chunk might be in sync loading. If I try to check or get chunk it gives me async throwable

#

Is there any other way to do that? I don't want any delay on the process :/

keen compass
#

then check if it is loaded then if not tell the server to load it is the only thing I can think of if you don't want to wait

chrome edge
#

Yeah I can make list for that whenever chunk is loaded add into it but isn't it bad way to do that? I wish there is chunk load think in packetfly ๐Ÿ˜ญ

keen compass
#

not sure how you have it implemented but if you just need the chunk data, could always just read the region file instead to get all the chunks you might need XD

#

as long as you are not modifying the region file, should be fine with reading it

frigid ember
#

@keen compass I will have to use nms many times throughout my plugin, so maybe protol lib not such a bad idea?

#

Itโ€™s just another external dependency, no?

keen compass
#

yes, but it is a large one and if you are only using it for just one thing, doesn't really make sense to require a hard dependency on it if you can implement it easily for that one packet

#

good news is protocollib is often used so most servers will probably have it anyways. personally I try to make my plugins not have as many hard dependencies on things if it isn't necessary. Therefore they have soft dependencies. That is if it is present it uses it, if not uses its own internal stuff. But it doesn't really make a difference if this plugin of yours isn't going to be something public

small citrus
#

how would i run a event when a tnt i spawned explodes

keen compass
#

BlockExplodeEvent should probably do it

small citrus
#

thanks

iron kiln
#

Hey everyone, I own a 1.7/1.8 hcf server and was wondering how to fix a glitch. People can put a sand or gravel above their head in a 1 by 1 and then break blocks while walking forward to go into peoples claims/bases. Is there a way to fix this block glitch? Unfortunately disabling the blocks or block falling is not an option for us on hcf.

keen compass
#

hcf?

#

what is that some other fork? if so not sure why you are trying to get help here for some other fork

#

second, you are on very outdated versions

#

so glitches in the server are going to be on you to fix

iron kiln
#

hcf is a gamemode, hardcore factions. The reason we use 1.7/1.8 is for the pvp and the community within in

chrome edge
#

@keen compass As you said, I could get block with NMS(WorldServer).

#

Do you know what is the fastest way to get material and type from NMS Block data (IBlockData)?

keen compass
#

not sure where I recall specifying NMS o.o

#

I said without using NMS you could read a region file lol

#

if you are using NMS, the fastest way to get the material and type is just to read the NBT data yourself

frigid ember
#
Caused by: java.lang.ClassNotFoundException: com.comphenix.protocol.events.PacketEvent
        at java.net.URLClassLoader.findClass(Unknown Source) ~[?:1.8.0_251]
        at org.bukkit.plugin.java.PluginClassLoader.findClass(PluginClassLoader.java:101) ~[spigot.jar:git-Spigot-1.7.9-R0.2-208-ge0f2e95]
        at org.bukkit.plugin.java.PluginClassLoader.findClass(PluginClassLoader.java:86) ~[spigot.jar:git-Spigot-1.7.9-R0.2-208-ge0f2e95]
        at java.lang.ClassLoader.loadClass(Unknown Source) ~[?:1.8.0_251]
        at java.lang.ClassLoader.loadClass(Unknown Source) ~[?:1.8.0_251]
        ... 20 more
vernal spruce
#

Ahh yes a random error log with no context time to do my magic

chrome edge
#

I think it's stupid idea to use PacketInFlying packet for checking blocks so I move PlayerMoveEvent.

#

As I see from source code of spigot, there's nano second delay between packet and move event. So there's no problem with it

vernal spruce
#

As long as you are carefull what you do in it,ur good

chrome edge
#

I used to use packets for just didn't want to delay

vernal spruce
#

Also seems it cant find ProtocolLib at start up

#

Make sure you have it soft depend

keen compass
#

or hard depend if its absolutely necessary

#

But in either case it isn't going to help if you are not going to catch exceptions regardless XD

worn gate
#

i know it seams very stupid but how do i do that ?

int avance = 0;
Bukkit.broadcastMessage(messages[avance]);
int avance =+1;

Error : Duplicate Local Variable avance```
 ?
brisk mango
#

avance +=1;

#

or

#

avance++

#

or

#

++avance

#

avance += 1 is just avance = avance + 1 shortened

tiny dagger
#

lol

vernal spruce
#

Oh boy..

bleak creek
#

get rid of "int" in front of the second avance

worn gate
#

doesn't work

vernal spruce
#

On other news anyone know a way to bypass the 1.13 iron golem fix? They no longer spawn in air

brisk mango
#

quitwolf no need to tell him 6 times

#

how so gnaboo

worn gate
#

seam's it work

#

thx @bleak creek

bleak creek
#

lmao

brisk mango
#

what, why did you say it doesnt work then

frigid ember
#

Hey anyone can help me i cannot talk in my server
everytime i talk this happened
no one can see my message

brisk mango
#

what

frigid ember
#

i cannot talk

#

on my server

brisk mango
#

and

tropic nacelle
#

Delete all your plugin and add em back one by one until you can talk

worn gate
#

look in the logs

azure finch
#

    @EventHandler
    public void Death(PlayerDeathEvent event){
        Bukkit.broadcastMessage("Hi");
    }
}```
Doesn't works
hoary parcel
#

Did you register the listener@

#

?

azure finch
#

Yes

brisk mango
#

why is it called Death

tropic nacelle
#

how

hoary parcel
#

Why not?

brisk mango
#

thats now how are methods called

tiny dagger
#

it has no importance

brisk mango
#

it does

tiny dagger
#

to you

brisk mango
#

for the person

#

its more readable

#

with other code

#

show main class @azure finch

azure finch
#
package ibmesp.deathmessages;

import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.plugin.PluginDescriptionFile;
import org.bukkit.plugin.java.JavaPlugin;

public class DeathMessages extends JavaPlugin {
    public String version;
    public String name;

    public void onEnable() {
        PluginDescriptionFile pdffile = getDescription();
        version = pdffile.getVersion();
        name = ChatColor.DARK_RED + "[" + pdffile.getName() + "]";

        Bukkit.getConsoleSender().sendMessage("[DeathMessages] - Version: " + version + " Enebled - By IBM_ESP ");
    }
}
hoary parcel
#

See, as I said

bleak creek
#

lmao

hoary parcel
#

You don't register the listener

brisk mango
#

"registered listener"

bleak creek
#

Bukkit.getPluginManager().registerEvents(new Messages(), this);

#

literally anywhere in your main class

brisk mango
#

i wouldnt use PlayerDeathEvent for death messages

tropic nacelle
#

oi spoon feeder!

brisk mango
#

there is no method that returns the killer in the death event

bleak creek
#

lmao he's clearly just starting, just give him some code and let him explore it

brisk mango
#

there is one in the Player interface but that doesnt work properly

#

doesnt return the actual killer

#

use EntityDamage/ByEntityEvent

#

you can get the cause + damager

azure finch
#

I just want to give a personal messsages like if its called Mario say "Go to the castle"

brisk mango
#

okay then

oak stump
#

Lol there are lots of YouTube tutorials for this, like VerveDev or {TheSourceCode} or pogo

#

Or just a google search

brisk mango
#

VerveDev has very shit tutorials

#

with the source code too

oak stump
#

Yes

worn gate
#
String messages[]= {"message1", "message2"};
Bukkit.broadcastMessage(ChatColor.GREEN + "Bienvenue a "+player.getName()+" sur Gnanpvp !");
int avance = 0;
while(avance < messages.length) {
Bukkit.broadcastMessage(ChatColor.GREEN  + messages[avance]);
avance =+1;
}```

But i still only get "message1" in chat... can anyone help pliz ?
brisk mango
#

when do you call this

oak stump
#

Probably because the tutorials were 1.8.8 so, also CodedRed is doing a series rn if that helps

#

1.15+

brisk mango
#

no the version doesnt matter, they are using very bad java practices

#

were

#

@worn gate just do something like this

oak stump
#

Yes they r

brisk mango
#

@Override
public void onEnable() {
broadcast();
}

private void broadcast() {

final char[] chars = {'a', 'b', 'c', 'd', 'e'};
int count = 0;

Bukkit.getScheduler().runTaskTimer(task -> {
if(count != 4) {
Bukkit.broadcastMessage(Arrays.toString(chars[count]));
count++;
return;
}

count = 0;
});
}
keen compass
#

@worn gate
while(avance <= messages.length)

bleak creek
#

lmao

#

that's gonna lead to array out of bound exception

worn gate
#

yes but it's not in my public void onEnable(), it's in another class

bleak creek
#
for (int i=0; i<messages.length; i++) {
Bukkit.broadcastMessage(message[i]);
}
#

Super fundamental for loop ^

keen compass
#

should use an enhanced loop though

#

if you want to be technical

brisk mango
#

this is gonna broadcast all the messages at the time quitwolf

bleak creek
#

...considering he was using a while loop before, I think this is okay

keen compass
#
for (String messageString : messages) {
    Bukkit.broadcastMessage(ChatColor.GREEN  + messageString);
}
bleak creek
#

Could, but that creates a new instance of Iterator

brisk mango
#

no lol

#

string instead of messages

worn gate
#

not Bukkit.broadcast, player.sendMessage()

brisk mango
#

what creates an instance of iterator lol

oak stump
#

?playerdeathevent

#

Bruh

worn gate
#

i'm trying ur method

bleak creek
#

Using the colon operator in the for loop.

brisk mango
#

no

#

for(Object object : objects) { }

#

it doesnt

#

why would it

agile lava
#

enhanced for loops use an iterator in the background

bleak creek
#

^

brisk mango
#

they dont create a new instance every time though

worn gate
#

while(avance <= messages.length) @keen compass crashed my server because it was spamming in chat

bleak creek
#

No, but it's unnecessary

worn gate
#

i'll try this : for (int i=0; i<messages.length; i++) {
Bukkit.broadcastMessage(message[i]);
}

bleak creek
#

That's great!

brisk mango
#

@bleak creek thats not an new instance though they take the iterator from memory

keen compass
#

@worn gate lol, should flip that operand around then

#

if you want the while loop

#

but, an enhanced for loop is better suited though

#

for your case

bleak creek
#

It's a performance/memory thing, it has relatively the same effect

#

Just a best practice to use what I suggested.

keen compass
#

iterators are not inherently bad

bleak creek
#

no, I would honestly even agree from a readability standpoint they are superior

keen compass
#

that persons use case, its perfect

#

not like it has to do much processing

bleak creek
#

Like I said, just suggested it because it's a best practice

hoary parcel
#

Preeeettty sure compiler optimizes enhanced for loops for lists

keen compass
#

in this case its an array not a list lol

hoary parcel
#

Then it's the same anyways since arrays have no iterators

bleak creek
#

I wouldn't worry about it too much, not worth debating lol

hoary parcel
#

It would be the exact same bytecode

keen compass
#

Well, as you can see there is many ways to accomplish this

#

I guess just pick which ever one you like ๐Ÿ˜›

worn gate
#

and how could i put a 100 ticks between every messages with bukkit runnable ?

String messages[]= {"message1", "message2"};
for (int avance=0; avance<messages.length; avance++) {
player.sendMessage(ChatColor.GREEN + messages[avance]);
                        }``` ?
bleak creek
#

Ah see now you want the other guy's suggestion

worn gate
#

?

#

this one ?

@Override
public void onEnable() {
broadcast();
}

private void broadcast() {

final char[] chars = {'a', 'b', 'c', 'd', 'e'};
int count = 0;

Bukkit.getScheduler().runTaskTimer(task -> {
if(count != 4) {
Bukkit.broadcastMessage(Arrays.toString(chars[count]));
count++;
return;
}

count = 0;
});
}```
bleak creek
#

lol something like that... pretty messy if you ask me

azure finch
#
    public void Death(PlayerDeathEvent event) {
        if (player.getName() == "IBMSecuncario") {
            Bukkit.broadcastMessage("Hi");
            if (player.getName() == "IBM_ESP") {
                Bukkit.broadcastMessage("Hp");
            }

What should I add?

brisk mango
#

player.getName() == "IBM_ESP okay

#

@bleak creek how is that messy lol

bleak creek
#

You should use .equals() for strings

worn gate
#

well i would like it to work when a player joins and that he has never joined before

    @EventHandler
    public void onPlayerJoin(PlayerJoinEvent event) {
        
        new BukkitRunnable() {
            @Override
            public void run() {
                Player player = event.getPlayer();
                boolean hasJoin = player.hasPlayedBefore();
                if(!hasJoin) {
                                    final char[] chars = {'a', 'b', 'c', 'd', 'e'};
int count = 0;

Bukkit.getScheduler().runTaskTimer(task -> {
if(count != 4) {
Bukkit.broadcastMessage(Arrays.toString(chars[count]));
count++;
return;
}

count = 0;
});
}

                                    }``` ?
brisk mango
#

no should

#

what

#

are you creating new BukkitRunnable every time player joins which runs a scheduler inside of it?

#

lol

#

it wont work

bleak creek
#

lmao, hold on @worn gate Just like tell us what your goal is?

#

If it's to learn a ton of new spigot/java stuff, then this is fine, whatever

azure finch
#

@bleak creek Like this?

            Bukkit.broadcastMessage("Hi");```
bleak creek
#

But if you're trying to actually achieve something specific, there are probably better ways to do it

#

Or less convoluted at least

#

no

worn gate
#

i would just like the messages to display after 30 secondes (because of AuthMe register) and then to display messages in a list which happens every 5 secondes

#

to make sort of like an irl conversation

brisk mango
#

to a specific player?

worn gate
#

no

#

but only if they never joined b4

bleak creek
#
player.getName().equals("IBMSecuncario")
azure finch
#

okay defnitly im stupid

worn gate
#

i'm even more @azure finch , don't worry ๐Ÿคฃ

azure finch
#

and in this code Player player = (What gooes here)

keen compass
#

love how we keep suggesting solutions and the person keeps adding requirements as we solve each one making the code change drastically to handle each new requirement

bleak creek
#

lol

worn gate
#

so does anyone has an idea of how should this work ?

bleak creek
#

That's why I asked for a specific usage

#

I'm still not clear what you're trying to do

azure finch
#
    public void Death(PlayerDeathEvent event) {
        if (player.getName().equals("IBMSecuncario")) {
            Bukkit.broadcastMessage("Hi");
            if (player.getName().equals("IBMS") {
                Bukkit.broadcastMessage("Hp");
            }
        }
    }
}```
I mean the "player" its in red how i solve that
bleak creek
#

...

#

lol

#

You don't have a player variable defined

#

You want to pull one from the PlayerDeathEvent

azure finch
#

yea thas waht im asking

bleak creek
#

presumably

frigid ember
#

i need help with a command block if anyone could help, not my thing

bleak creek
#

event.getPlayer()

keen compass
#

?ask

worldly heathBOT
#

If you have a question, please just ask it. Don't look for staff or topic experts. Don't ask to ask or ask if people are awake or available. Just ask the question to the channel straight out, and wait patiently for a reply.

worn gate
#

i would just like the messages to display 30 secondes after the player joined (because of AuthMe register) if the player never connected b4 and to make sort of like an irl conversation i would like to have a gap between every messages of 100 ticks (5 secondes)

bleak creek
#

But why

worn gate
#

for a magical plugin

keen compass
#

There is a conversation API that would solve this

#

and no tick loops needed

worn gate
#

so the messages explain how it works, after it open a gui and etc

keen compass
#

with the conversation api you can put the player in their own chat channel with the server and parse their repsonses however you see fit as well as their actions etc.

bleak creek
#

It is nice ^

frigid ember
#

im having bother with luckyperms were players can use /kits {name}, so im just going to use a command block for the time being, problem is now that when i use "/kits essentials" i need it to be usable by who ever stands on it, i thought @p was the command but im wrong

azure finch
#

event.getPlayer()
@bleak creek This goes in the variable?

frigid ember
#

so i tryed "/kits essentials @p" btw

bleak creek
#

if you want to use it later many times, sure

#

If you're only going to use it the once, or perhaps twice, you can just call the method getPlayer() on the event when you need that Player variable

#

i.e. If you replace the word "player" in your code above with event.getPlayer(), it would work

keen compass
bleak creek
#

Or, if you added a line Player player = event.getPlayer();

#

that would also work

worn gate
#

could this work ?

    @EventHandler
    public void onPlayerJoin(PlayerJoinEvent event) {
        
        new BukkitRunnable() {
            @Override
            public void run() {
                Player player = event.getPlayer();
                boolean hasJoin = player.hasPlayedBefore();
                if(hasJoin) {
                    
                        String messages[]= {"msg1", "msg2"};
                        Bukkit.broadcastMessage(ChatColor.GREEN + "Bienvenue a "+player.getName()+" sur Gnanpvp !");
                        
                        new BukkitRunnable() {
                            @Override
                            public void run() {
                        
                        for (int avance=0; avance<messages.length; avance++) {
                            player.sendMessage(ChatColor.GREEN + messages[avance]);
                        }
                            }
                        }.runTaskLater(plugin, 100);
                        Inventory Classe = Bukkit.createInventory(null, 54, "");
                        player.openInventory(Classe);
                }
                
            }
        }.runTaskLater(plugin, 20*30);
    }```
brisk mango
#
public final class CraftRunnable {

public void runTask(Runnable runnable, long delay, long period, 
TimeUnit unit) {

int generatedId = ThreadLocalRandom.current().nextInt(50000000) + 1;
ids.add(generatedId);

final ScheduledExecutorService service = Executors.newScheduledThreadPool(1);

services.put(generatedId, service);
service.scheduleAtFixedRate(runnable, delay, period, unit);
}

public void cancel(int id) {
if(ids.contains(id)) {
ScheduledExecutorService service = services.get(id);
service.shutdown();
}

}

}

private CraftRunnable runnable;

@Override
public void onEnable() {

runnable = new CraftRunnable();
broadcast();
}

public void broadcast() {
runnable.runTask(() -> {

}, 20L, 20L, TimeUnit.SECONDS);
}
keen compass
#

o.o

brisk mango
#

ez

bleak creek
#

lmfao

keen compass
#

soooo much code

brisk mango
#

very best code

bleak creek
#

Who was the person earlier telling me not to spoonfeed lmao

keen compass
#

lol

brisk mango
#

this wouldnt work tho

keen compass
#

I should just create a bot to sit in here to make gists of all the code that gets contributed here

worn gate
#

rrrrrrrrrrr

brisk mango
#

CraftRunnable lol

azure finch
#

Now get player its in red

keen compass
#

fix the imports

brisk mango
#

final Player player = event.getPlayer();

#

final Player player; <- declaration

worn gate
#

doesn't help... @keen compass

keen compass
#

what doesn't help?

brisk mango
#

player = event.getPlayer() <- assignment

#

event.getPlayer() returns Player

#

player is just an variable

azure finch
brisk mango
#

what event is that

bleak creek
#

PlayerDeathEvent, presumably

worn gate
#

PlayerInteractEvent ?

brisk mango
#

getEntity()

#

(Player) event.getEntity()

azure finch
#

ok thanks

bleak creek
#

either way, all those Player... Events have a getPlayer() method I think

brisk mango
#

no they dont

bleak creek
#

Could be wrong

brisk mango
#

because spigot is retarded

#

PlayerDeathEvent is an player event

#

and it doesnt

bleak creek
#

lmao well ig my b, that's kinda dumb

brisk mango
#

i know

#

also with the Player#getKiller

#

the killer is casted to player

wraith thicket
#

The PlayerDeathEvent actually extends EntityDeathEvent and thus has the getEntity method which returns the player

brisk mango
#
public Player getKiller() {
        return this.getHandle().killer == null ? null : (Player)this.getHandle().killer.getBukkitEntity();
    }
#

its a PlayerDeathEvent tho

#

and look at this

#

this is really dumb lol

#

why is it casted to player

worn gate
#

my code still doesn't work ๐Ÿ˜ข

bleak creek
#

What is that from? The PlayerDeathEvent?

tiny dagger
#

it's normal to some degree

brisk mango
#

Player

#

CraftPlayer

#

no actually

#

CraftLivingEntity

bleak creek
#

What if it isn't a player killing them?

brisk mango
#

i dont know

#

its broken the whole thing

#

plus it doesnt return the killer

#

it returns the entity that last damaged them before the killer

bleak creek
#

lol

brisk mango
#

u can try it urself

#

thats why ppl use the entity damage events

tiny dagger
#

^

#

which btw makes the code look terrifyinh

wraith thicket
#

The NMS killer field of the EntityLiving class is of type EntityHuman - the EntityPlayer class is the only one that extends it as far as I'm aware

brisk mango
#

no

azure finch
#

Just work for the first Player

brisk mango
#

doesnt really make it look terryfying

#

depends whos doing it

bleak creek
#

lol just a basic ternary operator

tiny dagger
#

you never tried to get the entity behind the projectile did you

brisk mango
#

event.getDamager().getName()

tiny dagger
#

yeeah that would return the projectile

brisk mango
#

no

wraith thicket
#

To be honest, that's rather trivial... just create a method to do it for you

azure finch
#

Ok solved

brisk mango
#

it wont return projectile

#

it will return LivingEntity

bleak creek
tiny dagger
#

it's not really needed

wraith thicket
#

It does in fact return an Entity, but if the damaging entity was an arrow, then that's what will be returned. Projectiles are also entities.

tiny dagger
#

it can be done in if (e.getDamager() instanceof Projectile) {
Entity shooter = (Entity) ((Projectile) e.getDamager()).getShooter();

brisk mango
#

yes

tiny dagger
#

but look how it looks

brisk mango
#

just wanted to say

#

it looks fine?

#

probably never trying to do anything harder if u say this looks horrible

#

lol

tiny dagger
#

i did

azure finch
#

Yeeeea it works thaks for helping me and sorry for wasting ur time

brisk mango
#
 if (event.getDamager() instanceof Projectile) {
            Projectile projectile = (Projectile) event.getDamager();
        }
#

u dont need to double cast

#

lol

tiny dagger
#

the source

bleak creek
#

What is happening here lmao

tiny dagger
#

you need the source tho

brisk mango
#

What source

tiny dagger
#

the one who shoot the projectile

bleak creek
#

Why are you assuming there's a projectile involved

brisk mango
#

LivingEntity entity = projectile.getShooter();

tiny dagger
#

it happens to be

brisk mango
#

how does that look bad

#

if(projectile.getShooter() != null) {
LivingEntity entity = projectile.getShooter();
entity.getType() etc
}

tiny dagger
#

i don't think we talk about the same thing do we?

brisk mango
#

youre doing it such retarded way lol

#

ofc u cannot cast shooter to projectile

#

projectile isnt shooter