#help-development
1 messages Ā· Page 1765 of 1
not going to save all my inventories...
Then use the view
not going to save all the views...
That's what an inventory manager is for
bleh
You aren't meant to be extending inventory holder
Hey guys. I try to make a plugin with an full spigot jar, but when i build it and try to load it, i become an exception that the main-class couldn't be found.
and are you sure thats the right path?
back, here's the code:
https://paste.md-5.net/yihutayepu.cs
My path:
or can you show the error
ItemBuilder š
This is the error
huh
nothing you're good
Try to make new plugin like a new project
I do not want to make it with maven, because you can not send packets with the maven-repository
and uhh is your main class extending JavaPlugin?
Can you show the main class code?
what
package at.theduggy.testplugin;
import org.bukkit.Bukkit;
import org.bukkit.plugin.java.JavaPlugin;
public final class Main extends JavaPlugin {
@Override
public void onEnable(){
Bukkit.getLogger().warning("MSG");
}
@Override
public void onDisable(){
}
}
Thanx
uuuhh
No tab?
What do you mean?
At bukkit.getlogger⦠has no. Tab
what?
can someone help me with my thing aswell please?
What is happening
What are you trying to do?
@lean gull
i'm trying to make a gui that opens from an item
Error?
What's wrong
Code?
Try this tutorial: https://youtu.be/MzUqso_s0ok
Learn to make the most popular plugin feature in Minecraft, GUIs. If you need help check out my discord!
---------- Links ----------
Spigot Player Events: https://hub.spigotmc.org/javadocs/spigot/org/bukkit/event/player/package-summary.html
Spigot Entity Events: https://hub.spigotmc.org/javadocs/spigot/org/bukkit/event/entity/package-summary....
oh no codedred
Also if your trying to detect an item use a pdc
?
his gui parts go brr
what's pdc
What's wrong with codedred
Ye but they work
like using 10 classes to achieve the same with 2 classes
PersistentDataContainer
i followed his tutorials too but i changed everything š
ah
i don't really need it, it's just for a lobby and you can't really get items there
and the menu is accessible for everyone anyway
Put a pdc on the item you are using to open the gui
but i don't need it
That way you can detect the item using only its pdc
i feel like you're not reading my texts
?
I am, I am telling you that a pdc is the best way to do what your trying to do
Consumer<ClickEvent> š
Just because you don't "need" it doesn't mean you shouldn't use it
what's that
Here are some links to get you started on learning Java:
- https://www.codecademy.com/learn/learn-java
- https://www.sololearn.com/learning/1068
- https://www.learnjavaonline.org/
- https://programmingbydoing.com/
- https://docs.oracle.com/javase/tutorial/java/index.html
The last one is the only official one, however some of those concepts assume that you already know a bit about programming.
nothing to worry about
for the like 4th time, no
This is spigot. You can't use under 30 classes
?
check the error?
If you want help maybe you should listen to people but whatever. Have fun fixing your method that is a bad way to detect items in the first place.
my logs are huge
well you only have to look at the caused by: part
and check what kind of exception it is
also i thought you got a stacktrace
step 1: try to help someone
step 2: they said they don't need the thing you're telling them to do
step3 :be toxic for no reason
watching at the logs goes brr
Cannot load plugins/VotingPlugin/VoteSites.yml
org.bukkit.configuration.InvalidConfigurationException: mapping values are not allowed here
in 'string', line 50, column 15:
Messages:
^
says this after
it
does that count with it?
i did put it on the same port as my dynmap
could that be a reason there is an error?
Step 1 ask for help
Step 2 think you know better than the person that is trying to help you and not except any help
Step 3 blame the people using there own time to help
How can i change the name of an player above his had?
use the correct yaml syntax
kidalder your logic makes 0 sense
show that part of the file
how do i do that?
i guess its in the messages.yml or something so send the line with Messages: on top
and some lines before and after
I can say the same for you. You asked me for help and i spent my own time talking to you trying to help and now your calling me toxic for no reason.
"have fun fixing your method that is a bad way to detect items in the first place"
and where would messages.yml be because it isnt in votingplugin folder
anyways i'mma just stop responding to you because i don't wanna continue this argument or whatever this is
there would be a folder called the same as the plugin name under the plugins folder
yea it isnt in that folder
which files are there?
plugin didnt have that
in which file is the exception happening?
like this on the end of the at:
at org.bukkit.configuration.file.YamlConfiguration.loadFromString(YamlConfiguration.java:59) ~[patched_1.16.5.jar:git-Paper-790]
this is right after it
thats not the whole error is it?
It is?
its an error while parsing the yml file
so one of the files has a wrong syntax or something
What should it normally be?
maybe something like
Messages: # this goes brr
other-stuff:
key: ""
note that there always has to be 2 spaces as steps, never one step and never a tab
which file is that?
just put 2 spaces in front of the '-' in line 54
Iāll try that
and remove 2 in front of Messages
might be different paths at that point
correction: will be different paths
console:
- eco give ...
Messages:
Player: ""
looks cursed
Yes it is intended erroneously
is it even possible to store a list as an element of a parent list?
I think it should be
Oh Idk well yaml thinks the mapping Rewards at the bottom is valueless which is not okay
And it also sees console at the bottom as a mixed type (list and map)
Which is not okay either
foo:
- bar
- sus:
- amogus

wont that work?
š
uh yeah probably
._.
Never seen someone doing that before lol
you just cant have a single value in the same line for any of the elements of "foo"
_<
i miss json š
json > yaml imo
Im too young to know Json
you can reformat it however u want
I mean valid json is valid yaml
{
"foo" : {
"bar" : "sus"
}
}
{ #Lynx knows (:
"this": [
"valid",
"yaml"
]
}```
is that actually valid?
{}
yea json is a subset of yaml
oh
oh yaml has {} and [] too
Then whether something like snakeyaml would tolerate it is a different story lol
well then why am i not writing my plugin.yml's like that?
Good question
or json config files
then YamlConfiguration.load() should work on that right
or doesnt it support the syntax
hi! I am trying to get all the current servers on a bungeecord network, when a command is sent. But it doesnt return any. I think I am not waiting long enough for the message to be send back, but I am not sure. The code is a bit separated but I can try and send the bulk of it
Yeah send the code (:
when the command is run, it runs the first function, the second is receiving the message, https://paste.helpch.at/bicisitado.cs
here is the code that runs the first function: java public Inventory createLobbyInv(Player p) { SendMessage.sendGatherLobbies(p); lobbyGUI = Bukkit.createInventory(p, 54, ChatColor.AQUA + "Lobby Selector"); for (int i = 0; i < lobbies.size(); i++) { lobbies.get(i).setAmount(i); lobbyGUI.addItem(lobbies.get(i)); } return lobbyGUI; }
Do you have bungeecord set to true in spigot.yml?
can anyone help me with this? (problem is on the reply of the reply above)
yeah
where are you declaring the MainMenuItem?
it's right above createMainMenuItem
ItemStack mainMenuItem;
is the paste all inside the onEnable?
wdym
do you have multiple classes ?
yes
is the paste you sent inside the main class or are some methods outside?
the first section is in 1 class, the next 2 are in another, and the last is in main
try making the ItemStack mainMenuItem into a static, possibly final variable
works now, thanks
np
I think I am just not waiting for a response, although idk
https://paste.md-5.net/nusolamiro.php did this and still it doesnt work
How would I check if a player is in an area defined by two locations? (one on the up left corner, and the other on the bottom right corner)
get the region between those corners and check if the player is inside this region
thx
anyone great with generics and wildcards here
lets say i have a abstract class
with generic <T extends OtherClass>
there's an abstract method called public void myMethod(T object);
lets say i implement this class
and i need to pass the value to it through another class via its implementation
what should i do
if i have type unsafe value
What value?
Object class object for example
So the implementation wants an instance of type Object, where though?
Sure
public abstract class GenericTest<T extends AnotherClass> {
private final Class<T> clazz;
public GenericTest(Class<T> clazz) {
this.clazz = Objects.requireNonNull(clazz);
}
public abstract void genericMethod(T value);
and this is implementation class
public class GenericClass extends GenericTest<ThirdClass> {
public GenericClass() {
super(ThirdClass.class);
}
@Override
public void genericMethod(ThirdClass value) {
System.out.println("Hey generic method has been invoked!");
}
}
lets say I have an instance of GenericClass object and i need to pass the value to it, but i have Typed down version (Object class instance)
Cast it?
it doesnt work for some reason for me, it casts to AnotherClass instead of ThirdClass
Show us code
I tried using clazz.cast(ObjectValue)
So you have an instance of GenericClass but the type youāve gotten is GenericTest<Object> ?
I've got the type of just Object
again, show use code that fails
Java wonāt be able to handle this
Or well maybe
Cuz type erasure is a bit peculiar
i don't have any, im just tinkering around
with generics
its just pain the ass to work with
especially with dynamic typing
Thing is Object is just a type in generics
itās not the same as ?
or even ? extends/super
no its not
yea i've been following this
Object is exact type. ? is any type that extends Object
Okay so I am trying to prevent players from "claiming" a 3x3x3 structure if it intersects with another 3x3x3 structure.
The coordinates of the CENTER block are stored in a MySQL as 3 separate integers.
How do I check using the most efficient way whether or not x, y and z is within 2 blocks of another value in the MySQL or not?
wait
This MySQL tutorial explores all of the comparison operators used to test for equality and inequality, as well as the more advanced operators.
there's MySQL comparison operators?!?
welp that solves it ^^ ty tho
why so
but with the operators it works just fine
What should I be doing instead in your mind?
.
Using what methods?
I mean if you're just doing it on create or something then mysql is fine
but doing it every block place in mysql will be slow af
it is only called when a user command is done to create the structure
Just dont do sql calls everytime. Load data to the memory once and then re-use it
List<? super T> is if you want to be able to pass a List<E> where E might be T or any super type of T where ? extends is the opposite, itād allow you to pass a List<E> where E might be T or any subtype of T. This is better demonstrated between Supplier<? extends O> where you might want to in letās say CustomFuture<O> pass a Supplier<B> (B extends O) to its constructor CustomFuture(Supplier<? extends O>). It would make no sense if you pass a Supplier<Object> to it since it will be assuming the supplier to drop an object which has the properties of type O at least, in which any subtype would still have the properties of O. Opposite for something like Consumer. Where letās say you have the constructor CustomFuture(Consumer<? super O>). Here we could pass a Consumer<Object> which should work fine as when we use Consumer::accept passing an object of type O still confirms type Object. Thatās the essentials of the shorthand notation PECS, producer extends, consumer supers. Probably not helpful here.
However letās say you do want a type parameterized class. For instance Conclure<T>. What you could do is to only expect object. So you might have the method Conclure#set(Object o) simply. But where the Conclure#get still returns an instance of type T. This is done in Set, Map and so on iirc.
is this a copypasta?
Uh I wrote it on mobile just now lol
lmao
Are there any very fast ways to compare a 3x3x3 structure to a (by material type) defined structure in a config?
rotation is relevant (as in north must always be facing north, cant be rotated)
is 3*3*3 structure its only 27 blocks
yeah, anything faster or more efficient than 27 comparisons?
i don't see a better way to do this, since it involves checking the material types
and that involves comparisons
maybe use some sort of lookup array if that works
import org.bukkit.Bukkit;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import net.md_5.bungee.api.ChatColor;
public class Main implements CommandExecutor {
@Override
public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
if (cmd.getName().equalsIgnoreCase("startbankheist")) {
Bukkit.getServer().broadcastMessage(ChatColor.RED + "The Bank Heist Has Started!");
}
return false;
}
}
plugin.yml
version: 1.0
main: me.yev.Main
description: Command for bank heist event
commands:
startbankheist:
usage: /<command>```
Does anyone know why the plugin isnt showing up as a cmd and as a plugin? im new to command execution.
but nah
i thought like:
stone,stone,stone,stone,dirt,stone,stone,stone,stone
as the uppermost layer and then 2 more layers in the config
^^ wold create a stone ring and dirt in the middle
you haven't registered the command inside the plugin
how would i do that?
why are you naming your class Main?
add this.getCommand("startbankheist").setCommandExecutor(this) to your onEnable override method
ok ty
it knows that you're having the command but the server doesnt know what to do with it
so you need to hook your CommandExecutor to implement your logic
is there a way to make custom items appear in the creative inventory?
You can make a custom inventory to put them in tho
š
Loops?
how would I loop through a 3x3x3 grid of blocks?
oh
hmm
yeah i see how i could
Does this look right?
server_connect_timeout: 5000
remote_ping_cache: -1
forge_support: false
player_limit: -1
permissions:
default:
- bungeecord.command.server
- bungeecord.command.list
admin:
- bungeecord.command.alert
- bungeecord.command.end
- bungeecord.command.ip
- bungeecord.command.reload
timeout: 30000
log_commands: false
network_compression_threshold: 256
online_mode: false
disabled_commands:
- disabledcommandhere
servers:
lobby:
motd: '&1Hub 1'
address: localhost:25565
restricted: false
Survival:
motd: '&1Capboi Survival server'
address: localhost:25567
restricted: false
Dev:
motd: '&1Capboi Dev server'
address: localhost:25568
restricted: false
PVP:
motd: '&1Capboi PVP server'
address: localhost:25569
restricted: false
listeners:
- query_port: 25565
motd: '&1Capboi Network&r\n&e[1.16.2+] &6Survival, &2PVP, &9and &8More!"'
tab_list: GLOBAL_PING
query_enabled: false
proxy_protocol: false
forced_hosts:
pvp.md-5.net: pvp
ping_passthrough: false
priorities:
- lobby
bind_local_address: true
host: 0.0.0.0:25565
max_players: -1
tab_size: 60
force_default_server: false
ip_forward: true
remote_ping_timeout: 5000
prevent_proxy_connections: false
groups:
md_5:
- admin
connection_throttle: 4000
stats: 66228c58-cc13-4b32-8cfc-48b4ab8ecda8
connection_throttle_limit: 3
log_pings: true
does that look right?
why are you asking? If you ask here then it seems like you have a problem, so what is your problem?
Also, that is more towards #help-server
oh
its just it keeps kicking me for the reason that im already connected when im not
anything else in console?
ill dm u it
16:25:06 [SEVERE] java.lang.NoSuchFieldException: modifiers
16:25:06 [SEVERE] at java.base/java.lang.Class.getDeclaredField(Class.java:2610)
16:25:06 [SEVERE] at net.buycraft.plugin.bungeecord.httplistener.ReflectionUtils.setStaticFinalField(ReflectionUtils.java:39)
16:25:06 [SEVERE] at net.buycraft.plugin.bungeecord.httplistener.BungeeNettyChannelInjector.inject(BungeeNettyChannelInjector.java:17)
16:25:06 [SEVERE] at net.buycraft.plugin.bungeecord.BuycraftPlugin.onEnable(BuycraftPlugin.java:86)
16:25:06 [SEVERE] at net.md_5.bungee.api.plugin.PluginManager.enablePlugins(PluginManager.java:265)
16:25:06 [SEVERE] at net.md_5.bungee.BungeeCord.start(BungeeCord.java:285)
16:25:06 [SEVERE] at net.md_5.bungee.BungeeCordLauncher.main(BungeeCordLauncher.java:67)
16:25:06 [SEVERE] at net.md_5.bungee.Bootstrap.main(Bootstrap.java:15)
how do you set the owner of a fireball
and why tf does buycraft need to inject into bungee netty
and also explosion knockback
jeez
lol
yes
nice to meet you ive seen lots of your work
no thats a fake account trying to scam you guys
your the person who enspired me to start my own network
switch case considered?
send me bitcoin
all compares to different things
110 lines of comparing xd
If I win on crash
I know the feeling, youll get thru this I believe in you
16:28:55 [INFO] java.lang.NullPointerException: Cannot invoke "net.md_5.bungee.api.connection.Server.getInfo()" because the return value of "net.md_5.bungee.api.connection.ProxiedPlayer.getServer()" is null
Anyone got an idea what this means?
i got the error from @marsh plaza , he needs to respond here
hi
oh ok sorry
It seems i solved my generics problem by using this one simple rule from stack overflow
PECS
Remember PECS: "Producer Extends, Consumer Super".
"Producer Extends" - If you need a List to produce T values (you want to read Ts from the list), you need to declare it with ? extends T, e.g. List<? extends Integer>. But you cannot add to this list.
"Consumer Super" - If you need a List to consume T values (you want to write Ts into the list), you need to declare it with ? super T, e.g. List<? super Integer>. But there are no guarantees what type of object you may read from this list.
If you need to both read from and write to a list, you need to declare it exactly with no wildcards, e.g. List<Integer>.
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.bukkit.plugin.java.JavaPlugin;
public final class Command extends JavaPlugin {
public static Command plugin;
@Override
public void onEnable() {
plugin = this;
this.getCommand("start").setCommandExecutor(this)
}
@Override
public void onDisable() {
}
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
if(command.getName().equals("start")) {
if(sender instanceof Player) {
Player player = (Player) sender;
player.sendMessage("test");
}else {
System.out.println("You need to be a player to do this command");
}
Bukkit.getServer().broadcastMessage(ChatColor.RED + "The Bank Heist Has Begun!");
}
return false;
}
``` i try it and the .setCommandExecutor is red
you forgot semicolumn
You do not need to setExecutor to your main class
Also, it is setExecutor not setCommandExecutor
this.getCommand("debug").setExecutor(new DebugCommand(this)); i use this dirty command right now to debug
Once again
oh right
his command in main class
sorry
i havent registered commands like this in ages
Can somebody explain this?
i used the import method from vaults website
it could be outdated info
oh I'll try master
it clearly states that the driver is deprecated
nono that is irrelevant for this
first line says enabled vault, last says no vault found
maybe you're loading the vault after the plugin has been enabled
have you added vault as dependency in plugin.yml
during the onEnable
yes
and my onEnable has the Vault given load methods
you can set fasttravel as an alias in the ft command assuming it does the same thing
ah ty
that wont solve your problem but its still good practice
do I still have to set it's executor or is it the one of ft?
i've had issues with vault api before like this too
only one executor
but i forgot how i solved it
ty
damn
he created it for simplicity and now we can't solve the simple problems xd
try debugging the setupEconomy method
add the debug messages there everywhere
and see what fails
at least I did it like this to fix it
it gave me this line in a previous error code
RegisteredServiceProvider<Economy> rsp = getServer().getServicesManager().getRegistration(Economy.class);
but that is just copy pasta
ik
that copy pasta for me didnt worked in a first place too
it could be that permission system is fucking up, at least iirc that was the case for me
im not sure tho
iirc vault has some api for permission handling
does Player.hasPermission() also check permissions from plugins like LP or do I need to use Vault?
private boolean setupEconomy() {
if (getServer().getPluginManager().getPlugin("Vault") == null) {
return false;
}
this.getLogger(Level.INFO, "Vault plugin found!");
RegisteredServiceProvider<Economy> rsp = getServer().getServicesManager().getRegistration(Economy.class);
if (rsp == null) {
return false;
}
this.getLogger(Level.INFO, "Vault Economy Bukkit service has been found!");
econ = rsp.getProvider();
return econ != null;
}
try debugging like this
You don't need vault unleess you wanna grant permissions on players
what logger did you use, I didnt add its methods
nvm stupid m,e
im stupid and dont know how to do it. is it like this? public void onEnable() { plugin = this; this.getCommand("start"); }
yes but how do i pass it lol
this.getCommand("start").setExecutor(new class());
i did that and coll told me you shouldnt!
If your onCommand method is in your main class, then do getCommand("start").setExecutor(this); otherwise pass in the class which contains the onCommand method
no you used "this" keyword
if it is not in the Main then you need the class name
Iād your onCommand method is in main, do nothing
If you do nothing, then how is the server supposed to know what to execute when you run the command?
Your main class is the default executor
Okay, I knew that you don't have to implement CommandExecutor in your main class but I did not knew that it also takes it as the default executor
omfg
i ummmm
might have forgotten to install an economy plugin with my vault problem
how to create tablist in 1.17? PacketPlayOutPlayerListHeaderFooter this packet has changed since 1.17
Iirc it takes 2 net.minecraft texts I forgot which
You can set the header and footer with the API
YOU DONT NEED PACKETS FOR THAT
can you send tutorial/doc
?jd
Search header in the javadocs
I believe itās just setPlayerListHeader/Footer
rly?
How do I know if a runTask or runTaskAsynchronously has finished? Does it mark the returned BukkitTask as cancelled?
erhm??
Use BukkitTask::isCancelled BukkitScheduler::isCurrentlyRunning and BukkitScheduler::isQueued
Okay, so those methods also work for non-timers?
read their javadoc
The javadoc is trash
wat
Doesn't say anything about what I want to know
Use BukkitTask::isCancelled BukkitScheduler::isCurrentlyRunning and BukkitScheduler::isQueued
Yea
if task is not cancelled and is not queued and is not currently running
then it has already been executed
import org.bukkit.ChatColor;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.bukkit.plugin.java.JavaPlugin;
public class Main extends JavaPlugin {
@Override
public void onEnable() {
// startup
// reloads
// plugin reloads
}
@Override
public void onDisable() {
// shutdown
// reloads
// plugin reloads
}
public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
if (label.equalsIgnoreCase("start")) {
if(sender instanceof Player) {
// player
Player player = (Player) sender;
player.sendMessage(ChatColor.RED + "The Bank Heist Has Begun");
return true;
}
else {
// console
sender.sendMessage("Hey console");
return true;
}
}
return false;
}
}
``` ok so i gave up on doing whatever it was before. This still doesnt work though and its the most basic one. Anyone know what the issue is?
it doesnt show up as a plugin nor command
send plugin yml
version: 1.0
main: me.yev.Main
author: DeadMan
api-version: 1.17.1
commands:
Start:```
looks fine
altho idk if its case sensitive, so Start -> start
also why comparing label?
"(label.equalsIgnoreCase("start")) " ???
should it be cmd?
i never use it like this
hm well what should it be instead of a string
I register the commands in the main and give the commandname like this
if (cmd.getName().equalsIgnoreCase("start")) {
is the one u want i guess
Oh nvm I didn't scroll up
I didnt work anyway.
?paste
can u send full code?
think you got enough spaces?
lol
i like to know what im seeing š
So your saying the command isn't showing up at all or it's just not working?
Then it's not registered in your yml or the plugin isn't enabled
Are you sure the plugin is enabling?
Is it showing on pl
no
Could not load 'plugins/BankHeist.jar' in folder 'plugins': uses the space-character (0x20) in its name
Your name cannot contain spaces
seems rather obvious
yes im an idiot.
š¦
works now thanks @unkempt peak
is there any concurrent identity hashmap implementation in java
cause i cant find it
Guava MapMaker
thanks
Im trying to cancel movement in my duels server. Currently i use this code which isnt working too well and causes alot of issues java Player p = event.getPlayer(); if (!QueueManager.canMove.get(p)){ event.setCancelled(true); }
ConcurrentHashMap?
ok i glossed over the identity part
uhh
https://stackoverflow.com/questions/15456742/concurrenthashmap-with-weak-keys-and-identity-hash looks interesting
how do you make fireballs do more kb
Seems weird there isnāt a concurrent one in the standard library
Yeah, well arguably not needed
I want to check if a block has been placed by a player or is natural (specifically ores). Right now when someone places a block I am giving it the Metadata PLACED however I realized this would reset when the server restarts. With that in mind, how should I go about checking if a block is natural or placed, even if the server restarts?
I would do chunk pdc or an external database
How would I store that in a database though
I understand mongodb & know how to efficiently use it
Is there a way I can get the last 10 (or more) messages from chat?
Or would I have to make my own logger in a plugin?
ah, thank you!
Anyone good with SQLite? I've got a big mindfuck here
I have two tables
One has a foreign key referencing the other
I enabled the foreign key option, so the constraints should be working
But when I update the column the foreign key references, it does nothing
The second screenshot is the update query
Youāll need to store the world, x, y, and z
I had basicly the same problem, and I just saved the list of blocks as a file on the onDisable
it doesn't seem to be working, though, so I suggest not doing that
what's chunk pdc
hey so i dragged my current project over from my other computer to my macbook after installing intellij and adding the mc development plugin
doesnt seem to be recognizing my apis
i don't think your foreign key constraint is valid
needs to reference a primary key of another table
It is
I figured out the issue
The issue is that PRAGMA foreign_keys = ON; has worked for every single fucking plugin I have ever made before this
But now it stopped working for no reason
And I have to pass ?foreign_keys=on; at the end of the jdbc url
is sql.execute using the same database connection?
Ello o/ Does anyone know how the world.locateNearestStructure method works?
More specifically, what is the location returned? The center of the structure? The block of the structure nearest to the player?
Also - the documentation says
The radius is not a rigid square radius. Each structure may alter how many chunks to check for each iteration. Do not assume that only a radius x radius chunk area will be checked. For example, StructureType.WOODLAND_MANSION can potentially check up to 20,000 blocks away (or more) regardless of the radius used.
How do I know how many chunks a specific structure will check per iteration? For example, if I wanted to know how many chunks an endcity would check through?
It probably reflects the vanilla locate command
But Iām not sure the functionality of that is documented either
how come I cant change spigot-api to spigot in my new project?
actually no that was indeed a stupid question i think i would need buildtools
You need to run buildtools for the desired mc version
mhm
is gitbash necessary for installing buildtools or can i just run it in terminal or smth
just use your command line
alrighty - so this is my code:
https://www.toptal.com/developers/hastebin/behazixige.java
and these are my errors:
Description Resource Path Location Type
Syntax error, insert "}" to complete Statement VarmTab.java /Varm/src/me/theeyeofthepotato/varm/parser line 154 Java Problem
Description Resource Path Location Type
Syntax error on token "}", delete this token VarmTab.java /Varm/src/me/theeyeofthepotato/varm/parser line 186 Java Problem
I checked, and I don't think I have unbalanced curly braces... any ideas? Thanks!
you must, follow the suggestions
ok, but where am I supposed to insert the curly brace
when I do, it throws kinda he same errors
Show your code
I did...
what's an outformatter
autoformatter
is that just an ide?
yes your ide will have a button
the weird indentation of your very last line does suggest there is a } missing
can someone help me install buildtools on mac
spigot forums tutorial isnt very clear
watch codedred's vid
- or just watch codedred's vid
git or gitbash?
it will be pretty much exactly the same if you run it from cli
git
do you know where the auotformat button on Eclipse?
if you cant find it theres a lot of websites that do it for you
hmm
terminal is asking me for a password to install homebrew but its not letting me type anything
Homebrew? I thought you where trying to run buildtools
mac moment
Just use a bat file
theres 3 options there
.bat is windows lol
you can install xcode or use the binary installer
Oh wait your on mac
which one do you prefer?
Well that's your issue lol
Better to be on mac than crack
The official stand-alone installer for Git on OS X
idk man have you ever tried mac?
better to be on windows than the strip poles
Yes
I don't understand how anyone can possibly be a programmer on mac
xcode?
mac is so bad
well did you try the third option, the installer I linked
This is why I program on my etch-a-sketch
binary installer?
yes
oh didnt see the link
another question- how do I add arguments and make them not go in alphabetical order
client probably sorts them alphabetical
It does
so it's impossible?
hmmm
on windows, gitbash has its own terminal gui
is mac's integrated into terminal?
alright thank you
yes, since macs already have bash installed
how do i input buildtools destination?
ah ok
so i ran the terminal command and it came back with the "successfully installed all stuff" after a while
but none of the spigot, bukkit, work, etc. folders are coming up where the buildtools jar is
hmm so
i wonder where its been installing
cuz i did java -jar Desktop/BuildTools/BuildTools.jar
and it worked fine but nothing showed up
but i did like cd (directory) or something and it did work
type pwd
For some reason calling ConfigurationSection#addDefault(path, true) sets *id002 on the config
š¤Ø
Yes, this is the only place I touch config values
Only difference to usual is that I'm saving async
make sure only one thread is touching the config at a time
Yeah that's happening too
async prolly causing your issues
https://paste.md-5.net/niceyojoje.java - SettingsFile (where I mess with config)
https://paste.md-5.net/uqajefozez.java - YMLBase
I wonder if calling set instead of addDefault changes anything
CompletableFuture.runAsync(this::save); // Todo: Not call this 200 times (cache for a bit for less IO)
you're calling shouldEnable whilst the async task is running
Hmm
your comment even suggests this is an issue
so the million dollar question
what exactly is spigot?
is it like an alteration of minecraft?
plumbing
Spigot is basically an extension of minecraft's server implementation
Containing an updated version of Bukkit API along with Spigot's own API
which I find weird that they're doing both but oh well
bukkit api is just a deobfuscation library of core minecraft
No
Not exactly
Bukkit API is an interface that calls minecraft's implementation, with friendly methods
And provides event systems and such
so bukkit api is solely for plugin development?
Mostly, but Bukkit also contains its customizability and NMS patches
nms patches?
NMS is net.minecraft.server - Minecraft's implementation
It does some modifications for better interactability and perhaps performance, I haven't read bukkit's entire code
whats the difference betweek bukkit and craftbukkit
CraftBukkit is a fork of Bukkit with some fancy stuff that allowed NMS-like code
I wasn't around that age so I can't tell you much regarding it
CraftBukkit implements those interfaces
Yeah
interfaces?
I love how bukkit doesn't let me see craftbukkit's code because interfaces
Bukkit can be taken to other servers if they really want. Glowstone is a good example of that. The Glowstone server tries to implement Bukkit as best as possible
so half of the time I'm stumbling around blindly
It's all fun and games until someone calls NMS on glowstone
Oh you mean a plugin calling NMS. Yeah. Then you're SOL
and authors getting anonymous reports and wondering where their reflections went wrong
ok so from my understanding, nms is minecraft's server implementation code, craftbukkit is the deobfuscation of that code, bukkit is an api to access easy methods for plugin development, spigot is an extension of bukkit, and paper is an extension of spigot
And tuinity is a fork of paper that got merged with paper
And purpur is a fork of tuinity
forkforkforkfork
Yatopia
Airplane -> purpur -> tuinity -> paper -> spigot -> craftbukkit -> bukkit -> nms
"Performance driven fork"
is this correct? im trying to explain how this stuff works to a friend
at that point you just rewrite it entirely
I code all my plugins in binary thank you never much
I connected 2 wires to my motherboard and time the zaps
Did the Glowstone project halt? Seems like there's not been a commit for over 2 months
I always wanted to write my own impl but I'm the kind of guy that writes 90% of a project and gets bored
java.io.FileNotFoundException: modifiers.yml (The system cannot find the file specified)
is there another way to reference files because just putting it in a plain string doesn't work even though the class referencing the yml file and the yml file itself are right next to eachother in the filesystem
new File("modifiers.yml")
do i need to specify the package or put a ./ in the beginning
Yes
You need to
Usually a .jar is a weird .zip file you can open
So you can just see how JavaPlugin#saveResource works and replicate it
got it
Bukkit + mods = trash smh
airplane is a fork of paper
It wouldnāt be trash if the API was implemented well
Although I guess it would still have issues due to stuff like the material enum
bukkit api wasnt designed to work with mods at all. Thats not about well implementation
java
Itās mostly just because Bukkit expects a fixed number of items, biomes, etc
That's already a lots of breaking changes
To be fair those changes probably need to be made anyway
Biomes arenāt fixed anymore, blocks probably wonāt be some day
So apparently its not possible to detect Keypresses, but on the Manacube prison server, the "F" key opens a custom menu. How is this done??
How can I get the amount of items dropped onBlockBreak?
For example if you break a diamond ore and it drops 3 diamonds because you have fortune it prints that to console that you got 3 diamonds from one ore
You can use BlockDropItemEvent
I think you can also pass an itemstack to Block#getDrops
Can someone check out the code and tell me what is wrong?
Validate and Verify your YAML documents, optimized for Ruby on Rails
your commands need quotes
end of the stream or a document separator is expected (34:6)
31 | 29
32 | 30
33 | 31
34 | Name: minecraftservers.org
-----------^
35 | Priority: 4
36 | Hidden: false
Your spacing is messed up
I'm to busy to do it , just
what is the name of the plugin
I am trying to get a CreatureSpawner after a BlockPlaceEvent
I place a spawner, and I get the first debug message but the second debug message doesn't fire:
Is this one of those things where I need to check 1 tick after the event?
Oh i forgot about Block#getState() whoops, ignore me
is there something like Collections.max( but for arrays ?
Oh and just my personal issue, but i feel like doing check false before doing something is not that easy to read.
for example
@Override
public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, @NotNull String[] args) {
if (sender instanceof Player p) {
if (p.hasPermission("risingcore.spawnsystem")) {
if (args.length == 1) {
String locationName = args[0];
if (!locations.getConfig().contains("Locations-Data." + locationName)) {
locations.getConfig().set("Locations-Data." + locationName, p.getLocation());
locations.save();
language.setSpawn(p);
return true;
}
language.alrName(p);
return true;
}
language.noArgs(p);
return true;
}
language.noPerm(p);
return true;
}
language.playerOnly(sender);
return true;
}
instead of
@Override
public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, @NotNull String[] args) {
if (!(sender instanceof Player p)) {
language.playerOnly(sender);
return true;
}
if (!p.hasPermission("risingcore.spawnsystem")) {
language.noPerm(p);
return true;
}
if (args.length <= 1) {
language.noArgs(p);
return true;
}
String locationName = args[0];
if (locations.getConfig().contains("Locations-Data." + locationName)) {
language.alrName(p);
return true;
}
locations.getConfig().set("Locations-Data." + locationName, p.getLocation());
locations.save();
language.setSpawn(p);
return true;
}```
Easier to read right?
ewie normal bukkit comand handling
that is an example.
But it looks cleaner than the other one right?
?
I used return to make sure it will never interfere with the codes that are not inside the if
or might be something like this, a huge else if
if (value instanceof String) {
writeString((String) value);
} else if (value instanceof Number || value instanceof Boolean) {
write(value.toString());
} else if (value instanceof TemporalAccessor) {
String formatted = TomlManager.DATE_FORMATTER.format((TemporalAccessor) value);
if (formatted.endsWith("T")) // If the last character is a 'T'
{
formatted =
formatted.substring(0, formatted.length() - 1); // removes it because it's invalid.
}
write(formatted);
} else if (value instanceof Collection) {
writeArray((Collection) value);
} else if (value instanceof int[]) {
writeArray((int[]) value);
} else if (value instanceof byte[]) {
writeArray((byte[]) value);
} else if (value instanceof short[]) {
writeArray((short[]) value);
} else if (value instanceof char[]) {
writeArray((char[]) value);
} else if (value instanceof long[]) {
writeArray((long[]) value);
} else if (value instanceof float[]) {
writeArray((float[]) value);
} else if (value instanceof double[]) {
writeArray((double[]) value);
} else if (value
instanceof Map) { // should not happen because an array of tables is detected by
// writeTableContent()
throw new IOException("Unexpected value " + value);
} else {
throw new TomlException("Unsupported value of type " + value.getClass().getCanonicalName());
}```
I would instead of doing that, use something like if to check then return.
it looks cleaner than these else if lol
As in like, the vanilla API for commands
Yeah the second one is readable however uhm
For the second chunk why not use a switch case instead of a fat tree of ifs
yeah that can be too lol
does Bukkit.getScheduler().cancelTasks() only cancel plugin tasks
i forgot switch
arrays r stupid simple in java, i think you need to convert them to a Collection unless u write ur own method
could probably do something with the Arrays.stream() method?
Arrays.stream(arrayIn).max(maxFunc).get();
editsnipe
oh i forgot this server dont even have snipe
typing.
conclure is typing.
Yeah well on the contrary, what is the notion of maximum regarding a collection.
Itās a bit ambiguous if itās not some obvious type like numeric
Possibly, you could map the different types
blaming for unecessary stream creation starts in 3
2
1
dont see shit
if it takes a Plugin as parameter, yes
otherwise probably no as it would have to figure out which plugin called the method
yeah it cancels only plugin tasks i think
aight thanks
scheduler is not working (it ignores the delay) https://paste.md-5.net/bivugosuce.cs
am i wrong in usage of it? I also tried using it onEnabled in final main class but not working either
Arrays.asList
like why the fuck would you use Arrays.stream like that
Streams are much slower than anything imperative
(btw asList is optimized for arrays as it actually uses a private immutable List implementation)
otherwise,
int max = 0;
for (int i : array) {
if (i > max) {
max = i;
}
}
it's not really that hard to make a "get max" method
and tbh I'd go for this if it's just a one-time thing, otherwise it's just pointless to use a util method
probably refers to Collection<T extends Comparable<T>> right?
I'm almost right
it's
<T extends Comparable<? super T>> and then Collection<? extends T>
otherwise, you can use a Comparator if it isn't comparable
idk it was 4am, on my phone and didnt think to think that since Collections used... a Collection.. u could just convert the Array... to a Collection
streams r cool in theory, but thats about it, even i dont normally use them in any production code
Does someone know why when I try to get this string from config, it will return null?
name: "ąøą¹ąø”ąø¢"
Yeah could be, any way to fix that?
Dunno.
utf 8
enforce entire server in the batch file
did you do that
one sec
It isnāt immutable. Itās just a fixed size list implementation which wraps around the passed array.
it fails on add, possibly remove and similar methods but should work fine for set yes.
hm
yall ever baked a hamster
damn right I have
ya like jazz
yeah it works with utf-8 added on the startup script, thanks!
asian moment
Wat
asian moment
Why not indian?
That's not from me xd, what language is that anyway?

because asian moment
not indian moment
that sounds weird bruv
that's Thai
asian moment
Hey there!
Where can I get net.md_5.bungee.api.plugin.Plugin import?
project(':hackedserver-bungeecord') {
repositories {
maven { url 'https://mvn.exceptionflug.de/repository/exceptionflug-public/' }
}
dependencies {
compileOnly group: 'net.md-5', name: 'bungeecord-api', version: '1.17-R0.1-SNAPSHOT'
compileOnly group: 'net.kyori', name: 'adventure-text-minimessage', version: '4.1.0-SNAPSHOT'
compileOnly group: 'dev.simplix', name: 'protocolize-api', version: '2.0.1'
implementation group: 'org.bstats', name: 'bstats-bungeecord', version: '2.2.1'
}
}
This is my current code and bungeecord-api doesn 't seem to provide me the plugin* stuff
feel free to tag me š
I want to send an embed message to a discord server from spigot plugin, how can I achieve that?
you'd need a discord bot aswell
or a webhook
Oh, so you need to actually host it 24/7?
With webhook you don't need to do that right
i mean if you just want to send a message you could start it up when you want to send the message
im not too familiar with webhooks sorry, but if you just want to send messages any nothing else its probably your best option over bots
and i should use JDA?
thats what i use for bots, not sure on webhooks though
I believe JDA works with webhooks?
cant see webhooks mentioned in it's github
You can see.
Have any of you guys used this before?
Do I need to close the client after using it? just like sql database.
i would say very often
probably a good idea to do it async and closing on disable i reckon
what about enhanced try/catch
the
try(WebhookClient client = WebhookClient.withUrl(ConfigValue.WEBHOOK_URL)){
}
Can anyone figure out the issue with my plugin not loading? https://paste.md-5.net/dutajunora.cpp
thats why i recommend async
If I want a list of players, wouldn't it be better to use their UUID instead of just saving Player?
if the thread dies, the server wont die with it
yes
keeping a reference to player can cause mem leaks
ofc i'll use async
do you have an error trace with it?
11.11 12:52:09 [Server] ERROR Could not load 'plugins/DeadManWeapons.jar' in folder 'plugins'
11.11 12:52:09 [Server] INFO org.bukkit.plugin.InvalidDescriptionException: commands are of wrong type
oh your commands seciton isn't indented correctly
commands:
dmkit:
description: "Command kit"
usage: /dmkit
should be
commands:
dmkit:
description: "Command kit"
usage: /dmkit
how can i make on a TextComponent click send the player messages
I'm needing help with the PluginMessageChannel as I don't know what I need to have because my tests failed consistently. I have the channel registered in both Bungee and Spigot side plugins. I don't get the Receiver to work (I know this because I set a breakpoint in IntelliJ and started in debug mode)
Bungee Side Plugin is just registering the channel. The Spigot Plugin has the Sender and Receiver. Code below.
You don't need to make and send some functioning code but I'm not getting how you arrange it so it works. (to be honest, the documentation is very unclear or I'm too dumb to get it)
I'm just desperate because I tested for whole 2 days now.
public class Sender {
Ā Ā public Sender(String test) {
Ā Ā Ā Ā ByteArrayDataOutput out = ByteStreams.newDataOutput();
Ā Ā Ā Ā out.writeUTF("Forward"); // So BungeeCord knows to forward it
Ā Ā Ā Ā out.writeUTF("ALL");
Ā Ā Ā Ā out.writeUTF("winner:broadcast"); // The channel name to check if this your data
Ā Ā Ā Ā ByteArrayOutputStream msgbytes = new ByteArrayOutputStream();
Ā Ā Ā Ā DataOutputStream msgout = new DataOutputStream(msgbytes);
Ā Ā Ā Ā try {
Ā Ā Ā Ā Ā Ā msgout.writeUTF(test); // You can do anything you want with msgout
Ā Ā Ā Ā } catch (IOException exception){
Ā Ā Ā Ā Ā Ā exception.printStackTrace();
Ā Ā Ā Ā }
Ā Ā Ā Ā byte[] msgbytes_bytearray = msgbytes.toByteArray();
Ā Ā Ā Ā out.writeShort(msgbytes_bytearray.length);
Ā Ā Ā Ā out.write(msgbytes_bytearray);
Ā Ā }
}```
```java
public class Receiver implements PluginMessageListener {
Ā Ā @Override
Ā Ā public void onPluginMessageReceived(@NotNull String channel, @NotNull Player player, @NotNull byte[] message) {
Ā Ā Ā Ā ByteArrayDataInput in = ByteStreams.newDataInput(message);
// Ā Ā Ā Ā if (channel == "winner:broadcast") {
Ā Ā Ā Ā Ā Ā String test = message.toString();
Ā Ā Ā Ā Ā Ā String test2 = in.readUTF();
Ā Ā Ā Ā Ā Ā WinnerBroadcastBukkit.plugin.getLogger().info(test);
Ā Ā Ā Ā Ā Ā WinnerBroadcastBukkit.plugin.getLogger().info(test2);
Ā Ā }
}
I got CNF exception for some reason. https://paste.md-5.net/ozejefuwut.bash
Worldguard
Why tf 1.7
Did you shade it?
Why wouldn't you need to shade it?
cuz the github page didn't tell me to do so
Hello!
Do you know if there's a way to do a loop every second in a bukkit/bungee scheduler?
Thanks
like, thats what you do by default
?scheduling
wdym?
How would classes exist in classpath if you didnt shade them? Magically came out of nowhere?
Well, can you explain why i can use spigot-api even tho i didn't shade it?
Because Spigot loads your plugin which means Spigot is in the classpath
spigot is provided
no, like if i make a countdown and that i want to send a message every second before the timer ends, what should I do ?
Read the wiki page
How do i send all the strings from a list in the config to a player?
You loop the list and send the message
Uhm im really new to spigot i dont know how to do that :c
Java or Spigot?
Spigot
What part do you need help with? Loading and reading the config?
i do not find any element talking about that in the wiki
Wdym? It tells you how to schedule a self cancelling task?
So i have this list in my config
Foodlist:
- 'Line1'
- 'Line2'
- 'Line3'
- 'Line4'
And i want to send all the strings to a player
declaration: package: org.bukkit.configuration, class: MemorySection
Yeah but i don't know how to use that
your configuration has that method
get...List()
getConfig().getStringList("Foodlist")
Yes i understand that but how do i send all the strings in the list to a player
i'd call it foodies
use a stringbuilder?
?learnjava
Here are some links to get you started on learning Java:
- https://www.codecademy.com/learn/learn-java
- https://www.sololearn.com/learning/1068
- https://www.learnjavaonline.org/
- https://programmingbydoing.com/
- https://docs.oracle.com/javase/tutorial/java/index.html
The last one is the only official one, however some of those concepts assume that you already know a bit about programming.
I don't know how to do that
then follow ciphers learn java links
You told me you knew Java 

I thought you meant if i was coding In java or with spigot
would it be logic to join the chatchannel when i set it as main channel?
You don't code with Spigot. Spigot is a library, Java is the language
I mean, that's kind of a technicality.
"Coding in <language>" is also deemed improper, but nobody cares because it's a common phrase.
Anyone has a clue how to obfuscate my code? I'm not that known with cryptography sooo.
Cryptography != obfuscation.
obfuscation uses crypto tho
No it does not.
well.. no clue myself hence why I'm asking.
You can use an obfuscator like ProGuard.
and it works with plugins? dope..
Yeah it works with all Java projects.
Well, maybe not all, there's probably like a few odd edge-cases, but you get the point.
Why do you need obfuscation? It wouldnt save your plugin from cracking and it would make stacktraces unreadable
Manya is right on that front.
dont
Obfuscation does practically nothing against leaks or cracks.
like, whats the point of it then
If you sent me the obfuscated version of your plugin, I could deobfuscate it in just a day.
or hide malicious code
minimizing maybe?
That sounds more reasonable
thats why im against obfuscating
and spigot should make obfuscation rules more strict
or just deny obfuscation
oh i remember obfuscation drama
And because of that, it really only works on large codebases, where you have so many fucking classes that it's hard to deobfuscate everything lol.
in reply to this
well, minecraft is that big. Even this didnt stop people