#help-development
1 messages · Page 1553 of 1
show entire onEnable
public void onEnable() {
// Plugin startup logic
instance = this;
getServer().getPluginManager().registerEvents(new onPlayerJoin(),this);
getServer().getPluginManager().registerEvents(new BlockBreak(),this);
getServer().getPluginManager().registerEvents(new Event(),this);
getCommand("deleteHand").setExecutor(new DeleteHand());
getCommand("heal").setExecutor(new Heal());
Disable d = new Disable();
getCommand("disablePlugin").setExecutor(d);
getCommand("giveWand").setExecutor(new getSpecialItems());
getCommand("privateChest").setExecutor(new VaultCommand());
getCommand("privateChest").setTabCompleter(new VaultCommand());
ItemManager.init();
DataBase db = new DataBase();
getServer().getConsoleSender().sendMessage(ChatColor.GREEN+"Plugin has loaded.");
}```
aside from instantiating VaultCommand twice it looks fine
I'll try make a test plugin and implement it there
What does minecraft classify operator perm as? Example minecraft.operator?
vanilla does not have a definition of such stuff - but I think you are searching for op
I discourage against explicitly checking against permissions unless you do even worse shit
it instantiates it once
from what i see
twice
it is twice
getCommand("privateChest").setExecutor(new VaultCommand());
getCommand("privateChest").setTabCompleter(new VaultCommand());
makes two instances of VaultCommand
basic OOP
aah i see
cutor(new VaultCommand());
mpleter(new VaultCommand());
i thought you were talking about the command itself not the executor/tab completer
my mistake
I just made a test plugin used the same things and it works... wth
Hello everyone, I'm getting an error with a plugin called QualityArmoryVehicles with this error:
https://paste.md-5.net/ijageludap.pl
Server Version: 1.16.5 that happens when i'm placing planes & helicopters
Is there any reason of this error, and a solution?
does it have tanks
there is one tank, but the texture is glitched
great
Why?
how about artillery or cannons of some sort
all of my 3 browsers are fucking dying
2 of them can't render the paste site properly because apparently md69 needs 2020 tier javascripts or frameworks to render text
and the third is slow as shit
i fucking hate technology
something is trying to set an infinite velocity to an entity
probably a math error in the vehicle plugin, dividion by zero or something
report it to the author
even if it's a misconfiguration, that shouldn't happen if the plugin is written properly
since it's a vehicles plugin it's probably premium and closed source too so nobody other than the author can do shit about it
The author will not reply as fast as I want
My server opens on friday
I'll not have the time
looks like it's open source but premium
yes 🤔
So if anyone nice can just fix that shit... 😢
Also when I do /qav spawnVehicle <vehicle> that's not working
did you configure it to have an infinite velocity or something
i'm not sure how that'd end up being infinite, looking at the source
I didn't changed anything
I have an issue, how can I have two different java versions for plugin development with BuildTools for 1.17 and older versions ?
it copies the direction of the vehicle
and then normalizes it so the vector length is 1.0
and then multiplies it by the speed
although it looks like there's some logic setting the y and normalizing it afterwards
which could cause it to turn infinite
yeah you'll have to ask the author, this is spaghetti
Oh wait,
maybe it is because it's QualityArmory and not QualityArmory Vehicles
Here's the real link, I'm sorry*
QualityArmory was for gun only
Yeah, I already looked at this one
the plugin looks decent enough so I might eventually look into fixing it if they won't do it, but I have a bunch on my plate already and probably won't get it done in your time frame
Ah... rip thanks anyways @wraith rapids
how can I do /msg <username> <text> via bot discord?)
Hey! Quick question: I found a website on the internet that offers a written tutorial. It says that I should change some properties. Unfortunately, I don't know what is meant by most of them or how I can do that. Can any of you help me with this? Thanks in advance (picture attached)
Use JDA, Javacord or Discord4J to setup a bot inside of your plugin. When you send that the bot can simply run the command in game using Bukkit#dispatchCommand
and if the player is offline who writes?
What are you trying to do
Well you're going to have to handle that someway...
Like an error message or smth
is there an Event or smt that gets called when a player successfully sends a command (in this case when a OP ban's a player.)
CommandPreProcessEvent seems to not be working, as the Event gets called even if the Command doesn't work (wrong args, etc.).
uh I don't think there is
I would like to be able to make a database to use in my spigot plugins. However, I haven't found any helpful videos on Youtube about databases in Spigot, so I wanted to have a look at JDBC without Spigot. Unfortunately, I haven't found any helpful tutorials about that either. (Unfortunately, English is not my native language, so I usually don't get along with English tutorials that try to teach me something).
seems like also the PlayerCommandSendEvent gets called only when a list of commands is sent to him? (pretty weird to me)
so... how would i get when a player bans another player?
unless there is a player ban event in bukkit or in the plugin responsible for banning, probably quite infeasible
looks like there isnt
for a player that is online it may be vaguely possible even if there isn't through excessive hacks but for an offline player, you're fucked
well i basically want to send a message to my discord, when a player get's banned
override the ban command
check the banlist every now and then i suppose, but that won't let you know who fired the command
A hacky way would be to once post startup, loop through every command in the commandmap and then set a wrapper CommandExecutor for every PluginCommand.
well
maybe i could just read the latest.log for the ban message, and if there is one, run the code
bit hacky, but well
Try to make your own ban command and add the discord bot code in there
suppose you could make conclure's suggestion slightly less obnoxious by pulling the list of commands to wrap from a config
so you don't wrap literally every fucking command on the server
lmao ye
that said I'm not sure if you can wrap the vanilla commands
dunno
maybe some insane unsafe and reflection fucketry could accomplish that
DiscordSRV alerts.yml
Hey guys, how would i go about adding potion effects to the mobs from this foreach?``` if(player.getItemInHand() == horn){
if(event.getAction() == Action.LEFT_CLICK_AIR || event.getAction() == Action.RIGHT_CLICK_AIR){
for (Entity e : player.getNearbyEntities(50,50,50)){
if (e.getType() == EntityType.PIG || e.getType() == EntityType.COW){
}
}
}
}
}
}```
addEffect
i mean, i readed the logfile before too to send the console-output to my discord
so probably this could work too
or something, i don't know; check the javadocs
if (e instanceof LivingEntity entityLiving) {
entityLiving.addPotionEffect(new PotionEffect(...));
}
inside that loop
alright thank you so much!
Is there a class that stores player data?
Just make a ban command easiest solution
And sending the msg to discord is easy as well
but what if I want to use my hyper advanced ban management plugin instead
Variable data such as strings and ints
persistent data container
Okay, thanks.
?pdc
gotta use those bot commands
Lmao
didn't use to be the case, I don't think
maybe you are just special
i've never used any before but I remember some unverified guy failing to use them before
several, actually
Idk
yep they never worked for unverified
I'm tryna make some contributions to Spigot via pull requests - of course
I'm fairly inexperienced with version control though. I already pushed my commits with the wrong author info because I didn't know better to config my git before hand, lol. How can I fix it?
I don’t
U*
Once you have committed that’s pretty much it. Idrk a way of clawing it back
md wants me to fix it ¯_(ツ)_/¯
It is pushed
if it is only one commit, you can amend your last commit to change the author easily
git commit --amend --author="Author Name <email@address.com>"
after that you will have to force push
delete everything and start over
a rather radical approach I must say
rebuild PC
welp, time to get restarting
I have two commits with the wrong details 🥲
Oh no
real men push everything in a single commit
real men ctrl+c/ctrl+v their project folder
live in the moment
there is neither past nor future
the only code that exists is the code that exists now
https://stackoverflow.com/a/25815116 looks like it might work for you
this is more of a maven thing, but how do I authenticate with a server for pushing artifacts? keeps 401ing and i cant find any wisdom on how to
figured it out
settings.xml
What is a good way to store plugin data, not player data ? and is there a built in class for that?
What do you need to store
a short list of string containing some values
the issue with the vehicles plugin is that velocity.normalize().multiply(velDir); turns 0,0,0 into NaN,NaN,NaN
Yaml I guess
Ok
thats what i actually doing now lol
and yeah ik how jda works, but that was just to indicate what i wanna do
lol why
probably something to do with the normalizing
You can use something simple like Unirest
is there any function for executing a command block? i've made a hacky one that creates a redstone block adjacent to it for a split second and then removes it, but i'm wondering if there's a better way since i'd also need selectors like @p to work and besides, it's hacky (i couldn't find any function in the javadoc)
or should i just get the command from the command block and run it seperately without ever executing the command block at all
(i'm trying to make a plugin that allows you to create commands and make them execute command blocks)
we no strangers to love
you know the rules and so do i
new commitments it what we looking for
i forgot the lyrics.... my guy
now say goodbye :)
Bukkit has methods for executing commands. See Bukkit#dispatchCommand (iirc)
ah thanks, i thought there would be a method for executing command blocks in particular but that'll do
(tbf there isn't much difference between executing a cmd block and executing the cmd in it)
how to detect paypal donation and do a custom event ???
BlockCommandSender 😄
With that method you can set the sender as a command block
what would be the difference between having the sender be the console and having it be a command block?
How I can get a players head thar updating like top kills head or something like that
is it bc i gave my commands permission nodes in the plugin.yml that now only OPs can accesss them
Use SkullMeta to set the skins of heads
how can i make like the commands avaliable to non-OPS
Yeah... now you need the permission
Yes but how I can Update it whats most effective
so can i give the perm to like everyone
And if I Place the head can I use skullmeta?
Use a permissions plugin...
cache itemstacks with skull textures I think (like if u wanna reuse them)
this should fix the finite shit issue
is that the only way?
now pay me 10 bucks and i'll pr the 3 line change to the repo
like ppl who use my plugins might not known permission plugins
you don't need a permission plugin to use permissions
here hands NNY 10 bucks and gets arresting for child labor
enforce them to learn permission plugins or at least permission management of some sort
XDDDDDDDDDDD
set the permission to default to ops only
then i get less views
nice idea
views?
i suppose i'll remove the nodes
and then if someone has an issue with it, they can modify it with permissions.yml
on the plugin
and if they need to modify it furhter, they get a perms plugin
Not really
that are like going to bug me with it forever
literally everyone uses a permissions plugin
I mean sure some plugin reviewers are dumb
that is very not true
Just make one there easy
practically every production server uses one, most of them luckperms
trueeeeee
But permission plugins is a common knowledge field nowadays
Any good server has a ranks system
the only servers that don't use one are like 1 or 2 player private servers who don't know what they're doing
which are probably not your target audience to begin with
apologies for the ping, but would there be any way to somehow pass a player to that function so that @p refers to the player who ran the command?
(i'm trying to make a plugin that allows you to create commands and make them execute command blocks)
(nvm this probably isn't the best way but i could just replace @p with the player name)
any server with any degree of differentiation between players' permission levels requires a permission plugin
which means any server that has any kind of in-game staff uses a permission plugin
I like they way you worded it
i'm a pretty wordy guy
Hello !
I have a little question:
What's the difference between "==" and ".equals()" ?
For example, if I want to compare two inventories, which one should I use and why ?
Ty 🙂 ♥
use google
equals compare content, == compare identity
Uuh memory address
literally type "java what is the difference between == and equals" into google and you get far more and far better answers than you'll get here
if instance a is b then a == b is true
this will likely always be true for .equals() but it can compare content also
we're not a java 101 explanation dispenser
from geeksforgeeks.org:
The main difference between the .equals() method and == operator is that one is a method and the other is the operator.
We can use == operators for reference comparison (address comparison) and .equals() method for content comparison. In simple words, == checks if both objects point to the same memory location whereas .equals() evaluates to the comparison of values in the objects.
basically what conclure said
for instance
String a = "a";
String b = "a";
a.equals(b) will b true although a is not b, however the equals method is overridden such that it checks crucial state between two objects.
You could at least read all the message.
I know what you are saying but I don't know how to put it into practice and that's why I gave an example...
Yet most of this chat is basic java questions
use either
AyUniz both works
it doesn't matter
afaik any CraftInventory does not override Object#equals
Mh 🤔
So If I create a new inventory identical to the inventory where a player clicks and compare them, both inventories have the same memory adress ?
uh no
has to be the same place in memory
so it would have to be an inventory shared to 2 users
So == isn't usable ?
Well, in the first place you should ask yourself, what do you consider as 2 inventories being equal or the same?
Mh ...
Maybe two inventories with the same owner, the same name and the same content ? 🤔
prob wanna setup a custom equals method then
^
how much of the api even has a proper equals setup
most stuff which needs it
wherever necessary pretty much
nice
I see I see ...
So in case I am using a custom inventory created by myself, I can use both == and equals as they will reread to the same memory address.
In case I want to compare two inventories including one that I clone by myself, I have to check them one by one 😮
uh yeah, Idk why bukkit doesn't have like a getUniqueId method for inventories
or like
some sort of id to keep track of them
uuid might be a bad idea actually, not really persistent
Well thank you ^-^'
i'm not sure how that'd work
Just with UUID::randomUuid() and then expose a getter I guess
or maybe namespaced ones 🤷
it'd have to be stored and persisted on the nms inventory
as the api frequently pulls new craftinventories to wrap nms inventories for blocks and shit
as long as bukkit enforces the contract that it never wraps or loses the identity of an inventory created with Bukkit.createInventory, i think the existing system is fine
yeah, I go with the holder way still lol
its so weird that the Entity Death Event dont have .getKiller
the killer is on the entity itself
Sorry for posting in dev
But it seems most appropriate for opinions (as #general ) is weird
e.getEntity.getKiller?
it works?
yes
The people over in paper really hate md_5, wonder what the opinions on that were here?
according to a forum post it didn't work
Try it
hes fine
rumors say spigot is worse then paper bc theres only like one dev
and he did some bad things supposedly
@wild inlet I mean what he said is very subjective, was that written in this discord?
Apparently everything base spigot does is terrible
No, in paper
Then I can't do anything about it
Somehow every discussion goes back to how shit spigot is and how md_5 hates progress
And I wanted an opposing view
As it seems unhealthy to be exposed to just one side
Things like Spigot not using adventure etc
i cant ping Mr MD
I mean bungee chat works fine
I mean his code is fine
isn't pretty much every mc server software thing a fork of another?
ex: paper is a fork of spigot which is a fork of bukkit which is a fork of craftbukkit which is a fork of vanilla(i think)
but well they have their opinion
But it is just that he makes some mistakes when it comes to how he implements stuff imo which would be solved if you had more than one person working on it
Idk I'd be interested in hearing some back and forth between the staff, paper seems quite arrogant atm
ahhhhhhhhh
And I don't really want the communities to diverge so much that compatibility is gone
We're not interested in any unnecessary drama whatsoever. Let their opinions stay in the paper discord, it's just better that way.
Sounds about right, seems like more communication could be productive for both sides
people want them to diverge so much that compatibility is gone
because compatibility is the thing holding paper back
hard fork hard fork hard fork hard fork
did paper remove final from the fields on the packets?
im pretty sure they did i heard someone say that
and like protocolLib works on it
check patches
to lazy
Someone know how I can create a folder that could be access through the plugin folder in the server files?
yeah
how
File class?
Files.createDirectory(Plugin#getDataFolder#toPath#resolve(dirName))
and that would save that and I can access it from the plugin folder?
sure
paths 
this vehicle plugin is cancer
why is it that every time i look at something it needs to be rewritten
that thing u're coding for supa or some guy who asked here?
essence of being pedantic and perfection maybe lol
alright yeah fuck this, rewrite
rewrite everything
this is illegible, imperformant, ass to extend and buggy as shit
🥲
Lol you just described 90 percent of plugins on the website
man stop pinging
ok thanks!
?kick @finite rampart trolling
Done. That felt good.
?kick @granite stirrup trolling
Done. That felt good.
Okay then
Anyway, how can I use println with color(s)?
Yaron, turn off pings when replying thanks
alright
Oh, is it just ChatColor?
lol
idk how thats called trolling but ok
sorry
(sorry I just got pissed off cuz I literally wrote one message above or something
@ivory sleet how good do you think you are at coding 0-10?
:l
idkidk I will warn you once again
kk but its a important question
How to get Banned 101
im curious how good he thinks of him self
4
lol
Me
ok
o k
huh
custom enchants
is the plugin shit? i need a not shit custom enchants plugin
mmm
You drop the item you want to put the enchant on, along with the core (book) you have to craft
Then it removes the core and adds the enchant
mmmm
telekinesis huh?
cool
how does it work
you use an item to move a block
No, like the Hypixel skyblock enchant
oh i never played it
Automatically puts the block you break into your inventory
cuz it updates like sooo freqeuntly
im better off doing vanilla survival
and my own unity games
waaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
you got hired?
by hypickle?
capitalist swine
its working
No, with the stuff they sell for it it's obv a money grab
do you mean a job
kek
bruh
real life money?
it's an expression for a move or action made exclusively for the sake of making profit
i dont understnad skyblock stuff
on hypickle's side?
Yeah, they sell the gems or whatever
trueeee
yes, pertaining to the enchants and obtaining them in particular
It's not PvP so it's not against the EULA for them to sell in-game currency like the gems
Yep
like streamer's donations
Or are Hypixel simps
ahhh
indeed
my new plugin :>
Vampire Plugin :>
DEUS VULT
nani gulei
he has a holy cross item in the plugin
oh nvm
lol
which is an instrument of a CRUSADE
its something vampire related
against the INFIDELS
and the UNBELIEVERS
これは何ですか
everybody cries about the holocaust but forgets the crusades
NNYあなたは本当に何歳ですか
which is very sad, because imo, each piece of history should be remembered
and by some, celebrated
what the fuck do you want you squiggly ass fuck
I do need to look through my older code in that because that's when I was newer to Java and didn't realize some things would run better than others
are you calling World.getEntities in the player move event
because one custom enchants plugin did that
another one cloned every itemstack in a player's inventory several times in the move event
I don't even have a player move event
What
I don't use textcomponent
would using HashMaps for a player queue system be adequate ?
mye
how come
Just dont
using player objects is fine, but you must make sure that they are disposed of when the player disconnects
generally it is preferable to use something easier like the player's UUID
ah ok
right not im struggling with thinking of a way to have a new map created everytime the queue reaches the cap
anyways if u gonna use player as key, use an IdentityHashMap or (MapMaker if multithreading with it)
more like WeakHashMap
Nny how old are you like fr cuz I'm actually kinda curious
if some shitty plugin keeps the invalid player instance then it wont get cleared in your weak hash map which is the only downside
myeah but that's not your fault anymore
uh
is there a way to rotate a vector by an euler angle
like, built-in
right now i'm just brute forcing it with a bunch of rotateAroundAxis calls
uh I don't think
how do I use the sidebar to display information?
scoreboard?
uhh why
the forum told me to do that
is it bad?
also why is my main null
code
Main main = Main.getInstance();
this line is located on top of the Mana class
and
static public Main getInstance(){
return instance;
}```
instance=this;
public static Main instance;
Cuz I don't use it lmao
lmao
i've used them a bit in the past but only in the vanilla way of listing entry-> number and idk how to use that to do what I need to do
spoonfeeding is looked down upon
--- nny
k
?spoon
Spoonfeed a newbie for a day and they'll come back with more questions. Teach them to find their own answers and you'll both be better off: you won't get stuck answering the easy questions and they'll be much more productive than before.
I didn't realize that one servers that use it they just number each line, I thought there was some fancy way to display strings
so for a plugin I'm working on, I want to modify the enchantment table to give custom items, everything works fine except that the enchants are always the same because I'm cancelling the event. I looked into using NMS to reroll the enchantments which worked for 1.16 but then 1.17 changes NMS and I would rather not have to use it. is this possible with the bukkit api somehow or would NMS be the only way?
Prolly nms
onEnchantEvent?
what about it?
thats not the problem
maybe theres an event for it
in bukkit api
declaration: package: org.bukkit.event.enchantment, class: EnchantItemEvent
again thats not the problem
except that the enchants are always the same because I'm cancelling the event.
throw some reflection at it
how can i detect paypal donation???? and do event if i got like 5$????
so I just made a simple plugin that is supposed to spawn a cat, but the server seems to ignore it
no folder for the plugin was created and its not listed in the /plugins command
so naturally its only command isnt recognized either
check the logs
I have
Okay so I have a question. From my perspective I seem to do everything right with this event, but it seems like it doesn't trigger despite my efforts.
My code (I left the imports out but I got all imports):
public class Main extends JavaPlugin implements Listener{
@EventHandler(priority=EventPriority.HIGH)
public void onPlayerJoin(PlayerJoinEvent event){
Player player = event.getPlayer();
Bukkit.getServer().getLogger().info(player.getDisplayName() + "join server");
player.sendMessage("This is a test! :P");
System.out.println("A player joined the server!");
My expected result: The event gets triggered when I join my locally hosted server and I see a message in console and in game.
Actual result: Nothing happens...but the plugin is enabled and can be seen in /plugins
Did you register the listener?
No? I'm not so sure what you mean
?eventapi
The problem I'm having right now is that my listener is in my main class. And if I register it wants to initialise itself. This is basically my code rn
public class Main extends JavaPlugin implements Listener{
@Override
public void onEnable() {
getServer().getPluginManager().registerEvents(new Main(), this);
System.out.println("Live notifications is online and enabled!");
}
@EventHandler(priority=EventPriority.HIGH)
public void onPlayerJoin(PlayerJoinEvent event){
Player player = event.getPlayer();
Bukkit.getServer().getLogger().info(player.getDisplayName() + "join server");
player.sendMessage("This is a test! :P");
System.out.println("A player joined the server!");
ahh alright
Events should be in their own class as it keeps the code cleaner., and second it's generally a bad idea to call your main plugin class "Main"
Anyways new Main() wouldn’t even work
Yea that's why I said it will initialise itself, but I didn't know you could just do this
anyone uses vscode and know of a working ruby extension >:I
Is there a way to remove the spawn requirements of spawners?
not really
not easily
What is a good way of adding a "cool down" to a command. Example: I have a /home command, and once its ran, I want there to be a 3 second wait before they can teleport. I sort of have an idea of how to do it, but thought I'd ask to see if anyone had ideas 🙂
that's a warmup
a cooldown would be that you could not use the command again until after 3 seconds
Ah yes, that then 😛
Is there a way I can delete a players placed chests + all items on death event? Currently using db to store all info on it, Just got no clue where to start on that.
iterate over the block locations, load the chunks, and delete the chests
ideally using paper's async chunk loading api as the server will fucking die if you try to load too many chunks at the same time synchronously
I'll just store chest loc when placed into db load it's chunk and delete it. Thanks for the idea!
How would I go on about creating multiple borders at a specified location?
use a bukkit runnable to wait 3 seconds
also listen to the PlayerMoveEvent and if they move then you can cancel the runnable
I'm looking to use NMS in one of my projects, how do I access it?
I added the spigot server jar as a library in my project but i'm not seeing the net.minecraft.server.<version> packages
is there a way to store a string with a color code because when I tried it turns into this:
º7??????????
encode the file in utf8
i want to make a plugin for 1.7.10 is there a spigot download for the correct version
i'm just storing it in a field not a file and it's doing that
can it not be a String
is there another object I should use?
you're mangling it with the wrong encoding somewhere
Heyyyy Skull Head
Is it possible to use hex color in an inventory? Such as item display name, lore and inventory title.
my ide says it's in UTF-8
and I screwed around with it for a bit
also earlier the unicode charecter □ was working fine
fixed it
Any recommendations for good ways to test multiplayer plugins during development short of constantly pestering my friends?
Is there an easy way to check if a string is only letters a-z?
bump
someString.matches("[a-zA-Z]+")
ty
Y null
How would I also include numbers 0-9?
You access it using Main.getInstance()
I'm guessing because you put Main main = Main.getInstance() on the field.
Add a 0-9 in the square brackets
Thank you sir
where did you put this?
Np. The matches method uses a thing called regular expressions. If you look into them a bit more you can use it to verify just about any input format you could imagine
and how will you be able to make a non-static reference from a static method?
thats what i did
uhhh sooooo
static Main main
= Main.getInstance
Just show your main class and the class that you're trying to access the Main class.
oh ok seems like i misunderstood your comment, yea just show the class
the class Mana
yup then that's the problem
There you go, you declare the main in the fields, while the instance hasn't been initialized yet on the Main class.
Mana mana = new Mana(); also that line
Just make it local variable and you're good.
oh okay
use DI
thx
static getters run into this issue more often than you'd think
dependency injection... oh so thats a getter
using static getters in static initializers is especially haram
i thought that was di
as that makes your plugin sensitive to the order in which its classes are loaded
which is never good
for example, even if the order of code in your main class was correct, and the Mana instance were to be created after your static instance field is assigned
haram yeah xd
if someone were to cause, for any reason, the Mana class to be initialized, your plugin would explode
as during the initialization of the class itself, the main = Main.getInstance() is called
and now your Main main is null, because Mana was initialized before Main
it's unstable to the point where if anyone literally looks at your classes in the wrong order, it explodes
so keep in mind that the field is called way before onEnable is called.
o
bc onEnable is a method?
I would agree that dependency injection is the safest, and also getter is more of a real-time usage
no, because of how java works
okay
it being a method is part of it, but it's more complicated than that
the issue with static initializers is that they only run once; and you have zero control of when they actually run
any static initializer that depends on any static state anywhere else is bound to explode sooner or later
it get more complicated when you have anonymous class based on a soft-dependency, absolute pain in the ass
Should I make my own yml file for a config or use config.yml?
latter for convenience sake
if you do not already have it
but most widely known conception of config.yml is something that the user can edit or use to modify certain settings
if it is something that you do not want the user to change, prob safer doing it the former way
either is fine
base stuff should def go in config.yml first
then you can split up the configs if its some huge parts
custom ymls are slightly harder
but you'll have to learn it sooner of later
I was thinking of having one for messages
yeah that makes sense to do
I have done it before Supa
a localization file is a good thing to split off from the main config
if it is for messages, you can have languages yaml files for extendibility
as that allows a community to source and exchange localizations without touching the actual functionality itself
languages for what
your messages
Do i look like a translator to you
no but, the user may be one
most 1.8 players come from poor third world countries
so yes, you should get to translating
lmao
nobody cares about the azns anyway
not necessarily you who would translate it, but a default language file is good to be provided as a template for other users to do so, or even better, contribute
^
ah
point is that users can create and share localizations without it interfering with their actual configuration
just grab and swap a file
Yup. The best way to handle it is almost always add easy, modular support for it and let someone else do the translation
Are you offering to do the translation?
No
The only other languages I know are broken German and some French
TOTALEN KRIEG
I'll translate into c++
Or cuda lol
This is how it's done. Cuda accelerated servers
does jshell qualify as an mce
Does any of you have a clue on how to use sub-modules in Maven project?
I'm trying to access a method in the module, my goal is to get a list of region from a location using WG6 and WG7
How can i add a space between each value in a yml yfile?
yes
this might sound stupid, but try config.set("\n<value>", variable);
i dont have anything open so idk if it will work
but doesnt hurt to try
if (event.getItem().equals(star))
i keep getting
java.lang.NullPointerException: Cannot invoke "org.bukkit.inventory.ItemStack.equals(Object)" because the return value of "org.bukkit.event.player.PlayerInteractEvent.getItem()" is null
show whole function
It only returns null if i look at a block while doing this, as a result of this line
if (event.getAction() == Action.RIGHT_CLICK_AIR || event.getAction() == Action.RIGHT_CLICK_BLOCK)
right above it
alright
PlayerInteractEvent.getItem()" is null
@EventHandler
public void onClick(PlayerInteractEvent event) {
PotionEffect invisible = new PotionEffect(PotionEffectType.INVISIBILITY, Integer.MAX_VALUE, 1);
if (event.getAction() == Action.RIGHT_CLICK_AIR || event.getAction() == Action.RIGHT_CLICK_BLOCK) {
if (event.getItem().equals(star)) {
PotionEffect player_effect = event.getPlayer().getPotionEffect(PotionEffectType.INVISIBILITY);
if (player_effect == null) {
invisible.apply(event.getPlayer());
} else {
event.getPlayer().removePotionEffect(PotionEffectType.INVISIBILITY);
}
}
but im holding the item in my hand
and it works fine
but i just get error in console
no clue why
oh
thank you
Which slot type would a players offhand be?
I would use the slot number but im not sure if its considered an armor slot (which I dont know if they have slot numbers)
So, I'm trying to make chainmail armour as same as leather
I need to change the Protection attribute, I tried some Google but couldn't find any useful information..
Does this help you? https://hub.spigotmc.org/javadocs/bukkit/org/bukkit/inventory/PlayerInventory.html#getItemInOffHand()
declaration: package: org.bukkit.inventory, interface: PlayerInventory
not particularly
thank you though, I need to check whether a player puts an item into their offhand within the inventory GUI
figured it out, thanks
Hey, so I'm trying to re-create the LuckPerms command auto tab completion (basically adaptive tab completion) but I'm not sure how to do it properly. My command is still showing up red even though I have it set in the plugin.yml and SetExectutor/SetTabCompleter in the onEnable() method. Here is what I have
Here is an example of the LuckPerms tab completion if you are not familiar with it
is there an event to monitor a player changing whats in their main hand, by action of the scroll wheel or numbers?
PlayerChangedMainHandEvent doesnt seem to work
I believe that event is actually for switching hands. Like from main hand to the offhand. Try PlayerItemHeldEvent
thanks, Ill give it a shot
You're welcome
Don't use the new CommandManager() twice. You only need to do that once.
Basically they are different instance/object so it won't work.
Wdym? Like only use this.getCommand("enhancedrules").setExecutor(new CommandManager()); and remove this.getCommand("enhancedrules").setTabCompleter(new CommandManager());?
No. Like this, by doing something like this you're referencing to the same CommandManager object and it will register properly.
CommandManager commandManager = new CommandManager();
...setExecutor(commandManager)
...setTabCompleter(commandManager)
Ohh, I see what you're saying. I was creating 2 separate instances instead of giving it a variable and referencing it
Something like that, so you're only registering the executor for the first instance (without the tabcompleter) and you're only registering the tab completer on the second instance (without the executor).
Are you sure you have registered it in the plugin.yml?
Yeah, because it shows up if i do /? enhancedrules and auto tabs for that section for some reason
oh wait jk
one sec
wait, yeah, there it goes
But not when I do /enhancedrules by itself
Okay, I think the problem is in your tab completer, the command registered successfully.
This is how I set the tab completer
parseTabCompleter(...){
if(args.length == 1){
return Collections.singletonList("spawn");
}
if(args.length == 2 && args[0].equalsIgnoreCase("spawn")){
return Arrays.asList("set", "remove");
}
}
you didn't specify and tab completer if the args length is 1
try to use /enhancedrules spawn and you will see the suggestion (set, remove) on the args[1] (on your current code)
welp, just do something like this i guess
anyways i have to go, have an appoinment with my doctor
Alright, thanks for your help
How to make custom permission message for all plugins on the server?
You could check whenever a player runs a command if they don't have the permission and then override or cancel the plugin's default message
how to write this?
No, I used TabExecutor which does that automatically
@tired dagger is it solved yet?
No
Have you tried to use this?
Basically you need to put suggestion each args.
No need to check command.getName
Create a class that implements Listener and uses PlayerCommandPreprocessEvent then check the player's perms and cancel the handlers or override the message
1 sec
Didn't work
I don't think its detecting the TabComplete method because I just tried this and got no output
You return null
I did in that case but it didn't send any messages in chat leading me to believe that code wasn't executed
Idk I can only tell what’s going on inside that method
But ftr you need to set the completer with PluginCommand::setCompleter or if it was setTabCompleter
Uh not that but I hope you realized, you’re still returning null
Is it differemt on how you register it?
Between TabExecutor and CommandExecutor, TabCompleter
convenience, i see
Yeah
but it's doesn't that necessary imo
I wish that spigot had some control client side smh
I know but that's irrelevant at this point bc the code before it is not executing anyway
For some reason
I think
Then we would need a spigot api mod and that’d be its own hell to make
Because you need to set the completer
Just like with setExecutor you need to invoke setCompleter
Yeah - but like I wish that It would auto load to the client… I know security and all would never allow this and that is good. But it would be nice
I did
Yeah well I guess if there was more packets which would allow further manipulation of client sided things could be nice but it’s prone to some shit things which could also happen
Try in different classes
Yeah - I mean why would mojang add stuff like that cause they don’t have a use for it. It’s just wasted time on their end. But still 🤷♂️
Why not
Shit like Player#setViewDistance
Not really the same thing
Well- that’s what I meant
Maybe a settings packet
So you could send it to the client with specific settings
Thing is the view distance is enforceable
But that definitely wouldn’t get thru security very fast 😂
The thing I want out of anything else is a custom sound packet. So that you could just send a stream of the packets to all players and bang - music
Does the class implement TabCompleter
^
I used TabExecutor
Noooooo
?
It’s video only
TabCompleter
It has sound
Not executor
Tab Executor implements both
I’ll give it a look then, iirc that’s pulsebeats
I mean, i'll take it out and try it but I don't think that's the issue
Nope.
Idk Trent Menard, it looks weird as for our side it should work. It’s an issue from your side guaranteed.
@ivory sleet you worked on this didn’t u? Can u verify it has sound?
No I can’t but I am quite certain
Hmm, maybe a 1.17 bug?
Np that’s really cool - I thought that pulse just added the sound in post… 😂
Nope
Possibly
Yeah same
Just use acf makes life simpler
I never have problem with tab completer in 1.17
And I was using it yesterday
What's that?
I use brig or cloud lol
I don't like redempts cause his Lib isn't modular
Well. Up until this point I just use the vanilla one
If you use any Lib you have to use like everything
Oh right
Yeah he doesn't have it moduled out
But I think that solves the issue
Last time I checked
I should probably make my library componentially decoupled
What’s in your lib
Uh, more performant event handles, task coordinators, block fillers and plugin message events
Nothing remarkable
😌
Hai
Yuh
That takes 2 seconds to do but sure lol
It’s another feature
And if I need it I don’t wanna have to think
So anyone know protocollib
Cause I feel like I am using it wrong
Mye used it once
I use packetevents
Or do you literally have to go the the wiki and work out what fields there are
But it’s unstable still
Huh
Oh lmao
I could explode that out into a Lib considering I made one in hac
Link? The only one I found was 7 yrs last commit
Haha yes
Why event doesn't fire?
I have registered it like every other event: new BlockExplodeListener(this);
It doesn't show any message when I explode some blocks with TNT.
what is difference between BlockExplodeEvent and EntityExplodeEvent?
how to give player invisibility effect?
Block explosion vs entity explosion, like creepers or primed tnts as opposed to blocks like beds in the nether
Ye lol
hahah strange
help?
LivingEntity#addPotionEffect
like just the potion or ...
okay so I need to use Block break, Entity explosion and Block Explosion events to prevent specific sign from breaking?
is there any other event I need to use?
@shy wolf what the event.. What you trying to do
new PotionEffect(potion, duration, level)
I just want to prevent specific block (sign) to be destroyed
now I use break block, entity explosion and block explosion events.
is any other even that I need to use to prevent block to be destroyed
Like can it be destroyed somehow else?
np
nah, the moment it starts flashing, the block is removed and the entitiy TNT is spawned
wait what block explodes other then tnt
Bed
hmm yeh
even tnt isn't block
Respawn anchor
ender crystals are entities pretty sure
it's entity
anchor too new for my brain
🥲
I didn't really play the nether update and the gang waiting for 1.18 now so rip
anyone know what i am doing wrong - i have the jitpack repo
Set version to master
Are you sure
yep
reload maven
Ye only other thing I can think of
you can use maven browser
<dependency>
<groupId>com.github.pulsebeat02</groupId>
<artifactId>minecraftmedialibrary</artifactId>
<version>master-SNAPSHOT</version>
</dependency>
It has NMS so jitpack don't support that
that's from mml's github
someone converted it to gradle as well 
Myeah
Yeah
oh shit
https://jitpack.io/#MinecraftMediaLibrary/MinecraftMediaLibrary
can i take an old version
We have mappings 🙂
and i haven't mappings
this one works apparently
<dependency>
<groupId>com.github.MinecraftMediaLibrary</groupId>
<artifactId>MinecraftMediaLibrary</artifactId>
<version>-8d6a801b9c-1</version>
</dependency>
I hate jitpack so much
nah its good
all is evil
Could not find artifact com.github.MinecraftMediaLibrary:MinecraftMediaLibrary:pom:-8d6a801b9c-1 in jitpack.io (https://jitpack.io)

no minecraft media library for you