#help-development
1 messages · Page 2144 of 1
real ones code plugins directly in bytecode
yeah
Remove ANY new DiscordServerPanel metions
thats your issue
?PASTE
you're making a new instance of your plugin
?paste
🤦♂️
Through the new keyword
I realized I was doing that to register the event listener
HMN
Send full code, and also why using EvenListener?
Isnt only called Listener?
🤔
it's for jda
pass an instance of your plugin instead of extending the class
yeah
self vaccination
only way to check if a player steps on a pressure plate is interactevent?
xD
No i dont think it can work
it can
You will have to harcode a lot
anybody here use jda in their plugins?
check for the block they're under
Send code lmao
If not its impossible to help...
even though it's being called in the ready event
Dont send fu¨¨¨screenshoit
would you rather me not send the error
but it's being called in the ready event
which should be triggered when the bot is ready
1 sec im opening the error
Now send your main class code and the bot code
So i can check the full code
DiscordServerPanel.java:82
DiscordServerPanel.java that class
main class
https://paste.md-5.net/maduzedopa.java
bot class
https://paste.md-5.net/utemocomor.java
you never assign jda to a value
I do
Yeah
NO
how so?
You dont assign like that on java
yes
and that is called in the ReadyEvent
which should be triggered after the bot is ready from the awaitReady() method being called in my bot class
you do
Do this changes so its better your Bot class:
Bot bot = new Bot(DiscordServerPanel plugin)
its just not a good practice
Nothin i was wrong my bad
.
I think you have a nightmare in code
looks fine to me
I understand that I'm getting the instance a ton and I'll probably pass it through when I create a new Bot object, but how will that solve the error
You should have this order:
DiscordServerPanel class => Plugin things
Bot class => JDA related thin
BotListener class => for JDA listeners
Because eyes hurts a bit with that structure
Its just a recomedantion
the whole plugin is about a discord bot
the stuff in the main class is for organizing the startup code
You have already said, so listeners shoudlnt be there!
the listener is only there because it only applies to one method that goes along to startup the bot
Do what ever you want but them dont get mad if people dont understand some part of your code
😂
I don't understand how it's confusing 😩
https://paste.md-5.net/sayusuyoxi.java
Hey! Does someone know why this is sending messages twice?
?paste lease
grabbelton dutch aaaa
Yes im dutch xD
you still have to learn the api
my error was never resolved 😩
Oh lol really?
Can someone help?
PATIENT
How can i fix that?
If you dont get answer just be patient and if dont want to your message get losted open a thread on the channel
Have you learn the api before coding?
you never check for the hand
its called once per hand
casting a player to a player?
instead of (Integer) config.get() -> config.getInt()
do early return in case something doesnt met your conditions
use dependency injection for the plugin instance```
voila
I dont know im anoyyed
does he?
Oooww thank you!
lmao
You have 2 hands:
Left => the for the thing that protect you from arrow
Right => the common one
In fact yeah
Conclure use maven right?
i think i saw conclure using gradle
maven>
gradle ?!😱
dunno lol
csgo > maven && gradle
i only use cargo for rust
imagine using a buildtool
Most spigot use spigot build tool lmao
lol cargo 😂
That why most people directly use spigot jars from internet
😂
Yeah didnt you know that 40% of people download directly the spígot server for their servers
The correct way should be use build tools to get the spigot server jar, but that take to much time for people. So they directly download the jar from a website
Cast block to chest error
Are you using Bungeecord api?
yep
Because PluginMessageListener is from Bungeecord api
i dont think pluginmessagelistener is a thing in bungee
theres a pluginmessageevent
Why the heck bungee component api apply color to the first line of message, and doesnt apply color to the rest of them. is it a bug?
Ah yeah
On spígot = its a listener called PluginMessageListener
On bungee = its an event called PluginMessageEvent
@desert tinsel my bad there you have the explanation
well ofc you cant import something from bukkit into a bungee plugin lol
Context please
.getInventory().getView()
also dont use inventory name for checking the type of an inventory 🙂
Please dont ping spoof the code, if not its really easy comming to ask all time
Things that are on the docs
And i agree with you
what do i use then
check the instance
Why the heck bungee component api apply color to the first line of message, and doesnt apply color to the rest of them. is it a bug?
^ @quaint mantle
maybe because legacy text is legacy 🤔
text components work fine last time I checked
Bungee doesnt compile i dont tell:
ProxyPlayer#sendMessage(TextComponent.fromLegacy(component))
🤡
this isnt just for a player
for anyone
to open through shop keeper
what do u use the map for if u remove them after
from thje map
ah alright
i usually make a small api that just has a craftinventorycustom wrapper that listens for clicks etc
So why you dont have something like spigot on bungee? Isnt the same the text api lmao
So how you send the components on bungee?
inventory.getView() isnt a thing btw
that too, tho I barely use it for in-code components
I only really use MM for user inputs
what does that give
the InventoryView
Are you sure you read the docs?
You do the same lmao hahaha
Dont use the title, compare the whole object
yes, but like i said you shouldnt really be using inventory names in the first place
alright
but why does it matter if i just keep recreatinmg them
what does spoofable mean
anyone can just rename a chest in an anvil or something
You should do:
event.getViewers().getTopInventory().equals(custom inventory)
that isnt valid
I use something similar on my menu api
getViewers() returns a list of humanentities
Or getViews() its called?
thats what im doing
ok, then you check if that inv is equal to the reference you have
if (!event.getView().getTopInventory().equals(menu.getInventory())) return;
That what i use
problem with this is that it wont work if the player clicks in their own inventory
so people could double click items out of the menu etc
But that will work if clicking on own inventory, my goal of menu api its working with custom menus not player inventory!
...
but you dont ever want that
i have literally been duping on a server for the past few hours just because they implemented something like that
and it broke their entire server
Hello, I have a gui that a player can modify but I need it to be player specific so that if a player changes it, it only changes from their own gui and not everyone's
Hmn mines works okay atm
Does that even make sense
let me guess
Lmao everyone has menu/gui issue today
you're only making one inventory instance
😂
and storing it in a static field
Yes I am
well then thats your problem
But I have an event that checks OpenInventoryEvent and checks the name of the inv
how would I change that
What do InventoryHolder i dont understand the reason because it literally contain a:
Inventory getInventory();
How ?
event.getInventory().equals(<inventory reference>)
Deotime have you orked with InventoryHolder? What does it
I'm confused on how that would work
I dont still understand
a lot of people use inventoryholder to find the type of the inventory even though thats not what its intended for
Inventory#getClass()
that's a thing
you really dont need to use it for anything, its was only intended to be used by mc but people kind of exploited it
is there any statistical reason to use a json library for file storage over yaml from spigot
like is it inherently faster
no
depends on your needs
if you also need to send it over the internet, then yeah
otherwise no
didnt exaclty do that
hexic dragon Id say its preference at most
yea, comparing the instance is still a better idea tho
but does it look better now
chestLocation.getBlock().setType(Material.CHEST);
Chest chest = (Chest) chestLocation.getBlock().getState();
Why does my cast to chest fail here?
Figuring out which class it is
so like
Patient please, you already opened a thread
and then you gotta remember "Given a JSON structure, it is also a YAML structure since JSON is a subset of YAML"
inv.getClass() == AnvilInventory.class
what
subset means yaml is inspired by json right?
yes
replying to this*
I always get that wrong
no ikevoodoo
So how you send component to ProxyPlayer? Because it doesn contain a way for sending them
how could i get front face of chest?
but it means that valid json must be valid yaml
how does that even begin working?!
json has a different syntax than yaml
only issue is this doesnt really hold up when you're trying to make a system for multiple inventories that have methods for on events
{
"num": 1
}
num: 1
well yeah, I don't know what context this is for
how do i compare inventory instances then ?
former is valid json
Rather Tomson its more similar over Json
what the actual tableflip
.equals(<inventory reference>)
^^^^^
´´´´´´
you can comapre items inside
Never, always compare full instance
i usually prefer json just because its not spacing-based and easier to serialize
btw replying to this, if you want speed and don't really care about user editing (such as plugin storage), you can use a DOS wrapped in a GZIPOS
bad idea
but what would the name of the inv be?
yeah ik its a bit weird but by definition thats the case
and yeah hexicdragon
most people choose yaml because thats the convention in spigot
you can put anything json as yaml?
like "inventory" + player.getExactUUID.ToString()"" ?
yup
I mean, if it has to be user readable
im really not sure what you mean
thats just a syntax error anyways
if it's just some storage for metadata that you need sticking with non-human readable format is good enough
byte format
yeah altho if you create a mock implementation then u probably dont want that
How do you send componenent to Bungee player them?? Because TextComponent.fromLegacyText(component) doesnt work. And ProxyPlayer also doesnt a have a method like ProxyPlayer#sendMessage(component)
public Inventory inv = Bukkit.createInventory(null, 54, "§6Kit Menu");
@Override
public boolean onCommand(CommandSender sender, Command cmd, String arg2, String[] arg3) {
if (sender instanceof Player) {
Player player = (Player) sender;
Inventory inventory = player.getInventory();
if(cmd.getName().equalsIgnoreCase("kit")) {
player.openInventory(inv);``` how would I implement it there the instance creation thing
side note
DataOutputStream os = new DataOutputStream(new GZipOutputStream(new FileOutputStream(file))); * Example, not what you'd actually do
does anyone know why this error is caused and how to fix it
im so confused why so many people check cmd.getName().equalsIgnoreCase(<command name>)
is there just like
?paste
one tutorial out there that does that and everyone just blindly follows it
its so pointless
yes
but... why?
explicit programming
first off, label
it allows you to check what alt you're using
such as /mycommand or /mycmd
second off, why? it does not get triggered globally
?
then how ?
I believe tuts do that because they think it gets triggered globally
if you register the command properly itll only get triggered when the command name is the same as the executor
yep
so checking the command name is pointless
yeah
yes it is
I dont know why people do that
well, if you want to run different stuff on alias, then you can do that ig
lol
ye
but then just make it a separate cmd
So in fact using a annotated command framework its 100% better than simple command
or rather than sending
/mycmd a
send
"/" + label + " a"
any cmd framework is better
I don't know why spigot still hangs onto this really shitty cmd implementation
I mean if you wanna reuse your gamemode cmd executor for all gamemode commands like gamemode <c|s|sp|a> and for stuff like gmc, gms, gmsp and gma
Yeah
How can I add a maven project as a dependency to another maven project?
I want the jar of the first one when its built to be a dependency of the other.
fair fair
but again
separate commands
yep
could argue that spigot does not include fully fletched frameworks as that may be left the community
You should install it on local repo or remote
Because im changing both all of the time
label is only useful for stuff like usage, so you can send the exact message
Just make their own
Its not that hard
Yea but why
~30mins of time
what do you exactly mean install local?
there is great frameworks out there, just use them
^
who can help me with this?
they have been unit tested, integration tested and havew a variety of features as opposed to your duct taped 30 min one
yeah install the one dependency you want to use in second project to the local maven repo or a remote maven repo
its pretty urgent
I use my own, but that's not the point, the point is why do I have to add dependencies and extra size to my plugin for something that could be the default
30mins is the basics, forgot to mention that
why do you depend on the serde crate in rust
In that way you get more ignored than helped
to make a good one you need weeks
why do you include your own http client
I don't, I don't use rust
why do you include your own mysql drivers
it is an abstraction or framework above the "low level" stuff
yeah sorry but im not lying
Anyone know which is the repo of the MaowHttp library?
Fair point
forcing a framework into spigot a) kills alternatives
But if need insta support pay someone
but the entire spigot api is a framework over the low level stuff if you look at it that way, commandexecutor just adds the Command in the args of the method
you could use packets
but then that's difficult
spigot is the lowest level abstraction you are getting
packets is not abstraction that is impl detail
I mean if none of the already opinionated cmd frameworks fir your expectations then perhaps make your own but it comes w a cost ofc lol
No, I meant
Lynx by any chance do you know my problem here?
you are coding against c libraries, not setting the registries values yourself
I think spigot should contains 2 clases for commands:
CommandExecutor
CommandArgument
I think spigot should add full support for brigadier
yeah the cmd map is already a good enough of a facade to serve as api
@sage merlin can you provide the inventory listener class
Why not just make the API slightly better? Like it is right now, but at least not have people write messy parsing code for each argument and also allow people that don't want to use external libs to not have to use them to write an understandable command class
the ban class thing is not where the exception happens
Can you please help me a bit? Im stressed because Bungeecord player api doesnt contain a method for sending text component to player
there is a library loader these days
it does
Brigadier is extremely messy imo
nah
choose your fav framework, add it as a lib and use it without having to shade it
Still requires time to download
brigadier is well engineered
then your server is fucked
?jd-bcc
(Freshly downloaded spigot server)
it validates the lib
?jd-bc
If i do: ProxyPlayer#sendMessage(<component here>) doesnt compile its so shity intellij
register(literal("cmdname").then(literal("subCommand")).then(literal("subOtherCommand"))) (missed some stuff, like actual execute code and args, but you get the point)
yes thats good tho
it exposed the true structure of the command
and then you just pass the command object itself
take the execute command
it has dozens of nodes
its just difficult to read with brigadier
Hmm it is almost like people have different taste in framework design
almost like forcing a single framework onto people is not a smart idea 🤔
I mean you should extract lines of commands into variables
This ain't about taste, its just that brigadier is harder to read than any other framework I've seen, hell the Paper component chat lib thingy is easier to read
adventure ?
How would that even work
idk about that tho
like
A framework should make your life easier, not a convoluted mess of chained function calls inside function calls ad infinitum
One for managing normal commands and the other for sub commands, like does faction plugin:
/faction => the command executor
/fact list => an argument
/faction create <name> => a sub command
mini message exists
would it be hard to make it so only the person who breaks the block can pick it up
literal("gamemode").then(
argument("type",string()).then(ctx -> {
var firstArgument = ctx.getArgument("type",String.class);
});
);
It's good that the provided way of doing commands is barebones, it makes it easy to create frameworks
ikevoodoo that imo looks way better than dynamically handling arguments yourself
Just add a tag to the item or something
"easy to read"
And cancel the pickup event if the wrong player tries to pick it up
huh
Listen for BlockDropItemEvent
Tag the items somehow
Either with a scoreboard tag
Or storing them in a map
Hey I have a minor problem. When you search my plugin name online and go to the spigot website option it redirects you to the wrong url, any way to fix it?
and if you want to you could extract a variable for literal, and the argument
I'd prefer using spigot's default over brigadier
Wait
which would increase readability significantly
It will be re-indexed at some point
Ok thanks
Why
but then how will I know who should pick it up
how could i display item as a hologram?
Making commands with no library is horrible
and the benefit w brigadier is that you also retain an api for arguments at runtime
Its not a mess of function calls
Could you be more specific
Ok so?
thus you also get tabcompleting capability
So i don't have to bleach my eyes after reading
I'd rather have a bunch of nested function calls defining the behavior than a ton of manual handling of arguments and stuff
^
i want to display specific item like a text on armorstand.
What do you mean like a text
you can extract function calls into explanatory variable and the send in the variable
I agree, but brigadier is still worse
in case you wanna avoid direct nesting
(not in functionality)
I really doubt it
Like sure it's verbose
idk how its worse
And I'm not really a fan of verbosity
hologram i guess
Again, only complaining about readability
not functionality
thats not an issue lol
for functionality I am 100% with it
Debug 200 lines of brigadier please
yeah thats easy
nah
Just have an armor stand holding an item and make it invisible
you place one ) wrong and your command is fucked
???
id only have to unit test my own functions that I provide by the ::handles function
the entire tree goes to shit
How the hell are you writing your functions lol
I write the ( and the ) at the same time, then just move back in between them to keep writing
in the brigadier tree
Do you try to manually keep count of how many you have to close or something?
there is no inventory listener class
Because I don't see any other way to really get that wrong
if you place a .literal after its a pain
i have event for breaking blocks and an event from picking up
Hell no
but idk how to set it so the person who broke it can pick ut
Ok nobody's forcing you to use brig
But if at some point you mistype it becomes pain
I know
But if you have a problem with it you can always make your own shallow wrapper to make it less verbose the way you want
Or you can use my library :)
yeah i never used the InventoryClickEvent
That's not that elegant
but its easier to read
Where that from?
not really clean at all
for brigadier levels it is
its cleaner brigadier
im tryin to figure out how i use acf lol
That's why I'm not a fan of builder style
Like yeah I'd do that over the standard spigot commands
But that would slow me down
Straightforward builders are better
Its possible to do something like this?
CommandExecutor = new Command().builder().name("bla").execute((sender, args) -> bla).build();
Dat is kt?
I know
Sure, that would be really easy
It would suck though
Askin
Like it's such a thin wrapper that it would barely help you at all
I know but i want to do it
Why
Just to test something
All that does is make one small part of the process slightly easier
Just slightly rearranges it, really
How its called that i sent?
ye im looking at that
Wrapper style?
Builder
figuring out how to make a /sethome command which only takes a name
So each time I add and rebuild, I have to put it in the local maven rep again?
Are you shopping around for libraries?
This is how i like to make commands:
public class MyCmd extends CustomCmd {
public MyCmd(Plugin plugin) {
addSubCommands(new MySubCommand(plugin));
}
// execute method, parsed args, similar to brigadier
}
i was looking for an annotation lib and people in here recommended me acf
you define an argument
Each time you update the library let say, you will have to reistall it on local repo again
Are you set on ACF? I've also got a library that works unlike any of the others
i want it to take a string as parameter (the name)
okay gotcha
sethome string:name {
user player
permission sethome.use
hook sethome
}```
```java
@CommandHook("sethome")
public void setHome(Player sender, String name) {
// do stuff
}```
Mine looks something like this
oh ye you told me about that
With the top bit being what you would put in the command file, a separate markup file that describes the command layout
setArgs(new Argument("myarg", required, Player.class, OptionalFor.PLAYER))
CommandExecutor = new Command().builder().name("bla").execute((sender, args) -> bla).build();
The black part should be a consumer right?
something like that
You can add multiple
and the entire structure changes based on args
Why?
do i need to register stuff or smth?
For example, usage on console there is:
/mycommand <myarg>
player:
/mycommand [myarg]
Oh that's easy to do with my lib as well
ah ye hold on i know that part
What is myarg in that case?
ArgumentBuilder<Object,?> argument = literal("first");
argument = argument.then(argument("firstArgument", word()));
argument = argument.then(literal("second"));
argument = argument.then(argument("secondArgument", integer()));
argument = argument.then(literal("third"));
argument = argument.then(argument("thirdArgument", bool()));
argument.executes(this::execute);
this for the command line
/first <firstArgument: String> second <secondArgument: Number> third <thirgArgument: Boolean>
An argument you can fetch later
also arent these the same?
of type Player
and it takes 1 min to add an abstraction above all the mutations
^
It's really dense
I'd split it up a bit more
But then that just makes it even bigger
TextComponent component = new TextComponent("text").setHoverEvent();
ProxyPlayer#sendMessage(component);
Conclure is it possible to send this component on bungee?
I mean sure you could split it up, but that still reads rather fine
@waxen plinth I'll send you an example command in mine soon
Alright
its not the best, still a WIP
yes
ProxiedPlayer::sendMessage
arguments:
ChatMessageType.CHAT
component
Do i need to do a hashmap to make a specific player's int var ?
sorry for asking dumb questions lmao, pretty new to java still
conclure another thing and really sorry im really annoyed trying to do this:
Command cmd = new CommandBuilder().name("test").execute((sender, args) -> bla bla).build();
I dont know how to do that part, for that i have a class called CommndExecutor but i dont know how to use it in that thay i send te code
package nl.stefanokeizers.grabbelton.listeners;
import org.bukkit.Material;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.block.Action;
import org.bukkit.event.player.PlayerInteractEvent;
import nl.stefanokeizers.grabbelton.Main;
import nl.stefanokeizers.grabbelton.utils.Utils;
public class GrabbeltonOpenListener implements Listener {
@EventHandler
public void onInteract(PlayerInteractEvent e) {
Player p = (Player) e.getPlayer();
final Integer grabbel = (Integer) Main.grabbelConfig.getConfig().get(p.getUniqueId() + ".Pogingen");
if (e.getAction().equals(Action.LEFT_CLICK_BLOCK) || (e.getAction().equals(Action.RIGHT_CLICK_BLOCK))) {
if (e.getClickedBlock().getType() == Material.LIME_GLAZED_TERRACOTTA) {
if (grabbel == 0) {
p.sendMessage(Utils.colorize("&cJij hebt geen grabbelton poging(en)."));
e.setCancelled(true);
}
if (grabbel > 1) {
Main.grabbelConfig.getConfig().set(p.getUniqueId() + ".Pogingen", (Integer) grabbel - 1);
Main.grabbelConfig.save();
p.sendMessage(Utils.colorize("&7Je hebt de grabbelton geopend, succes!"));
// Open grabbelton menu
e.setCancelled(true);
}
}
}
}
}
Hello why does it execute 2 times
Can someone help
Please use ?paste
?paste
And you already asked that before and someone explain you what happen
I dont know how works
User have 2 hands, that why it get double executed
How do i set 1 hand
Oh sorry
I thought you already asked that, but was a diff person
I get confused my bad
Ooh xD
Why casting an integer, spigot already has a method called getInt(path)
So you dont need to cast it manually
Oh i see
im confused lol
heh
ah wait jdk and jre
lets remove them all and replace it by the not headless version
Why does my PlayerRespawnEvent not get called when I use Player#spigot().respawn()?
u gotta wait 3 ticks
uhm, is there a Method to call it instantly? Because atm it just gets ignored :/
@EventHandler
public void onRespawn(PlayerRespawnEvent e) {
Player p = e.getPlayer();
p.teleport(API.getSpawn());
}```
But why doesnt it teleport the player after I execute ``Player#spigot().respawn()``?
how can i set their respawn location?
why not use the setrespawn method in the event?
https://hub.spigotmc.org/javadocs/bukkit/org/bukkit/event/player/PlayerRespawnEvent.html#setRespawnLocation(org.bukkit.Location)
declaration: package: org.bukkit.event.player, class: PlayerRespawnEvent
didnt knew it exists, ty
@late sonnet bachelor's degree in comp eng 👀
sounds better in english but yeah xd
in english?
i mean im from Chile... then its called "Ingeniero en Informatica" :3
that sounds better
setItemMeta does not authenticate
There is nothing that would need any authentication...
it does not work
?notworking
"Does not working" is a useless statement. Please describe what exactly is not working, what you expect it to do, and what actually happens. If you get any console errors, also ?paste the entire stacktrace.
?notworking
"Does not working" is a useless statement. Please describe what exactly is not working, what you expect it to do, and what actually happens. If you get any console errors, also ?paste the entire stacktrace.
how to show a script ?
https://www.spigotmc.org/threads/util-change-server-properties-easily.113868/
is there an updated util for this?
```
Code here
```
import org.bukkit.enchantments.Enchantment;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.player.PlayerJoinEvent;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.ItemMeta;
public class mainListeners implements Listener
{
@EventHandler
public void onJoin(PlayerJoinEvent event)
{
Player player = event.getPlayer();
ItemStack honey = new ItemStack(Material.HONEYCOMB);
ItemMeta honey2 = honey.getItemMeta();
player.getInventory().clear();
player.getInventory().setItem(4, honey);
honey.setItemMeta(honey2);
honey2.setDisplayName("§lMenu");
honey2.addEnchant(Enchantment.BINDING_CURSE, 1, true);
player.updateInventory();
}
}
the SetItemMeta does not want to run on minecraft
I mean, it is working, you're just setting the item before you modify it
I don't know how to say
- Rename "honey2" to "honeyMeta"
- You are setting the ItemMeta and updating it afterwards but you need to update the meta first and then apply it on the ItemStack
use the chat color enum
why
§ can break on certain systems
bujmp
You're doing this:
ItemStack honey = new ItemStack(Material.HONEYCOMB);
ItemMeta meta = honey.getItemMeta(); // Gets the meta
honey.setItemMeta(meta); // Re-sets the meta
player.getInventory().setItem(4, honey); // Sets the item
meta.setDisplayName(""); // Sets the name AFTER you already set the item in the inventory
meta.addEnchant(Enchantment.BINDING_CURSE, 1, true); // Adds an enchantment AFTER you already set the item in the inventory```
You want to do this
```java
ItemStack honey = new ItemStack(Material.HONEYCOMB);
ItemMeta meta = honey.getItemMeta(); // Gets the meta
// NOW EDIT THE META
meta.setDisplayName("");
meta.addEnchant(Enchantment.BINDING_CURSE, 1, true);
honey.setItemMeta(meta); // Set the updated meta
player.getInventory().setItem(4, honey); // Now set the item in the inventory```
It only breaks if you dont compile your src files with utf-8 encoding
Still shouldn't do it
^
thx
!!
update it yourself
its legit 1 class thats 60 lines long, wont take you long
Its possible to have a maven settings.xml file with custom properties, which i can use in every module of the project?
Thats what a parent pom is for
How it looks inside?
Yeah, you can set properties in the parent pom, but I definitely wouldn't do it in your settings.xml because that's local ;p
<project>
...
<properties>
<whatever.property.you.want>hello world</whatever.property.you.want>
</properties>
...
</project>```
So the one alone its the parent right?
Yes
Allright know i understand i was a bit annoyed
The one that declares <packaging>pom</packaging>
Allright, because a friend told me something harcoded to do what i want a settings file, which declare a profile, with properties
A mess to understand how it work
Yeah the settings.xml is a local file to change settings about Maven including private repository credentials among other thing. Not ideal if you intend on having other people work on your project
Only acceptable thing to do there would be like... maybe access keys
Even then, way better ways to handle that
Something like tha its allowed?
Or should be declare like: <menu.name></menu.name> etc
that looks fine, Im no xml expert tho
I ask because i dont know what support maven as properties
what r u tryna do
Im trying to setup global properties for a multi module project
anyone know sound effects that sound like u bought something
NOTE_PLINK?
I think its something similar to that
is there any website u know can hear these
Did you shade bungeecord in?
Do you use the maven-shade-plugin?
I see
Make sure to use the latest version for both your compilation and the server
Hey, I have a little question, is it possible to register to spigot's bitbucket so I can fork and create a pull request?
?contribute @hoary mason
You can find information about contributing to Spigot at the following links:
https://www.spigotmc.org/wiki/cla/
https://www.spigotmc.org/wiki/guide-contributing-to-spigot/
https://hub.spigotmc.org/stash/projects/SPIGOT/repos/craftbukkit/browse/README.md
https://hub.spigotmc.org/stash/projects/SPIGOT/repos/craftbukkit/browse/CONTRIBUTING.md
'version' contains an expression but should be a constant. @ dev.alex.net.library.menu:spigot-menu:${module.menu.version}, C:\Users\Usuario\IdeaProjects\Spigot-Library\Menu\pom.xml, line 13, column 14
What means that?
Do you maybe know how i could do this? I cannot find anything
I use player interact event
thanks, oh wow need to complete a form with some personal information ahaha 😅
Wait... why are you trying to get a ProxiedPlayer in the InventoryClickEvent? Spigot doesnt have any idea of proxies and Bungeecord does not
have any idea about inventories.
Ok but Spigot doesnt know if the player is connected via a proxy. Spigot doesnt have any idea about Bungeecord and you will never be able
to interact with Bungeecord on spigot unless you use the plugin messaging channel.
is it possible for me to detect and get when something is sent to the console
You mean if the console sender sends a message?
Hook into the std::out stream.
System.out
?pmc
do you know a good resource on doing that or do you know how?
System.setOut(PrintStream out)
Just implement your own PrintStream and set it as std out.
PrintStream myStream = new PrintStream(System.out) {
@Override
public void println(String x) {
super.println(System.currentTimeMillis() + ": " + x);
}
};
System.setOut(myStream);
System.out.println("Hello World!");
Results in
1420553422337: Hello World!
would that make it so it wouldn't log to the console anymore?
since I'm setting the output stream
The super call logs to the console.
super.println(System.currentTimeMillis() + ": " + x);
(if I'm outputting it elsewhere)
yes but
I want to log this stuff in discord
so theoretically I could just add both methods in that sub method?
getServer()#getMessenger()#registerOutgoingChannel("BungeeCord")
@Override
public void onEnable() {
this.getServer().getMessenger().registerOutgoingPluginChannel(this, "BungeeCord");
this.getServer().getMessenger().registerIncomingPluginChannel(this, "BungeeCord", this);
}
@Override
public void onDisable() {
//make sure to unregister the registered channels in case of a reload
this.getServer().getMessenger().unregisterOutgoingPluginChannel(this);
this.getServer().getMessenger().unregisterIncomingPluginChannel(this);
}
this part from the tutorial
@Override
public void onLoad() {
PrintStream myStream = new PrintStream(System.out) {
@Override
public void println(String msg) {
CompletableFuture.runAsync(() -> this.logToDiscord(msg))
super.println(msg);
}
};
System.setOut(myStream);
}
private void logToDiscord(String message) {
// Implement sending message to DC
}
*If you want to be really clean then you would need to provide an executor
to the CF so that the common pool is not littered.
thought so thanks
toto i dont understand what you are doing, you have a plugin with bungee and spigot code. so i dont understand your code
The home of Spigot a high performance, no lag customized CraftBukkit Minecraft server API, and BungeeCord, the cloud server proxy.
Also you dont need to check if the player is already there. Bungeecord checks that already and doesnt do anything in that case
because you never actually start the timer
Because you never scheduled it
what
howd o i
?scheduling
[DiscordServerPanel] Plugin DiscordServerPanel v1.0-ALPHA generated an exception while executing task 3java.lang.NullPointerException: Cannot invoke "me.hapily.plugins.market.discordserverpanel.Bot.initializePanels(net.dv8tion.jda.api.JDA)" because the return value of "me.hapily.plugins.market.discordserverpanel.DiscordServerPanel.access$000(me.hapily.plugins.market.discordserverpanel.DiscordServerPanel)" is null
null
yeah what is it saying is null
"access$000"
is it referring to my my main class itself?
what is null?
event.getJDA() was not null when I used it before
Main Class
https://paste.md-5.net/awiqoxodep.java
Bot Class
https://paste.md-5.net/uradamoxaq.java
Panel Class
https://paste.md-5.net/otamucoley.java
Did you inject your object from the bot class to the panel class ?
no the panel class doesn't use the bot object anywhere
then why sending the panel class too ?
because in the initializePanels method it's creating a new panel object for each guild
ah } is never causing a NPE
try again and show the new exception
without changing anything
what
just generate a random integer, why doing a uuid ?
oh well, my bad.
anyone know website of library to listen to these sounds
i went with your screenshot sent earlier
wdym
.
is it just line 49 in DiscordServerPanel or does it go further? @lethal coral
that's the whole error
i'm trying to connect to my mongodb server and it keeps saying
java.lang.NoClassDefFoundError: com/mongodb/ServerAddress
```xml
<dependency>
<groupId>org.mongodb</groupId>
<artifactId>mongo-java-driver</artifactId>
<version>3.12.11</version>
</dependency>
i have it in the pom.xml
so then event is somehow null
or bot
probably bot
how
probably need to shade it
seems like the event gets fired before the creation of the bot
checkout the maven shade plugin
I don't know what else to do since I'm awaiting ready and that is the ready event which is supposed to be called when the bot is ready
alr
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>3.2.4</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
<configuration>
<createDependencyReducedPom>false</createDependencyReducedPom>
</configuration>
</execution>
</executions>
</plugin>```
should this work
well try and tell us
nope same error
How are you building the jar
try to debug it
well I already have it broadcasting when the bot is "successfully created" (just right after I create the new bot object) and it broadcasts after the error
No problem
i shaded the libs in
what if you dont call it async
I don't want it to lag the server that's why I do this
significantly improves performance
Question, after initially generating a world, is spigot/bukkit/whoever caching the dimension minY and height somewhere besides the datapack dimension type?
I have noticed that a world does not update its height restrictions after a restart when the datapack is modified
how would that lag the server
because you're creating a bot...
if I was just doing it when the server starts that would be fine, but I have a reload command
yes
is there a way to send someone to another server that's not part of the bungeecord network?
also thats not what i meant by debug. try to debug what exactly is null, debug the program flow
ah, yes, there we have it. the bot is null as said
interesting
if you wanted too, if the server is offlinemode and allowing direct connections you could add it to your network, no matter if you own it or not and you can connect to it
how is the bot null though
probably because the event is called before the bot got assign. idk when the event fires
ok but
there is no transfer packet so I don't see how 🤔
unless we make a proxy within spigot itself
I'm setting the value in a method that I call before the JDABuilder is even activated to do the ready event
seems like that has nothing to do with that https://ci.dv8tion.net/job/JDA/javadoc/net/dv8tion/jda/api/events/ReadyEvent.html
when you're running stuff async, order doesn't really matter
readyevent probably means "hey, i, the jda, loaded"
yes, "API is ready"
😐
how do u use multiple small worlds for different places and teleport from one to another
Player#teleport(location)
I don't think that makes sense
multiverse ?
ye but cant u have multiple worlds
I think it's saying the api is ready to use with the bot
location has the world in it
^
how do u implement multiple worlds tho
just create a new world and such
and then how would I teleport there
how do i add location
with the world
specified
Bukkit.getWorld(name)
name is just the name of the file right
name of the world
so like default one is just "world"
yes
back again lol,
java.lang.NoSuchMethodError: 'void com.google.gson.JsonArray.add(java.lang.String)'
i have gson in my pom.xml
its all shaded
Right, different question
Is it possible to change the max and min height of a world during runtime
Through NMS and reflection if necessary
for (String s : this.aliases()) {
array.add(s);
}
sir I changed it to awaitStatus(Status.CONNECTED) which is "JDA has finished loading everything, is receiving information from Discord and is firing events."
and changed the event as well and I still get the same error
and 'add' is a method so idk whats happening
?paste the initializePanels method
Caused by: java.lang.IllegalArgumentException: location.world
Oh it's because you never set bot to anything.
any1?
Seems like that event is being fired before you're setting it
Especially since you're setting it async
See how the error is thrown and THEN it says Bot has successfully been created!
Because you're starting JDA
So JDA can start firing events before you've fully created your Bot class
Call initialize() after you do attemptBotCreation
Or better yet, inside attemptBotCreation
are you sure i can just use the name of the folder for the world, it seems to not work for me
i can go to world_nether
but cant go to xylia or zorro
which are the ones i made
if the world is unloaded, you gotta load it
but initialize() is called in the constructor...
so basically open in singleplayer
Nop
huh
Yeah, so it's going through all the JDA initialization process, and apparently firing that event before the constructor is finished
new WorldCreator(name).createWorld();
Chest chest = (Chest) player.getTargetBlock(null, 5); why am i cannot cast to chest?
Chest itself is not a block, rather a block state
but also the target block of that player is null, in this case
how is that even possible
Why wouldnt it be possible
Bukkit.createWorld(world creator )
It has to do all of that because it's inside the constructor
So the constructor isn't complete until it's finished with that.
hey does anyone know how to solve this error: java.lang.NoSuchMethodError: 'void com.google.gson.JsonArray.add(java.lang.String)' ? i have the gson 2.9.0 lib in my pom xml.
You gotta shade it
im fairly sure it is
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>3.2.4</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
<configuration>
<createDependencyReducedPom>false</createDependencyReducedPom>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>3.1.2</version>
<configuration>
<archive>
<addMavenDescriptor>false</addMavenDescriptor>
<manifestEntries>
<Built-By>V_Link</Built-By>
<Main-Class>com.clonkc.vlands.kitpvp.vlandsutils.Snake</Main-Class>
</manifestEntries>
</archive>
</configuration>
</plugin>
</plugins>```
?paste
Send full pom