#help-development
1 messages · Page 143 of 1
lmao
i'm aware but i check that?..
yea
how do I do that
I think you just scan the package at runtime
its a bit tricky since you gotta remember, classes load and unload during the server's lifetime
huh I see. sorry, I usually just reply with the first thing I see in the stacktrace because in 99% of cases, this is already enough. Your code looks actually fine to me
hm ok
(btw if anyone is interested I've tested it and it returns a temporary value, you'll have to wrap the Vector#add return value in a Entity#setVelocity)
@vocal cloud didnt you have some method for it?
I also have no idea where it comes from
what happens if you split up your stream into different lines, so we can see where it actually comes from?
i think the issue might be that the mvn deploy command isn't working correctly, or intellij is getting an older version of the dependency
because this is a dependency i'm using for my server
but my plugin that uses the dependency is throwing the error
you should always run mvn clean before deploying again
Does anyone know how to set up the auto fill for commands with multiple "arg paths" in the plugin yaml file?
e.g.
/command set (autofill 1)
/samecommand load (autofill 2)
i do that
if you changed dependencies
instead of sharing autofill options for both first args
dont think thats possible
but you can use getCommand("name").setUsage() iirc
oh no!
had to connect the iphone to tether now
are the wounds bad?
fuck vodaphone
how did you even survive!?!?
yeah I'm still having tears in my face haha
I wouldnt wish "no internet" to my worst enemies
yea its just completely sucky to have no internet lmao
one of the reasons i have different providers for my phone/house
ikr, PC is instantly useless without network lol
so. whats the score on the dino game then
@tender shard it wont load now
the library is not present
what does that mean
it prolly should have been shaded into your plugin right?
uh ig
well looks like it did not
hmm
how did you compile?
you have to use maven to compile
you probably used intellij's build feature
uh I think so but tbh idk what compile means
double tap ctrl & type mvn clean package
do NOT use intelliJs build feature
or that
it's double shift IIRC
huh
liar!
oh
you're right
I didnt know about the double ctrl thing
I only knew about double shift
so I just need to click package
now you do 🙂
thanks 😄
did I do something wrong?
double click
and then copy over the .jar file to your server
;-;
yea
I host my server on a vm so I have to send it to myself through teams and copy it on the vm cus it wont let me copy over ;-;
huh
eh dw abt it
i mean. the vm runs on your pc no?
oh
way faster that my pc but the servers default os is vmware so I cant use it to do everything else I do
cant u just connect usin ftp?
I cant find package
well it's in the maven tab, usually upper right corner
but you can also do what Epic suggested and hit ctrl twice quickly and just enter "mvn clean package" there
I just used ctrl 2x
kk
and it finished with exit code 0
did it say "BUILD SUCCESS" at the bottom?
then it worked. now go to "your project folder/target/" and you will have a file called "YourPluginName-1.0.0.jar" or sth
use that
oh so I dont use the out/artifacts one
ok well now I have 2
how are they called?
in 99% of cases, the top one is the correct one
the "original-..." one is without the shaded stuff, so it wouldnt work
k xD
:3
the "original" one is basically what intelliJ would have made itself
while the other one includes all those nice additional maven things lol
how would i find the closest place inside the world border?
a math question D:
basically you can just check if currentX > worldBorderX, if yes, set currentX to worldBorderX
same for Z
and then you go
or ofc < if you're below 0,0
I might be wrong but I think this should work
e.g. if your worldboarder is set to 50, and your current X is 60 and current Z is 40, then the closest point should be 50|40 I guess
I might also be completely wrong
I have another error
@tender shard
hello?
@tender shard can you help me make it work?
still hitting him just to update you
also thanks guys i didnt see that part of the entity.damage
lol
;-;
please no random pings
show your command's method signature, or at least the full stacktrace
have you tried googling your problem?
nah
try that
nah
that looks like a very googleable question
bunnygirlkiss ❤️
nah
hm I actually dont thin soo haha
anyway, it looks you do so some method like this
@Default
public void myCommand(CommandSender sender, Command command, String alias, String[] args)
while obviously this wont work in ACF
whats line 30 of your main class?
it's probably where you do registerCommand(...)
acf.registerCommand(new GMC());
How do I bypass task code? resetting task time?
wdym
public void run() {
if (Main.fortune.isEmpty() && Main.efficiency.isEmpty()){
Bukkit.getConsoleSender().sendMessage("§cEmpty");
//Bypass task code and reset task time
return;
}
Main.fortune.forEach((key, value) -> {
PreparedStatement stm = null;
try {
stm = connection.prepareStatement("INSERT OR REPLACE INTO alphamining (playeruuid, efficiency, fortune) VALUES(?, ?, ?);");
stm.setString(1, key.toString());
stm.setInt(2, Main.efficiency.get((UUID) key));
stm.setInt(3, value);
i.getAndIncrement();
} catch (SQLException e) {
Bukkit.getConsoleSender().sendMessage("§cError to player " + key.toString());
e.printStackTrace();
}
});
Bukkit.getConsoleSender().sendMessage("§aSave §f" + i + " §ajogadores");
}
}).runTaskTimerAsynchronously(Main.instance, 0L, 18000L);
I try return, but dont work
your method should ONLY take a "Player" object, nothing else
@Default
public void onCommand(Player player) {
...
}
you dont need any Command object, ACF doesnt use those
and the other stuff is also not needed
ah ok
and you forgot to @CommandAlias your whole class
you should have @CommandAlias("gmc") at the top of your class
do I need that
yes, it tells ACF the name of that command
ah ok
ACF only works with annotations, it doesnt need anything in plugin.yml etc
you can also get rid of your permissions check by just doing @CommandPermission("coolplugin.command")
ok
and that's why ACF is so much better than spigot commands 😄
you don't have to check if a player is a player, you don't have to care about permissions, you dont have to care about what they entered as args, you can just let ACF handle all this
oh and ofc you can also ignore all the "commands: ..." thing in plugin.yml, also not needed anymore now
Am I just too smart? p.openInventory(p.getInventory());
help?
what is the problem?
im using player.getMaxHealth() and im getting a warning... is there anything wrong with using that?
how would i "throw" a armor stand
uhh
aka set the velocity to where the eye of the player is?
I have a task and I want that when a condition is true, it doesn't execute the code but resets the task's time and only executes when the condition is false, I use task.cancel(), is that it?
Well you could make a boolean function and then decide when to return true or false
iirc the suggested way is to use Attributes now
and what's the warning?
@Override
public void show(Player player, World world, double x, double z, double size) {
WorldBorder worldBorder = new WorldBorder();
worldBorder.world = ((CraftWorld) world).getHandle();
worldBorder.setCenter(x, z);
worldBorder.setSize(size);
worldBorder.setDamageAmount(0);
worldBorder.setWarningDistance(0);
((CraftPlayer) player).getHandle().b.sendPacket(new ClientboundInitializeBorderPacket(worldBorder));
}
@Override
public void hide(Player player, World world) {
WorldBorder worldBorder = new WorldBorder();
worldBorder.world = ((CraftWorld) world).getHandle();
((CraftPlayer) player).getHandle().b.sendPacket(new ClientboundSetBorderLerpSizePacket(worldBorder));
}
Is there a way to do this in 1.19+ w/o needing packets?
the worldborder thing? yes
that was added recently
there is now a "per player" worldborder api
I think it was added in 1.19 or 1.18
player.sendWorldBorder or sth like that @vagrant stratus
Courtesy of yours truly 
Fuck yea, I can actually update this plugin and post it lmao
Anyone here knows about BuildTools and NMS 1.19.2
Bukkit#createWorldBorder(), edit it to your liking, then yeah, Player#setWorldBorder()
post the full error you got
?paste
you can paste it here ^
Hello, I wanted to cache 3 values (player, a, b) but as ArrayList only supports 2 values, I did:
ArrayList<player,a> and ArrayList<player,b> is there an easier and more practical way to do this?
I just get the
either create your own custom object for this, or use a Tuple
e.g. you can create an ArrayList<UUID,Pair<FirstClass,SecondClass>>
This when I run buildtools
[WARNING] The requested profile "remapped" could not be activated because it does not exist
and this when I reload my dependency Unresolved dependency: 'org.spigotmc:spigot🫙1.19.2-R0.1-SNAPSHOT'
you shouldnt use Player as index but rather their UUIDs
please paste the FULL error
It is the FULL error
Also no @untold jewel I'm not.
Learning Ukrainian though
so why would you have that in your discord bio
I doubt that, BuildTools usually prints out a thousand lines of debug output
Because I support Ukraine, duh
oh yeah duh u support them from behind the screen lmao
Will double check ty
just give me a second
sure
How do I replicate the worldBorder.world = ((CraftWorld) world).getHandle(); part @worldly ingot ?
This is per-world lol
whut
Money is also an option 😉
@Override
public void show(Player player, World world, double x, double z, double size) {
WorldBorder worldBorder = new WorldBorder();
worldBorder.world = ((CraftWorld) world).getHandle();
worldBorder.setCenter(x, z);
worldBorder.setSize(size);
worldBorder.setDamageAmount(0);
worldBorder.setWarningDistance(0);
I'm trying to get rid of NMS, but the API doesn't support the full functionality lmao
import net.minecraft.server.v1_10_R1.WorldBorder;
1.10 for example imports this
could you copy paste the exact command I need to use in Gitbash
Worlds aren't at all relevant for client-sided world borders
Because it applies to whatever world the player is in
use Bukkit.createWorldBorder() and not new WorldBorder();
Yes, I know this
I was showing the plugins code while asking how to replicate lmao
did you even switch the spigot dependency to 1.19+? looks like you have an outdated spigot version that doesnt have this yet, so it tries to import the NMS or craftbukkit worldborder class instead
And then how do I do a for each getting all the player values?
I'm updating a plugin to 1.19, hence the original question lmao
sorry I dont really understand this question. You can just do .get(myPlayer.getUniqueId()) on the map?
WorldBorder worldBorder = new WorldBorder();
worldBorder.world = ((CraftWorld) world).getHandle();
PacketPlayOutWorldBorder packetPlayOutWorldBorder = new PacketPlayOutWorldBorder(worldBorder, PacketPlayOutWorldBorder.EnumWorldBorderAction.LERP_SIZE);
((CraftPlayer) player).getHandle().playerConnection.sendPacket(packetPlayOutWorldBorder);
player.setWorldBorder(world.getWorldBorder()) Ig would be the replacement?
you can get rid of ALL those Border classes and use the builtin one
hm I dont really understand your question
/*
@Override
public void hide(Player player, World world) {
WorldBorder worldBorder = new WorldBorder();
worldBorder.world = ((CraftWorld) world).getHandle();
PacketPlayOutWorldBorder packetPlayOutWorldBorder = new PacketPlayOutWorldBorder(worldBorder, PacketPlayOutWorldBorder.EnumWorldBorderAction.LERP_SIZE);
((CraftPlayer) player).getHandle().playerConnection.sendPacket(packetPlayOutWorldBorder);
}
*/
The original question was if NMS had an API impl in 1.19+ @tender shard
So I could ya know, get rid of all this stupid NMS shit
WorldBorder border = Bukkit.createWorldBorder();
player.setWorldBorder(border);
// then somewhere else
player.getWorldBorder().setSize(100, 100, 10);```
or whatever the methods are
Yea, I know that lmao
and I told you "yes, just do Bukkit.createWorldBorder", basically the same as choco said above
You can edit that WorldBorder as much as you'd like. It will update all players that have it set
This is specifically for "hiding" it, not showing it.
so ig using the worlds own border is good enough
To hide it, set it to null
It will throw an exception if you set it to the world's world border iirc
ah
public class Border {
public void show(Player player, World world, double x, double z, double size) {
WorldBorder worldBorder = Bukkit.createWorldBorder();
worldBorder.setCenter(x, z);
worldBorder.setSize(size);
worldBorder.setDamageAmount(0);
worldBorder.setWarningDistance(0);
player.setWorldBorder(worldBorder);
}
public void hide(Player player, World world) {
player.setWorldBorder(null);
}
}
oh hey look, more maintainable code base

Now to finish the code clean up and then release this fork lmao
Are uuid's serializeable?
JSON
Well, you can just stringify it
fromString() ;p
same diff
what would be the best method to get all args after the first 2
;p
reee uses dynmap and shit
Good ole for loop and a StringJoiner 
Loop through the args until there are no more and having your starting index 1
StringJoiner message = new StringJoiner(" ");
for (int i = 2; i < args.length; i++) {
message.append(args[i]); // It might not actually be append(). It might be add()
}```
StringBuilder sad noises
thanks
Joiner puts the spaces in there for you automatically and you don't have to deal with trailing/leading whitespace lol
Oh I thought you were gonna do
String message = "";
if (args.length > 2) {
message += args[2] + " ";
}
if (args.length > 3) {
message += args[3] + " ";
}
if (args.length > 4) {
message += args[4] + " ";
}
if (args.length > 5) {
message += args[5] + " ";
}
// etc...```
LOL
THAT'S the old fashion way 
Thats the soft brain way
I feel like args[args.length-1] unti it == 0 is the most based approach
no
then reverse the list
you gotta do that yourself
UUID.toString() and UUID.fromString
jkjk ty
it's because UUIDs are part of normal java
can you pr to java
probably not to the oracle one lol
or do i need to send them a strongly worded letter
wait gson is included in spigot?!
tehen
im using json
yes
not yaml
based bet
gson should handle it just fine
wtf today I talked to people about what "based" and what "Bet" means
and now you use both in the same sentence
I'm based
oooh you bet I am

YOUR MUM'S BASED
iirc both spellings are fine. but what do I know about the english language ¯_(ツ)_/¯
nuhthing
as a man who's both dyslexic and cant spell, your mum is improper form
bc its not masculine
or plural
but mine is 
and that's why I love her ❤️
based
lol best conversation today
honestly lmao
Am I able to make my own Logger
i dont like the bukkit one
or would I have to make my own fork
but yeah anyway, haha. UUIDs should work fine when tossed into Gson
sweet
sure
you can even replace the original one
I CAN
I mean you can create a new Logger instance if you want via the LoggerFactory
LES GO
But I don't know why you would want to
How do i replace the original one
Your plugin's logger is associated with your plugin, and it should stay that way
there are 2 ways:
Plugin authors that do that should be crucified
guess im the next jesus 
did you see what luck perms did with their loading message
its mfing massive
- Completely replace the original bukkit logger, and every plugin ones, with reflection (bad idea)
- attach a custom filter to your own logger or to the bukkit one, while ignoring other plugins (better idea, but still not a very good idea)
in fact you should not change bukkit's original logger at all
I mean why would you want to change it?
Reflection sounds like a great idea
color
yeah okay if you only do it for yourself, then go for it
i hate myself already its fineeeee
time to learn more reflection
all I can do is unprivate fields lol
just setAccessible(true) them, and yuo are free to change their values to whatever you want
mfnalex I am using the acf cmds now and I have some problems, I have a cmd that I need it to stop at a certain point in the code if an if statement is true and I can no longer do that cus there is no return true; with acf so how do I do that?
you can even replace the whole Bukkit.getServer() object
return a bungee server instead of a spigot one
mess with every plugin
Class bukkitClazz = Bukkit.class;
Field serverField = bukkitClazz.getDeclaredField("server");
serverField.setAccessible(true);
serverField.set(null, myNewBukkitServerObject);
no problem
but very stupid
can u help me?
just not return anything?
just do return;
instead of return false;
ofc
oh ok
Feels nice to get rid of XSeries classes too lmao
I'm getting rid of it because I support latest version only, don't need it lol
are you making your own fork
Ye
y
The plugin I'm forking supports up to 1.17 and not higher because nms lmao
I only go for 1.16+ when I do plugins and that's basically 95% of people who buy anything on spigot
I have a plugin on spigot that uses NMS as is, it's dead specifically because I don't want to touch nms lol
What are the main things ppl use NMS for
NMS is indeed a huge pain but it got way better since 1.17
sending action bar messages haha
api should add that thennnnnn
Things they're too lazy to PR API to Bukkit
The plugin uses pathfinding & custom entities lol
it's been added YEARS ago
Spigot can send action bar messages
then why do you use NMS?!?!
outdated versions
I'd send my messages quicker but my internet is so shit that they literally send 30 seconds after I press enter
I thought you asked about why OTHER people use NMS
.-.
I use NMS for stuff like... sending toast messages, or send totem animations per player, ... stuff like that
make your own api
only to everyone, not per player IIRC
we talked about this a few months ago
why wouldn't you be able to send them to only a player
do you mean only the player able to see it and not any spectators?
idk but I tried it in 1.18 I think and there, every player could see it
oh lol
import net.minecraft.world.entity.EntityInsentient;
import net.minecraft.world.entity.ai.goal.PathfinderGoal;
import net.minecraft.world.entity.ai.goal.PathfinderGoalLookAtPlayer;
import net.minecraft.world.entity.ai.goal.PathfinderGoalRandomLookaround;
import net.minecraft.world.entity.ai.goal.PathfinderGoalRandomStrollLand;
import net.minecraft.world.entity.ai.goal.PathfinderGoalSelector;
import net.minecraft.world.entity.monster.EntityGiantZombie;
import net.minecraft.world.entity.monster.EntityMonster;
import net.minecraft.world.entity.player.EntityHuman;
pain
then u need nms
when will java hav import variables
I literally can't even load a website to check whether or not I'm correct
n e v e r
This is pathetic lol
https://github.com/JEFF-Media-GbR/JeffLib/tree/master/spigot_1_19_2_R1 this is what I use NMS for
it includes all the NMS code I ever wrote lol
choco gib pathfinding & customentity api plz
JeffLib has a pathfinding api 😛
ew no
yes
my prs are immaculate
and litterally do nothing helpful
🆒
Even then, can it even simplify this entire plugin lol
removing XMaterial might of been a mistake
LOL
Yeah it's an entity effect, alex. https://hub.spigotmc.org/javadocs/spigot/org/bukkit/EntityEffect.html#TOTEM_RESURRECT
XMaterial is the goat
but everyone sees it
Player#playEffect() should support it
no
IIRC I tried that and everyone was able to see it
I might be wrong though
I am wrong very often
I am very good in being wrong
most are now gone lol
Looks like EntityEffect isn't even used anywhere
You can't send them. Unless I'm blind
useless api that should be removed then????
haha I love spigot sometimes
No, just needs to have a way to send 'em
send them then lol
have you ever went outside, trying to tame a cat and it failed? well spigot even has an enum for that lol
as expected
https://pastebin.com/iJJBUvKP picture is from ClickListener.java, anyone know the issue?
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
you have some Vehicle that doesn't have any name
Hey @worldly ingot if I create a program that removes all legacy code and updates it to be modern, do you think md would finally kill off backwards compat?
getVehicleConfig(fileName).getString(slot) is returning null
I guess this will never happen
Doubtful
fuck
I'll do it anyways just re-up everything ever lmao
also ooo no more errors, nice
now that I think about it, I wonder what it would take for him to remove it all 🤔
mfnalex I did all of this and I got the new commands and the one goal I had was to make it not case sensitive and it's still case sensitive
probably a working alternative to existing ChatColor stuff 😄
literally did nothing
Doubt
there is, as of today, not any proper alternative buitin to spigot to have configurable messages except "&cYeah This Is Red"
I bet 50€ that "&cred text" will still work with regular spigot in 5 years
I mean what would it be replaced with?
json messages? probably not, they are too nasty for normal admins
minimessage would be a good idea but paper features never got any upstream PRs
so is there a way to make it not case sensitive with these now mfnalex?
sorry but I also have a live, I cannot always reply to anyone here just because I tried to help before
Yes, it's not nice to always ask specifically me. There are many people here who can help 🙂
yea well u were helping me didnt expect u to quit
so is there anyone that wants to help me make my commands not case sensitive
it's totally fine, just ask your question without mentioning me the whole time. If the AsyncPlayerChatEvent didnt work, then maybe try to listen to the PlayerCommandPreprocessEvent instead and change the message there
I have no idea whether this will work
it might work, but I cannot promise it lol
I didnt use asyncplayerchatevent
huh but that's what I suggested earlier
I thought u said that if I got this acf it would not be case sensitive
ooooh no
I think we had a misunderstanding
ima use preprocess event so I dont have to see if the first character is /
or maybe I expressed myself not good enough
yeah, try that, and if it doesnt work, ask again here, but pls don'T always mention me 😛
k
the PlayerCommandPreprocessEvent should work fine for your usecases
I just read the docs and they say that changes to the message get "respected" by the server before trying to execute anything
so yeah, it should work
otherwise itd fuck up stuff like /msg etc
sth like this would do
@EventHandler
public void onCommand(AsyncPlayerChatEvent event) {
String message = event.getMessage();
if(!message.startsWith("/")) return;
String split[] = message.split(" ");
split[0] = split[0].toLowerCase();
event.setMessage(String.join(" ", split));
}
You only gotta switch to the other event and remove the "startsWith("/")" part
that's what I sent you 2 hours ago or so
or 4 hours, idk lol
lmao
wow I was really a bit stupid like 4 years ago haha
how would I go about using PlayerInteractEvent to listen for if a player right click, holds it, and then also clicks left click
Would I need to have a Map containing the data for a few seconds or could I do it in the method itself
fwiw, that's actually the correct use of Objects#requireNonNull()
There are some that will use it thinking it just fixes NPEs
Failed to execute goal org.apache.maven.plugins:maven-shade-plugin:3.2.4:shade (default) on project LoginSecurity: Error creating shaded jar: Problem shading JAR LoginSecurity\target\LoginSecurity-3.3.jar entry com/lenis0012/bukkit/loginsecurity/commands/CommandAdmin.class: java.lang.IllegalArgumentException: Unsupported class file major version 60
nice. Not a damn clue why that doesn't compile if I bump the java version up lmao
Said class is even in the project that's being compiled, like bruh
whats the @SupressWarning for something might not be initialized. Or is this an intellij thing that theres a setting for
if statement
How would i "throw" an armor stand
Aka set the velocity to the players eye
Im not smart, i set it to the location of the players eye but doesn't move, because its already there
is it possible to change plugin version onLoad?
Just change it in your plugin.yml?
I mean is it possible to change with code?
don't believe so
^
why would you want to do that
In the method
I use commandpreprocess event and it works perfect for blocking commands, i set what i want blocking in config so it can be anything not just /
Any idea how I can do it then?
Yeah, check for itemstack, check to make sure its not null or air and then check for action, left click air, block, right click air block
What do you mean by holds it?
I’m one of those people
trying to make it so my gui lists the options in the order i did in a yaml but its ordering it alphabetically, can anyone help?
i figured out why its alphabetical
its cuz of the arraylist
its cuz of collections.sort()
but how do i sort it in a custom way?
rather than alphabetical
If you are putting the config items in a list, it should preserve the order. If you perform any other form of sorting on it, the default approach is to use the natural ordering, which in most cases is alphabetical. If you want a custom sort, you're gonna have to find certain criteria to compare against. Otherwise, just loop over your config sections and put them in a list.
using reflection, probably, but why?
it was alphabetical for the reason i said above
when it was removed it became randomly ordered
sorry how do i do that?
not too experienced at this stuff
Hey I'm using 7smile7s plugin messager callback util as a fork in my project https://github.com/KyTDK/NeoUtils/blob/master/api/src/main/java/com/neomechanical/neoutils/bungeecord/SendAndReceive.java
I'm using the callback result to complete a future
however, I am not getting the results intended
I'm using https://github.com/KyTDK/NeoUtils/blob/master/api/src/main/java/com/neomechanical/neoutils/bungeecord/BungeeCordUtils.java playercount but its returning numbers like 565765
Just wondering if anyone can see what I did wrong
Make a class and implement Comparator<YourObject> and its method
then make a new instance of it and pass it to the sort method.
or, you can use a lambda instead. Like so list.sort((o1,o2) -> /*code*/);
Guys, I have a HashBasedTable with these values: Int priority, UUID player, String server.
How do you think I can make it so that when a player exits the queue, all the priority numbers scale? Do I have to do a foreach? Is there any easier way?
is anyone able to give me some feedback on my Minigame library? i'm thinking about improving it, but i don't know where to start
I'd just use a LinkedList with a ServerInfo object that holds player uuid and target server
HashBasedTable is not the ideal structure
You made me fall in love with them two days ago :c
hmm
?paste
Can you take a look https://paste.md-5.net/acasatixiw.coffeescript
But at this point, isn't a linkedhashmap better?
LinkedHashMap<String, ProxiedPlayer>
You could try using custommodeldata, you can get it from Itemsadder with /iacustommodeldata itemsadder:yourItem
then ItemStack stack = new ItemStack(Material.{youritemsadderMaterial});
and stackMeta.setCustomModelData({YourValue})
Illusion?
A LinkedList would be better for queues
I guess you could use a linked map if you want a queue per server
But I don't really see the need as you'd put like a Map<String, List<ConnectionInfo>>
Basically each server needs to have a Queue<ConnectionInfo>
where ConnectionInfo is a data object {playerId, targetServer}
A Queue can either be like a PriorityQueue or a LinkedList
I'm doing this;
```java
for(String server : ProxyServer.getInstance().getServers().keySet()) {
if(!plugin.getManager().getQueues().containsKey(server)) {
return;
}```
or some other impl
using LinkedHashmap
obv
continue
ouch
otherwise you gonna brick your code
thank you
I just understood what you mean, if there are multiple players for different servers, I can't do in the same hash as I couldn't get the priority
I would need an Hashmap<String, LinkedList<ServerInfo>>
what is queue
fancy list
Hi, i wanna create a queue to my bases plugin so it doesn't build while queue is more than X number
hmhum
Now I'm doing it with an arraylist, but it doesn't work as well as I thought
Humh, I would need to create a Map<ServerInfo (ServerName), LinkedList<ConnectionInfo)>> for each server, right?
What was the intellij plugin you can zoom code screen 😃
out of topic but
Glasses 2.0
I swear, Im trying to figure it out in every way but so far I only understand that I'm hungry
do I need a one for each server?
@green prism Thank you so much. I handled it 🧡
🍗 👍🏻
does this work?
if(!(object instanceof Player player)) return;
Player.sendMessage("Found you");
Why wouldn't it work
Just player instead of Player
And assuming object can be instance of Player
i assumed the scope might be limited to the {} of the if
If the second Player is lowercased to match the variable then yes. It does work
Does anyone know how to register an Aikar commandframework's command?
ACF? Yes
how
Get the CommandManager and register a new BaseCommand
There is actually a documentation for that
Command: https://pastebin.com/qe2WTWdZ
Main: https://pastebin.com/x5vjL7x0
I did it
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
but it is not working
You did not create a BukkitCommandManager
what\
Then you've learned something new 🙂
@Override
public void onEnable() {
BukkitCommandManager commandManager = new BukkitCommandManager(this);
commandManager.registerCommand(new YourBaseCommand());
}
hum
Just like in the documentation
So it should work now?
I dont know what changes you made so i cant give an answer to that.
BungeeCommandManager bungeeCommandManager = new BungeeCommandManager(this);
bungeeCommandManager.registerCommand(new QueueCommand(this));
Are you writing a BungeeCord plugin?
clean code is the best code
obv
Then this works

?paste
Runnable isnt starting?
https://paste.md-5.net/avihexajox.cpp
@Override
public void onEnable() {
adventure = BungeeAudiences.create(this);
this.manager = new Manager();
new JoinTask(this);
new QuitListener(this);
BungeeCommandManager bungeeCommandManager = new BungeeCommandManager(this);
bungeeCommandManager.registerCommand(new QueueCommand(this));
}```
help?
What is the best anti vpn plugin? Is there any premium one?
Usually you should get a 3rd party proxy for that
Can i dm you?
Nope
Can you help me?
Thank you!
Whats the issue?
y
Just creating an instance of a Runnable doesnt do anything.
You need to schedule the runnable.
https://paste.md-5.net/uqicivogup.xml <-- part of pom.xml. Seems like maven can't find the api. Anyone knows a fix? Or should I manually import it?
Look at the runnable class's constructor
Why do you need craftbukkit as a raw dependency?
I imported source code for a PL and its like this
You need to run buildtools
Does the "JoinTask" get printed?
Btw getMaxPlayers will almost always return -1
why?
what should I do
CompletableFuture
What?
If you can spare the overhead of the ping then you can simply use a Lock
that is good
we are gigachad because we are boosting
look at these non-boosters
so cringe
ok?
Here is the blocking fix
public int getMaxPlayers(String server) {
AtomicInteger max = new AtomicInteger(-1);
CountDownLatch latch = new CountDownLatch(1);
ProxyServer.getInstance().getServerInfo(server).ping(((result, error) -> {
if(error == null) {
max.set(result.getPlayers().getMax());
}
latch.countDown();
}));
latch.await();
return max.get();
}
whats the normal minecraft sound float?
1.0F
thank you!
For both pitch and volume
So, what can I do about that?
It prints only once... It doesn't loop
Add more debug messages and see where your logic is messed up
wouldn’t that freeze the main thread until it’s done unless ran async?
I’ve never seen countdownlatch before
Bungeecord doesnt have a strong notion of a main thread
alr cool
Yes this freezes the current thread. But Bungeecord is multithreaded
fairs
Still not a preferable approach. Delegating the callback is cleaner. More reactive.
I already ran it and I have the files on my macbook. But I think its trying to download it from a URL.
CountDownLatch is a class that has a countdown, any thread that isnt awaiting it through await() can count its countdown down, once the countdown hits 0 all awaiting threads get released
@floral drum
You need to run BuildTools
I already did
You could achieve the same with a ReentrantLock but i like latches a bit more.
Latch here is better Id say
How?
Since you’re never really using the reentrant mechanics from RLock anyway
The home of Spigot a high performance, no lag customized CraftBukkit Minecraft server API, and BungeeCord, the cloud server proxy.
Does an item's pdc pass when we put it as a block
Nope
Also not every Block has a pdc. Only TileStates
https://github.com/JEFF-Media-GbR/CustomBlockData might be of use here
But be careful with that. The size of a chunk file is quite limited so storing data for too many blocks is not advisable.
People are even able to softlock chunks with data loaded chests and signs
purple you alright?
smile is 14
Hmm, thought that used to be just back in the days
ah okay
im 15 
hey hey hey thats racist
sorry father :sob
They fixed it by filtering the data before it gets saved. But the size limit still prevails iirc.
Its much higher because chunks can now hold up to 2048 blocks in height but still present.
I think this is worth testing out

@lost matrix it doesn't work.
It repeat once and doesn't loop at all
I think you use the wrong schedule method
so, whats the correct one?
can't find nothing useful on the world wide web
There you go. You are missing a second long value.
Given those methods are named a bit stupidly.
Running a test. Lets see if there is any issue.
pop off king
Looks like there is a fallback mechanism for saving oversized chunks if i interpret this message correctly.
smart
Smile is hella smart
I’m trying to make it easier for me to send messages to players without having to type out chatColor and any repeated words but I keep getting this error and I am not sure why
@EventHandler
public void onMove(PlayerMoveEvent e) {
Player p = e.getPlayer();
if (isOutsideOfBorder(e.getTo())) {
p.sendMessage(ChatColor.RED + "You may not go past the world border!");
e.setTo(closestPlaceWithinBorder(e.getTo()));
}
}
public Location closestPlaceWithinBorder(Location loc) {
Location finalLoc = loc.clone();
double size = Objects.requireNonNull(loc.getWorld()).getWorldBorder().getSize();
if (loc.getX() >= size / 2) {
finalLoc.setX((size / 2) + 1);
} else if (loc.getX() <= (size / 2) * -1) {
finalLoc.setX(((size / 2) * -1) - 1);
}
if (loc.getZ() >= size / 2) {
finalLoc.setZ((size / 2) + 1);
} else if (loc.getZ() <= (size / 2) * -1) {
finalLoc.setZ(((size / 2) * -1) - 1);
}
finalLoc.setY(finalLoc.getWorld().getHighestBlockYAt(finalLoc) + 1);
return finalLoc;
}
public boolean isOutsideOfBorder(Location loc) {
WorldBorder border = Objects.requireNonNull(loc.getWorld()).getWorldBorder();
double size = border.getSize()/2;
Location center = border.getCenter();
double x = loc.getX() - center.getX(), z = loc.getZ() - center.getZ();
return ((x > size || (-x) > size) || (z > size || (-z) > size));
}```
this only works like 1% of the time
the rest it does nothing
can anyone help?
no errors
Code:
public static String color(String string) {
return ChatColor.translateAlternateColorCodes('&', string);
}
private static final String prefix = ChatColor.translateAlternateColorCodes('&', "&b[Border Games] &r");
public static void msgPlayer(Player player, String... strings) {
for (String string : strings){
player.sendMessage(prefix + color(string));
}
}```
If the quantum nexus conjoined to the intergalactic force which would then form a metric spacer then the earth would spin 20000x slower and africa would be iceland
what the fuck
You are calling something like new YourPlugin()
Never create a new instance of your JavaPlugin class. Its not allowed.
don't initialize the main class
use dependency injection or make a static get() method
@lost matrix getMaxPlayers() seems to freeze the cycle
ew singleton
L
or just use JavaPlugin#getPlugin
no kyap
Oh ok
if it’s a util class
Yes because it has to wait for the ping every time. Its gonna take a bit. But it should not completely freeze.
declaration: package: org.bukkit, interface: WorldBorder
ah
?jd
@Override
public void run() {
for(String server : plugin.getManager().getQueues().keySet()) {
LinkedList<ProxiedPlayer> queue = plugin.getManager().getQueues().get(server);
for(ProxiedPlayer player : queue) {
Audience audience = plugin.adventure().player(player);
audience.sendActionBar(MiniMessage.miniMessage().deserialize("<gradient:#00C63D:#4EFF00:-0.1>You are in position " + queue.indexOf(player)+1 + " in the queue for " + server));
}
int maxPlayers = getMaxPlayers(server);
int onlinePlayers = getOnline(server);
if(onlinePlayers < maxPlayers) {
if (!queue.isEmpty()) {
ProxiedPlayer player = queue.getFirst();
Audience audience = plugin.adventure().player(player);
audience.sendMessage(MiniMessage.miniMessage().deserialize("<gradient:#00C63D:#4EFF00:-0.1>You are being connected to " + server));
player.connect(ProxyServer.getInstance().getServerInfo(server));
queue.remove(player);
plugin.getManager().getQueues().put(server, queue);
}
}
}
}```
It doesn't send the actionbar updated...
Should I create a new thread for that?
🤷 Gonna go work out now. Do some debugging and play around with it.
goodbye smile, have a good workout sess
public Location closestPlaceWithinBorder(Location loc) {
Location finalLoc = loc.clone();
double size = Objects.requireNonNull(loc.getWorld()).getWorldBorder().getSize();
if (loc.getX() >= size / 2) {
finalLoc.setX((size / 2) + 1);
} else if (loc.getX() <= (size / 2) * -1) {
finalLoc.setX(((size / 2) * -1) - 1);
}
if (loc.getZ() >= size / 2) {
finalLoc.setZ((size / 2) + 1);
} else if (loc.getZ() <= (size / 2) * -1) {
finalLoc.setZ(((size / 2) * -1) - 1);
}
finalLoc.setY(finalLoc.getWorld().getHighestBlockYAt(finalLoc) + 1);
return finalLoc;
}```
now this method isn't working
specifically
lemme type something up on my phone for ya
oh wait
just do e.setTo(e.getFrom())
to stop them from getting out
it doesn't really work
hm
ah I see
and then from is = to
Use a vector approach
What I used to do some time ago is "push" them back in
man idk that
i mean
actually
yeah no i don't know that
If you measure a piece of string and compare it to a piece of wood it will demonstrate how the two galaxies atomic particles fluctuate between nexus systems and photosynthesis then captures the hydrogen molecules and thus creating a zebra
What i did Validate.isTrue(token instanceof Operator op); op.smth and op wasn't valid
A Computer Science portal for geeks. It contains well written, well thought and well explained computer science and programming articles, quizzes and practice/competitive programming/company interview Questions.
try that
Exceeding my 4g limit aaa
F
Oo
how to I add a new section in the config? For example if i have:
categories:
how can I do this via code:
categories:
wood:
amount:
Like how can I add the path "wood"
You can;t add empty paths, but you can if you set a value
getConfig().set("categories." + materialName + ".amount", value)
Thanks, i'll try this.
C:\Users\Nurisantoso\Desktop\DE>gradlew build
Starting a Gradle Daemon, 1 incompatible Daemon could not be reused, use --status for details
> Task :version-support1_12:compileJava FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':version-support1_12:compileJava'.
> Could not resolve all files for configuration ':version-support1_12:compileClasspath'.
> Could not find org.spigotmc:spigot:1.12.2-R0.1-SNAPSHOT.
Searched in the following locations:
- https://repo.maven.apache.org/maven2/org/spigotmc/spigot/1.12.2-R0.1-SNAPSHOT/maven-metadata.xml
- https://repo.maven.apache.org/maven2/org/spigotmc/spigot/1.12.2-R0.1-SNAPSHOT/spigot-1.12.2-R0.1-SNAPSHOT.pom
- file:/C:/Users/Nurisantoso/.m2/repository/org/spigotmc/spigot/1.12.2-R0.1-SNAPSHOT/maven-metadata.xml
- file:/C:/Users/Nurisantoso/.m2/repository/org/spigotmc/spigot/1.12.2-R0.1-SNAPSHOT/spigot-1.12.2-R0.1-SNAPSHOT.pom
- https://hub.spigotmc.org/nexus/content/repositories/snapshots/org/spigotmc/spigot/1.12.2-R0.1-SNAPSHOT/maven-metadata.xml
- https://hub.spigotmc.org/nexus/content/repositories/snapshots/org/spigotmc/spigot/1.12.2-R0.1-SNAPSHOT/spigot-1.12.2-R0.1-SNAPSHOT.pom
- https://oss.sonatype.org/content/repositories/snapshots/org/spigotmc/spigot/1.12.2-R0.1-SNAPSHOT/maven-metadata.xml
- https://oss.sonatype.org/content/repositories/snapshots/org/spigotmc/spigot/1.12.2-R0.1-SNAPSHOT/spigot-1.12.2-R0.1-SNAPSHOT.pom
Required by:
project :version-support1_12
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
* Get more help at https://help.gradle.org
BUILD FAILED in 2m 5s
3 actionable tasks: 2 executed, 1 up-to-date```
Help
Build 1.12.2 with BuildTools
?bt
There is no way you just ran buildtools in that time
yesterday ;-;
Best way to learn java for minecraft plugin development?
?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 need use
java -jar BuildTools.jar --rev 1.12.2
right?
checkmybio
It didn't add anything to my config. Should I run saveconfig or something like that after adding it?
yes
yes
where location i need to run BuildTools
saveConfig() basically wraps method YamlConfiguration#save(File)
i run it on Desktop location and same thing still happen
Do this in main
buildtools take a few minutes to run
You are not running it if you are coming back this fast.
and since getConfig() returns YamlConfiguration, which is a config version stored only in heap, you need to modify the file by passing heap version inside it
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
Exception in thread "main" java.lang.RuntimeException: Error running command, return status !=0: [C:\Users\Nurisantoso\Desktop\BuildTools\apache-maven-3.6.0/bin/mvn.cmd, -Dbt.name=1573k, clean, install]
at org.spigotmc.builder.Builder.runProcess0(Builder.java:973)
at org.spigotmc.builder.Builder.runProcess(Builder.java:904)
at org.spigotmc.builder.Builder.runMaven(Builder.java:873)
at org.spigotmc.builder.Builder.main(Builder.java:698)
at org.spigotmc.builder.Bootstrap.main(Bootstrap.java:27```
why is this happened
My guess will be wrong java version
i already use java 8
and do it where
anywhere you like, just not on teh desktop
ok
No
yeah i doin it in folder on desktop
Don;t do it on teh desktop as (if you enable it) OneDrive will prevent buildtools working.
who turns OneDrive on
Peopel do, we get it in here often
I basically disable it everywhere i install new windows
Now it added it but it wiped all my other default config
i dont turn on OneDrive
How many times I've seen ElgarL writing teh now is uncountable xD
the saveConfig() seems to wipe my default config which i manually wrote out
if you write it while plugin is running then yes
if you manually wrote it you have to load it
teh in indonesia is tea
if you want to get what's inside the file to YamlConfiguration, you need to use reloadConfig(), which is gonna read file and change YamlConfiguration in heap
chai in Hindi is tea
Tee in german is tea
Can you provide a bit more information sir?
click on me
But would this wipe the values I added to the config via value? Or would it keep it and then also load the default config which I wrote out?
I saw your about me, and i am interested in it.
one second
which event?
just never modify your config while plugin is running
If you manually edit the config you have to load the changes. They will not be in memory else.
InventoryClick
or run a task which reloads config each 10 seconds or smth
or create a /reloadconfig command
You can easily check the last file access time
so when you modify it manually you get it to your memory
getConfig() will return manually modified version after reloadConfig()
when you use saveConfig() you overwrite file from YamlConfiguration
idk, doing stuff after cancelling the event works for me
do you have some condition that is never met?
so before making changes in code..java reloadConfig(); // Make changes. saveConfig();
yeah
if you want to add some stuff with code
and you manually edited config before
do this
reload() -> config.set("key", value) -> save()
?paste
i run it like this right?
and what happens when you run that?
just asking its right or no the command line
you will know if its right when you execute it
ok
You don't get the "entering" message?
no
This looks like you are running it on a remote machine, not your PC
But it does cancel the event?
i run it with Git Bash
ok
wdym
well, is the event cancelled?
yes
