#help-development
1 messages ยท Page 2045 of 1
`?
๐
Unless you loop all the sounds and do player.getWorld().playSound()...
every message of this event gets send twice
probably its the whole event that gets triggered twice
not sure about that, btw can someone help?
?paste it in pastebin works too
And it's nicer to read than on discord
but I want to get the sound and not play it
ok
to play it you have to call it from Sound class
but, i mean, why
you can just loop it with a for and remove it from the list when you play it
I think you're misunderstanding what they want. From the sounds of it they want to make an achievement for hearing all the sounds in-game?
so like
for(Sound s : remainingSoundsToPlay) {
world.playSound(s, ..., ...);
remainingSoundToPlay.remove(s);
}
not sure that'd work
yes
ofc he has to make a way to pause it until he gives a command to make the next sound play
this was just the concept of what he should do
but i mean, there could be over 300 sounds, you can't know all of them
1200*
just checked
1155
ye
oh well just make sure you don't modify the collection whilst iterating, gonna get a ConcurrentModificationException then
yeah ofc
as i said you could make a way to play the next only after you gave him the command that you heard it
otherwise they're all going to getting played in a sec and you'll get an exception
btw can someone help
Just write a client-side mod that when every sound has been played to give them an advancement
Maybe intercept packets with ProtocolLib?
didn't him say he wants a challenge
not an advancement
i mean i speak italian so may i misunderstood
plz
What do you think is the best way to detect when user activates redstone? I was looking into BlockRedstoneEvent but there is no way to detect if a player activated it, and PlayerInteractEvent i would have to specify all the materials and is overall not as reliable (standing on pressure plate spams the event). Thanks
https://hub.spigotmc.org/javadocs/spigot/org/bukkit/event/inventory/InventoryClickEvent.html
This event includes #getClick() which is an enum which contains multiple types of ways that the player could of clicked.
declaration: package: org.bukkit.event.inventory, class: InventoryClickEvent
Oh my bad, I didn't see what you were looking for I just inferred that's what you wanted.
Their are two methods you need to listen to for this to work the way you want it and it's getting the destination and the initiator, you can check the initiator and ensure it's a chest and you can ensure that the destination is a PlayerInventory.
https://hub.spigotmc.org/javadocs/bukkit/org/bukkit/event/inventory/InventoryMoveItemEvent.html
declaration: package: org.bukkit.event.inventory, class: InventoryMoveItemEvent
Hi, i'm very new to spigot api and am currently using the 1.12.2 version, I am a bit confused as to why this doesn't work, any help would be appreciated ๐
(the flight is not disabling after being enabled, it sends the message but it does not disable flight)
?paste code rather than sending files
Then should I just send the link afterwards?
anyone know a way to do this?
nvm, I got it
use a set instead of a list
I don't know what that is yet, but the issue was the player.setAllowFlight(true);
it seems I had a misunderstanding on what that was used for
private List<UUID> flying = new ArrayList<>();
to
private final Set<UUID> flying = new HashSet<>();
Can I ask what difference it would make?
set doesnt keep an order of things so its faster
and also #contains is faster since it uses hash instead of comparing all of the objects fields
Is there something an array would be better for compared to a set?
if you wanna keep order of something
like ummmm
ArrayList is like this
[1] [2] [3] [4] [5]..... []
calling #add will put the next element here ^
a set just has a bunch of elements without keeping an order like that
huh, so would an array be better for like punishment tracking and stuff?
punishment tracking would be done with a database
ah
you could use an array for matrixes but you dont need to learn about that stuff right now
arrays are just containers of elements with a fixed size
String[] names = new String[]{"Bob", "Joe", "Billy"};
System.out.println(names.length); // 3
you can change these 3 elements but not the size of it
idk i just feel like teaching rn
I kinda get it
not totally but a little bit
you can change it with a hacky method
but at that point you shouldnt use an array
How can I play Ender Chest open animation?
how would i spawn a falling block with motion?
I mean technically speaking they all have motion. They're falling blocks 
heh 
Nah but really. World#spawnFallingBlock(), then it returns the FallingBlock which is an entity. You can #setVelocity() on it
world.spawnFallingBlock(location, Material.STONE.createBlockData()).setVelocity(new Vector(1, 0, 0));
thanks!
anyone help me pls
getting an error for "new Vector(1, 0, 0)", says Cannot Resolve Symbol "Vector"
I mean, import it ;p
The correct one, anyways. Java has a Vector and Bukkit has a Vector. You want the Bukkit one
If enderchests implement Lidded, you can cast the chest to that and use the open method
So if you have a java.util.Vector (or something like that, I forget what package it's in) in your imports, you've got the wrong one
I don't know if enderchests implement Lidded though
They don't. They have no state afaik
wow i feel stupid. For some reason i forgot what import class ment
Then looks like you'll have to use some packet magic for the opening of an ender chest
Yeah :/ When we initially introduced the Lidded interface we kind of overlooked ender chests, and honestly I don't know how we would have gotten that supported
What exactly is it doing?
Sec. Will link the impl
Is it just sending a packet saying that it's open
It sets a boolean that we patched in then sends a packet iirc
ah
The only thing stopping me from being able to look at nms and spigot source is my inability to set up intellij properly
(blockEvent() sends a packet last I recall looking at that method)
I know annoyingly little about how to work the ide and maven, I know just enough where I can compile shit but that's it
I need to sit down and take the time to learn it
Oh so whether the block is open or not is in the block's state
It keeps track of how many players have it open and if it's incremented to 1, it sends an animation packet. If it's decremented to 0, it sends an animation packet
Though we patched in a boolean that would keep it open if that method was invoked
Man it sure doesn't feel like almost two years ago
For anyone wondering, the packet that controls those block animations is this one: https://wiki.vg/Protocol#Block_Action
Definitely didn't take me like 15 minutes to find it
is there an event for when villager trades occur
what is the default vol and pitch of Echest opens & close?
PlayerInteractEvent ig
There's only a TradeSelectEvent afaik, might be able to intercept trades with the InventoryClickEvent
https://hub.spigotmc.org/javadocs/spigot/org/bukkit/event/inventory/TradeSelectEvent.html
declaration: package: org.bukkit.event.inventory, class: TradeSelectEvent
whats the best way to detect when a player activates redstone?
getServer().getScheduler().scheduleSyncRepeatingTask(this, () -> {
How would I schedule a task that only repeats 5 times?
BlockRedstoneEvent?
you could count amount of times and cancel on 5
wdym cancel
stopping the task
It has no way of getting the player that activated it though
Ive tried PlayerInteractEvent but its buggy
Well it depends on what you want to look for. Most times it's a PIE, though you have to understand that redstone isn't always activated by a player
Daylight sensors for instance are entirely unrelated to players
Tripwires, while triggered by players, doesn't necessarily have a direct correlation to a redstone circuit so if you're trying to stop a dispenser from being triggered by a tripwire hook, you're going to struggle to do that without just cancelling all tripwire hook activations
Create a int variable called "count" or something, then within the method, increase it by 1 and if the count reaches 5, run the cancel method
can probably just call cancel() within the loop
oh
its an int lmao
?
are there any plugins that allow you to make a custom item then update that item later everywhere?
could someone check my custom world thread please
otherwise im just gonna close it tbh
I am stuck here. can you help me?
NMS obfuscation is broken....they obfuscate to do()
And do is an actual thing in java
LOL
is it possible to change the simulation distance on a per-world basis?
or even, per player basis?
Use BukkitRunnable, it can cancels itself.
^
inside the runnable you can call this.cancel()
or if you save the BukkitTask object you can call cancel from that
How do I add arguments to commands in the plugin.yml file @earnest forum?
home:
description: Sets your home!
usage: /<command>
Example for the second arg, instead of showing players
it should show "tp" or "home"
*tp or set
args don't need to be in plugin.yml
oh... how do i set them?
no, for example, yknow in later versions of mc
typing can show auto results
like for /tp
it can show players
yes
there's a special class
like commandexecutor
I'm not too familiar with it
some googling will help
how can I add a method call to the end of a method programatically?
like a mixin to the tail of a function, but without mixins
@earnest forum How do I make a list like so:
String[] argList = {1: true};
I dont wanna have to use arrays and insert them constantly
๐ญ
List<String> argList = new ArrayList<>();
argList.add("whatever");
i stated, and I quote: thyat I didnt want to have to use arrays
can use a set or map then
in either case you won't really escape arrays
HashMap<Integer, String> argMap = new HashMap<>();
argMap.put(1,"true");
swap String for Boolean if its going to be nothing but booleans for values, I just put string because I have no idea what the arg list will consist of
@wet breach How do I do for each on a hash.
Yo I wrote a plugin and the console is giving me this message, what does this even mean
[Server] Server thread/ERROR Could not load 'plugins/com.lerfing-1.0-SNAPSHOT.jar' in folder 'plugins': uses the space-character (0x20) in its name
does the directory you are running the server from, contain a space in the path?
like loop?
figured it out, but how do i get an items name that doesnt have color codes?
is there like a getName.raw function
or smth
could strip the color codes from the name first
I'm using pebblehost if that's anything useful, I'm not sure why that would affect plugins working or not
uses ColorCode.RED and such, but will it effect TabComplete?
if not it doesnt matter
Ah
zzz
Sorry was in a game, was my next suggestion ๐
but you found it on your own
so awesome ๐
very dumb thing they have there lol
@wet breach sorry i suck at switching
how do I check for any other case?
ex: if i was compairing numbers, if a case afterwards is bigger than 2, do the same action
is it case.Default
or
*i dont wanna copy n paste it a million times lel
I believe you can surround the name with " " to have spaces
but if not it makes sense to not allow spaces
alright what exactly are you doing? lol
So that I have a better understanding and don't just give you random code stuff for something ๐
switch(args.length){
case 1 -> {
ArrayList<String> argList = new ArrayList<>();
argList.add("spawn");
return argList;
}
case 2 -> {
return new ArrayList<>();
}
}
I want it so that any other case 2 or higher would return new ArrayList
im doing TabComplete
for commands
You might want to return an Empty List instead of just a new ArrayList but it depends what you are doing
ah
prevents them pesky NPE's
to return an empty list
in case you want to check its size or something
at least it will return a size of 0, instead of NPE
default is if nothing matches it will run the default
exactly what i need
tysm
you can do Arrays.asList(params)
i use it for creating lore
in item meta
ArrayList<String> lore = Arrays.asList("This is lore line 1", "This is lore line 2")
that works too
somehow it does oddly enough
which is kinda funny
funni color coded tag
*tab
@quaint mantle look at this
they mean the tab complete
oh damn, tys
oh
requires a list, not an arraylist
anyone can help me?
what exactly you need help with?
I think chest opening is client side
not seeing anything in the protocol for the server to send
my friends and I used autoclicker to force the chests to be permanently open
they were open all the time for all players
so basically used a client
to keep it opened lol
I suppose that is one way to do it
I mean that it was enough for a few seconds to click on the chest a lot and quickly and it remained open for everyone all the time until the restart
there were no people who just did it all the time, it was enough to do it 1 time
probably could make a fake invisible player do it by sending a packet into the packet pipeline to make it appear it came from a client to also do it
In either case, it is client side so....will have to resort to some hacky method to get it to work regardless ๐
anyway i think what he wants to do is possible
server side? yes, but you need to do some network trickery to get the packet to go around and come back in
yeah
there isn't a server side packet you could send sadly to make it easier
so it will be ENTITY_ACTION?
there isn't a server side packet that exists for what you are wanting
you would have to somehow get a packet to come into the pipeline for inventory opening on the chest
since its a client packet that comes to the server
I mean I could be wrong
but I don't see it in the protocol server side to allow it
Hey, I am having troubles with OCM/OldCOmbatMechanics on 1.18.2
I can still attack player for damage inbetween delays. Anyone know how to fix this
so you need to send an id and param which would seem to be you would have them both set to 1
well locaiton, action id, param, block type(which needs to match the block type at the location given)
and it appears you only need to send that once, when the chunk loads
thank @quaint mantle for pointing out the relevant packet ๐
@grizzled pollen just pinging you in case you don't want to use an autoclicker ๐
we did this when we just released 1.13.2
I haven't played minecraft for a long time
I just make plugins for it sometimes
or mods
ah
Hi! Somebody know, how to turn decompiled NMS to remapped NMS?
for example: PacketPlayOutEntity -> <remapped_copy>
only idea i have is using remapped nms from the beginning
tried java ItemStack item = new ItemStack(Material.getMaterial(itemName)); with itemName = "cookie", but got ```java
java.lang.IllegalArgumentException: Material cannot be null
then thats not a valid name
No, i just looking one tutorial and in there is other mappings. I just need to convert class name "PacketPlayOutEntity" to mojmaps copy
If you want to use Mojmaps in your project read the release post for your version
?bootstrap
Bootstrap Jar
The main spigot-1.18.jar is now a bootstrap jar which contains all libraries. You cannot directly depend on this jar. You should depend on Spigot/Spigot-API/target/spigot-api-1.18-R0.1-SNAPSHOT-shaded.jar, or the entire contents of the bundler directory from your server, or use a dependency manager such as Maven or Gradle to handle this automatically.
Please read the release notes for further information: https://www.spigotmc.org/threads/9-years-of-spigotmc-spigot-bungeecord-1-18-1-18-1-release.534760/#post-4305163
cookie isnt a material
and where do i find valid names? in the code the getMaterial looks like this: ```java
@Nullable
public static Material getMaterial(@NotNull String name) {
return getMaterial(name, false);
}
@Nullable
public static Material getMaterial(@NotNull String name, boolean legacyName) {
if (legacyName) {
if (!name.startsWith("LEGACY_")) {
name = "LEGACY_" + name;
}
Material match = (Material)BY_NAME.get(name);
return Bukkit.getUnsafe().fromLegacy(match);
} else {
return (Material)BY_NAME.get(name);
}
```
COOKIE is
use the enum
Material.COOKIE
your ide should come up with autocomplete for every enum
yea, but i want the user to be able to customize that item by a config
material.valueof?
Why are you forcing legacy
no
Oh wait nvm
you need to use a string method to capitalize the string and then use Material.valueOf(String) I think it is
yes
it has to be all caps
you should first check if its null and if it is print an error
why not just Material.COOKIE?
cause
that
hes trying to customise it
Material.valueOf(String.toUpperCase("ItemName"));
String.toUpperCase ๐ค
itemName.toUppercase()?
what would it be otherwise?
Don't forget to specify locale in that uppercase or things could go wrong
no, that is directly read from the config
there is no static toUppercase method kek
are u trying to publish it
locale shouldn't matter for this since the enums are not language dependent at least I don't think they are lol
Turkish has different i and might break stuff
that is fine, the enums are in english
Well yeah but if you enter lowercase i and try to uppercase it... it will use the wrong i
(If system lang is set to turkish)
I'm not sure how it will handle that
why is now my mc crashing on connecting to my testserver???
Locale doesn't automatically change or convert anything
going to need to provide more information then that lol
ok, now i found another error. when i edit the default config it doesnt change the used config
guess it was just a random crash
you are going to have to handle detecting when the config has changed
servers arent crashing randomly
easiest way is to implement a reload command in your plugin or just have your plugin every so often refresh its config it has loaded
no, it was the client that crashed while i connected to the server
thats not good either
and i meant the config you put into the resources folder while programming
so when you recompile, it is putting the changed config into the jar?
is that what you are saying?
I am pretty sure it is, and it is just the fact that since config.yml already exists on your test server for that plugin
it is just not pulling the new config.yml and replacing the already existing one
either implement in detecting a newer config.yml version or just delete the old config and let it get remade
on the test server
yes, but not in the server plugins/pluginname directory
what is that?
i like intellij. i just need to press one button and it builds the maven package, copies the plugin to my testserver and then runs the testserver
if config.yml already exists in the plugin directory
then the updated one in the jar, isn't going to automatically replace the existing one
either implement such in your code, or just simply delete the old config.yml
if instead you are saying it isn't putting the config.yml in the directory at all even if it doesn't exist, then you need to use the relevant method to make it do such. saveDefaultConfig()
that's 1.16 and below only though
1.18 has other names
e.g. no packet is called "PacketPlayOut", they are rather just called "Clientbound"
does someone know the "official" spigotmc hex color?
I guess it's #ed8106?
I just need it for a button
wdym
Boolean.getBoolean is such a weird method
like, why is that method even in the Boolean class, it doesn't belong there at all
To fuck with you
it should be in the Properties class
you mean when someone runs your jar?
add a MANIFEST.MF file inside META-INF that specifies a Main-Class: com.whatever.Main
I know that lol
but would that open the command prompt
it is for System Properties
without that method, it be a pain to get the boolean value of a system property without resorting to your own boolean method check
no, you have to open one yourself, get the output stream and print to that
yes, that's why it belongs in the Properties class
you also don't use String.getString() to get string properties
it should be Properties.getBoolean imho
but then things that extend Boolean or whatever wouldn't have that automatically
nothing can extend Boolean
it's final
I meant internally
internal stuff is not subject to java stuff ๐
Now that is beautiful
To backport a plugin from 1.17 to 1.16 all I have to do is change the dependency version in the pom, right? like this? (and find errors created by this obviously)
longs i think
Doubles
Just read their source it's public
i want to open a cmd
not run smth on it
i alr figured it out
its platform dependant tho
so i gotta check what os is it
for widnows
windows
Runtime.getRuntime().exec("cmd /c start cmd.exe").waitFor();
what is the class with the largest parent tree?
including interfaces
not the exact one but what would be a good guess
from the java standard library
@ depth 0: |- class javax.swing.JSlider
@ depth 1: |- class javax.swing.JComponent
@ depth 2: |- class java.awt.Container
@ depth 3: |- class java.awt.Component
@ depth 4: |- interface java.awt.image.ImageObserver
@ depth 4: |- interface java.awt.MenuContainer
@ depth 4: |- interface java.io.Serializable
@ depth 2: |- interface java.io.Serializable
@ depth 2: |- interface javax.swing.TransferHandler$HasGetTransferHandler
@ depth 1: |- interface javax.swing.SwingConstants
@ depth 1: |- interface javax.accessibility.Accessible
made something to print the tree
I am getting a NoSuchMethodError when setting fuse ticks on a creeper. I have my api-version at 1.16 and my dependency at version 1.16.5-R0.1-SNAPSHOT. The Method it is referencing is the one below. Any ideas?
how can i render a full map here
hey guys how to get a plugin from the PluginManager using its name
hello
what does this error mean?
[17:33:40 ERROR]: null
org.bukkit.command.CommandException: Unhandled exception executing command 'rh' in plugin Swapnocraft v1.0-SNAPSHOT
at org.bukkit.command.PluginCommand.execute(PluginCommand.java:47) ~[paper-api-1.18.2-R0.1-SNAPSHOT.jar:?]```
plugin manager.getplugin(name)
Type skills on phone smh
gies NPE
What?
For plugin?
Make sure to use the exact name
And if it's still null the plugin isn't installed
okay ill try again
What will you use to get the list of the numbers in the below YAML (File is config.yml)
yaml versionID: versionList: [9089, 4568, 6969, 4200, 6969]
Is there a dummy entity that can be used to track custom damage done by World#createExplosion(@NotNull Location loc, float power, boolean setFire, boolean breakBlocks, @Nullable Entity source)?
Cant you do int[] config.get("versionID.versionlist" )
So i figured out how to open a command prompt
#getIntegerList(String)
Runtime.getRuntime().exec("cmd /c start cmd.exe").waitFor();
but how do i listen for messages in it
That isn't a list?
nvm ignore me ๐
A list is with -
Okay tanks
anyone?
its a null error in your command processing.
read the rest of the stacktrace to see which line in your code is causing it
Runtime.getRuntime().exec("cmd /c start cmd.exe").waitFor();
but how do i listen for messages in the command prompt i started>
sec. I did this a while ago
public static void main(String[] args) {
try {
String ss = null;
Process p = Runtime.getRuntime().exec("cmd.exe /c start dir ");
BufferedWriter writeer = new BufferedWriter(new OutputStreamWriter(p.getOutputStream()));
writeer.write("dir");
writeer.flush();
BufferedReader stdInput = new BufferedReader(new InputStreamReader(p.getInputStream()));
BufferedReader stdError = new BufferedReader(new InputStreamReader(p.getErrorStream()));
System.out.println("Here is the standard output of the command:\n");
while ((ss = stdInput.readLine()) != null) {
System.out.println(ss);
}
System.out.println("Here is the standard error of the command (if any):\n");
while ((ss = stdError.readLine()) != null) {
System.out.println(ss);
}
} catch (IOException e) {
System.out.println("FROM CATCH" + e.toString());
}
}
That shoudl work. I did it with a ProcessBuilder and redirectErrorStream
I use a map to store my config file values
if i store this string in my map
00FF00
it gets stored as
00FF00
if i store this string in my map
#00FF00
it gets stored as
ยงxยง0ยง0ยงFยงFยง0ยง0
``` Are maps not able to store # characters as part of string values?
java map*
either or works
down to preference I suppose lol
depends on the method you are using to save it
nvm ive found the mistake
however, if it has anything to do with the API of spigot/bukkit it would be because the second version is considered hex color code
well that would do it
actually now that I think about it, your way is actually the preferred way
mainly because you really shouldn't use Runtime.exec()
is there a function to rotate vectors or do i need to do the math myself?
what does this do
how can i typecast a chatcolor from string to chatcolor
yes
there is like 5 methods to rotate vectors
well you can rotate via axis too
declaration: package: org.bukkit.util, class: Vector
directory information
thanks
you should be able to figure out from the example how to get output or input
oh okay
I used inputstream for that
soo
how can i typecast a correctly formatted ChatColor from string to ChatColor?
one that doesnt need to be translated
I think ChatColor has a method #fromString
well i didnt
doesnt
it has #of() but that translates a hex string to color
thing is ive already done that before
?paste
@grim ice This is a class I wrote to monitor FFmpeg as it is transcoding. https://paste.md-5.net/hexujadare.java
still needing this
o
get the input and output stream of that process
public static void main(String[] args) {
try {
String ss = null;
Process p = Runtime.getRuntime().exec("cmd.exe /c start dir ");
BufferedWriter writeer = new BufferedWriter(new OutputStreamWriter(p.getOutputStream()));
writeer.write("dir");
writeer.flush();
BufferedReader stdInput = new BufferedReader(new InputStreamReader(p.getInputStream()));
BufferedReader stdError = new BufferedReader(new InputStreamReader(p.getErrorStream()));
System.out.println("Here is the standard output of the command:\n");
while ((ss = stdInput.readLine()) != null) {
System.out.println(ss);
}
System.out.println("Here is the standard error of the command (if any):\n");
while ((ss = stdError.readLine()) != null) {
System.out.println(ss);
}
} catch (IOException e) {
System.out.println("FROM CATCH" + e.toString());
}
}
sth like this
well with the writer you can "put" text into the terminal
and with the reader you get the output
?notworking
"Does not working" is a useless statement. Please describe what exactly is not working, what you expect it to do, and what actually happens. If you get any console errors, also ?paste the entire stacktrace.
Whatever you write in the cmd
it sends nothing
"Here is the standard output of the command:"
thats all it sends
erm wait, you want to start a terminal from java, and then catch what people enter there? why? o0
Sir
yeah but he wants to make it work without entering java -jar app.jar
oh
well just make a bootstrap class
^
that runs my jar?
public static void main() {
Runtime.exec("cmd.exe /c java -jar this.jar ClassName
that runs your class
I'd just tell people to run it from CLI and that's it
or just create a tiny console window GUI with swing or similar
or just include a .bat and .sh file
that's what most CLI apps do
and what do i even replace this.jar with
with your .jar name
why don't you just include a .bat file
@echo off
java -jar MCMapperGUI-1.1.1-all.jar
that's what MCMapperGUI includes
"include a bat file" wdym
still need help i cant find a method to parse this xD
oh ic
ChatColor.getByChar('c') returns a ChatColor.RED
well ive got the whole formatted string
like this
ยงxยง0ยง0ยงFยงFยงFยงF
cast from the color #00FFFF
so i wanna typecast this string into a bungee ChatColor
i could avoid parsing it beforehand, but that would add redundancy to the code
ChatColor.of takes a Color and you can get a color using new Color(int r, int g, int b)
hm
and you can get an int from hex using Integer.valueOf("ff",16)
16 for hex, obviously
my yaml is valid but when i start my plugin
it says
org.bukkit.configuration.InvalidConfigurationException: while parsing a block mapping
in 'reader', line 1, column 1:
world-name: swapnoworld
^
expected <block end>, but found '<block mapping start>'
in 'reader', line 29, column 5:
CorrectlyReported:```
hm
?paste your config.yml
ok wait
ello guys, can anyone tell me how to build my plugin using the cmd line and mvn?
mvn package
ok tanks
i build with mvn clean install command
That installs the libs I think
that doesn't only compile and package but also install it to the local repository
..
$ mvn clean install
[INFO] Scanning for projects...
[INFO]
[INFO] ------------< com.vinitjar.versionchecker:VersionCheckerX >-------------
[INFO] Building VersionCheckerX 1.0
[INFO] --------------------------------[ jar ]---------------------------------
[INFO]
[INFO] --- maven-clean-plugin:2.5:clean (default-clean) @ VersionCheckerX ---
[INFO] Deleting D:\Vinesh\Github\VersionCheckerX\target
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ VersionCheckerX ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 2 resources
[INFO]
[INFO] --- maven-compiler-plugin:3.8.1:compile (default-compile) @ VersionCheckerX ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 1 source file to D:\Vinesh\Github\VersionCheckerX\target\classes
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1.548 s
[INFO] Finished at: 2022-03-25T18:21:33+05:30
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.8.1:compile (default-compile) on project VersionCheckerX: Fatal error
compiling: invalid target release: 17 -> [Help 1]
[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
compile = only compile
package = compile + put into .jar
install = package + install to local repo
Any idea idea why it failed
you are running maven with an older java than java 17
how to know
compiling: invalid target release: 17 -> [Help 1]
only use install when you really want it in your maven local. If you do it for every build you will rapidly fill your HD
heres the yaml
I mean how to know what version it is using and how to make it use 17
project structure?
clean package is used usually for dev work
seems like the yaml you are trying to read isn't exactly as the one you sent
mvn -v
set your JAVA_HOME path to your install path of your java 17 jdk
xDD its using 1.8
then what should i do?
first one is set to use java 17, second one uses the default
can u send that first one here
JAVA_HOME=/c/Program\ Files/Java/jdk-17.0.1/ mvn -v
tanks
okay i fixed it..
@grim ice still haven't figured out the example?
is there a way to cancel/stop a repeating task from within the task, I basically only want it to keep repeating until a bool is false, then it will stop itself is what I am looking for?
nvm, a bukkit runnable seems way better than using a scheduler and it has its own cancel method
how can I check if the player last logged in within 24 hours? (bungeecord)
basically a daily login reward system
while(true) {
if (utils.isOn()) {
System.out.println("on");
wait(2000);
}
}```
how would i do this without spigot btw
without getting cpu usage to 99% LMAO
eh i got it working
with a bat file
PersistentDataTypes are just which primitive type the key from namespaced key is, right?
use runnables, while locks the thread
Runnables?
Use a thread.
a class which extends BukkitRunnable or Bukkit.getScheduler().runTaskAsync(plugin, ()->{})
Read my question again
well i dont see any method that comes from spigot in that code
dayum
The bukkit scheduler is part of spigot
do you see Bukkit in the jdk?
a thread will close once it stopped working
also idc about pausing the main thread
i just dont want too much cpu usage
that actually should not cause that high cpu usage
Can you please tell me how you do mysql queries?
resources from the internet exist
Bukkit.getPlayerExact(args[0]) == null
How are you getting the player given a string?
How are you converting the string to a player?
Bukkit.getPlayer(args[0])
ok
what
What does that image tell you
get a player object by the given username
Right, and what does it return?
oh
It's better to use getofflineplayer
bruh cancelling EntityExplodeEntity doesn't cancel the damage ._.
because you're cancelling the explosion
yea, that's very specific
but players still get damaged?
i mean, in reality, yes
so players get damaged even when the explosion was cancelled? and the creeper still exists?
interesting
that is odd behavior
guess you have to listen to EntityDamageEvent or similar
it is like one broken plugin i have seen, when players get damaged from using beds in nether although there are no explosions
think is towny lmao
yea that should do
still this error is coming
org.bukkit.command.CommandException: Unhandled exception executing command 'report' in plugin Swapnocraft v1.0-SNAPSHOT
at org.bukkit.command.PluginCommand.execute(PluginCommand.java:47) ~[paper-api-1.18.2-R0.1-SNAPSHOT.jar:?]
at org.bukkit.command.SimpleCommandMap.dispatch(SimpleCommandMap.java:159) ~[paper-api-1.18.2-R0.1-SNAPSHOT.jar:?]
at org.bukkit.craftbukkit.v1_18_R2.CraftServer.dispatchCommand(CraftServer.java:905) ~[paper-1.18.2.jar:git-Paper-230]```
Can you paste the full error
hello guys I am trying to add a cmd to my plugin, this is my plugin.yml
name: VersionCheckerX
version: '2.2'
main: io.github.vinesh27.versioncheckerx.VersionCheckerX
api-version: 1.18
authors: [ vinesh27, Bastaboii ]
description: Version Checker is a plugin that can check for all the plugins in your server and inform if a plugin is outdated
commands:
versionChecker:
description: Used to check the versions of plugins
usage: <command>
But when I execute the versionChecker command it says unknown command
?paste
https://paste.md-5.net/nonodadayo.cs Main class
the cmd is also inthe main class
Can we see the onEnable section
Caused by: java.lang.NullPointerException: Cannot invoke "String.replace(java.lang.CharSequence, java.lang.CharSequence)" because the return value of "org.bukkit.configuration.file.FileConfiguration.getString(String)" is null
Swapnocraft.java:405
no
@Override
public void onEnable() {
saveDefaultConfig();
Bukkit.getServer().getConsoleSender().sendMessage(
ChatColor.GOLD + "" + ChatColor.BOLD + "[VersionCheckerX]" + ChatColor.RESET + "" + ChatColor.GREEN + " has started :)");
}
Do i need to register the cmd if its in the main class?
Not config ist null, getString() returns null
oh
Oh my
registerCommand(this, this)
Oh okay
Do i need to implement CommandExecutor, or does JavaPlugin do it automatically?
You need to explicitly implement it
wow wtf that "report" command is possibly the worst code I've ever seen
and you decompiled THAT to learn sth?
yeah even worse
.-
at least steal good code
lol
just look at open source stuff
Okay guys decompiling something is not automatically "stealing"
it was a 1.8.8 code
It doesn't matter where it's from
are those buttons too big / too ugly etc? or are they at least halfway okay?
shit then have to redo them all lmao
I'll just do custom ones with photoshop then
I tried to use some online png button generators but this was the best I could get from those lol
people somehow always miss them anyways
so I thought colored buttons will prevent people asking where the javadocs etc are
do you have the links in the table of contents?
the author didn't given any contact link like dc or what
there's no table of contents, I'd always forget to update them
:))
@tender shard do you not forget to update buttons?
unlike the table of contents, those would never change
sure, but you could just have a toc that is just the links
jezus
yeah
report.recive
well that sounds awesome
does the code after a bukkit runnable only run once the task has finished/been cancelled?
no, it runs immediately after the runnable is scheduled.
Which is basically instantly. It doesn't wait.
ah, I am glad that is the case, thanks
You should send a video of your mortar I kinda wanna see that LOL
I can't open MC rn 
I'm in class lmao

Could someone explain me what are lambda expressions and when I should use them? I've already googled it but I still don't understand it that well.
ty ๐
guess ur bad at googling then
or is that the same website
that's even larger and even more ugly
this is way better than the ones you used
u can change the size as u want
i just made it big so u can see it in discord
well I obviously wanted the spigot button in spigot colors lol
thats with a bubble effect
and the curvy thing
u can remove both if u want
as long as the shadow
ew you
i made it with an online generator
Lol
they look fine
also @tender shard
how to do
while(true) {
if(boolean) {
run();
}
}
without 100% cpu usage :D
and without spigot
why would you want to do that
I mean you cant rly
java has timers builtin
as long as the user is clicking a button
ScheduledExecutorService would be by far the most sophisticated solution in your case
?learn ava
ye wonderfully wonderful stuff
it doesnt need to be off thread btw
?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.
pausing the main thread is not bad here
then just join the future
You're approaching whatever you're doing wrong if the user holding down a button needs to do something
Make a toggle?
i did
and the issue is?
bool = !bool
ik
kek
That's noobish. I'd use an AbstractBooleanTogglerFactory
lmao
I love that it's Abstract so you have to implement the same thing anyways LMAO
ReflectionFlipFieldBooleanUtil
enterprise code is such a joke sometimes ๐
List<String> a = Arrays.asList(s.split(" "));
int damager = 0;
for (int i = 1; i < a.size(); i++) {
System.out.println(i);
if (a.get(i).contains("thDamager")) {
damager++;
a.set(i, a.get(i).replace("%" + damager + "thDamager%", "na"));
a.set(i, a.get(i).replace("%" + (damager - 1) + "thDamager%", "na"));
a.set(i, a.get(i).replace("%" + (damager + 1) + "thDamager%", "na"));
}
if (a.get(i).contains("thDamage")) {
damager++;
a.set(i, a.get(i).replace("%" + damager + "thDamage%", "na"));
a.set(i, a.get(i).replace("%" + (damager - 1) + "thDamage%", "na"));
a.set(i, a.get(i).replace("%" + (damager + 1) + "thDamage%", "na"));
}
}
return toString(a);
any advice on how optimize this?
a is a string that has all strings inside this:
why do you have the same code twice?
oh wait
one is damager
messagesOnBossDeath:
- '&7The boss: &e%boss% &7has been killed by &e%killer% &7and has dropped: &e%drops%&7.'
- ''
- '&aTopDamagers: '
- ''
- '&c%1thDamager%: &a%1thDamage%'
- '&c%2thDamager%: &a%2thDamage%'
- '&c%3thDamager%: &a%3thDamage%'
and one is damage
yeah
i would like to make the 3 a.set in just one
but i'm quite unable to do it xD
what is that even supposed to do
basically its a top damager
what is s?
classification of players hit a boss
like the first on top made 20 damage and second 10
to a mob
the 1thDamager represents the name of who made most damage
and 1thDamage represents the damage he made
and that's for all the others
List<String> a = Arrays.asList(s.split(" ")); converts a string to a list of strings
the code works well but actually sucks because its repetitive and difficult to understand
public static String setPlaceholders(String s, Player killer, LivingEntity boss) {
List<Pair<OfflinePlayer, Double>> topDamagers = Tools.getTopDamagers(boss);
if(killer != null)
s = s.replace("%killer%", killer.getName());
for(Pair<OfflinePlayer, Double> pair : topDamagers) {
int i = topDamagers.indexOf(pair) + 1;
s = s.replace("%" + i + "thDamager%", topDamagers.get(i - 1).getA().getName());
s = s.replace("%" + i + "thDamage%", String.valueOf(topDamagers.get(i - 1).getB().intValue()));
}
List<String> a = Arrays.asList(s.split(" "));
int damager = 0;
for (int i = 1; i < a.size(); i++) {
System.out.println(i);
if (a.get(i).contains("thDamager")) {
damager++;
a.set(i, a.get(i).replace("%" + damager + "thDamager%", "na"));
a.set(i, a.get(i).replace("%" + (damager - 1) + "thDamager%", "na"));
a.set(i, a.get(i).replace("%" + (damager + 1) + "thDamager%", "na"));
}
if (a.get(i).contains("thDamage")) {
damager++;
a.set(i, a.get(i).replace("%" + damager + "thDamage%", "na"));
a.set(i, a.get(i).replace("%" + (damager - 1) + "thDamage%", "na"));
a.set(i, a.get(i).replace("%" + (damager + 1) + "thDamage%", "na"));
}
}
return toString(a);
}
this is the whole function
the
for(Pair<OfflinePlayer, Double> pair : topDamagers) {
int i = topDamagers.indexOf(pair) + 1;
s = s.replace("%" + i + "thDamager%", topDamagers.get(i - 1).getA().getName());
s = s.replace("%" + i + "thDamage%", String.valueOf(topDamagers.get(i - 1).getB().intValue()));
}
part actually sets all the thDamagers as the name and thDamage as the damage
for (int i = 1; i < a.size(); i++) {
System.out.println(i);
if (a.get(i).contains("thDamager")) {
damager++;
a.set(i, a.get(i).replace("%" + damager + "thDamager%", "na"));
a.set(i, a.get(i).replace("%" + (damager - 1) + "thDamager%", "na"));
a.set(i, a.get(i).replace("%" + (damager + 1) + "thDamager%", "na"));
}
if (a.get(i).contains("thDamage")) {
damager++;
a.set(i, a.get(i).replace("%" + damager + "thDamage%", "na"));
a.set(i, a.get(i).replace("%" + (damager - 1) + "thDamage%", "na"));
a.set(i, a.get(i).replace("%" + (damager + 1) + "thDamage%", "na"));
}
}
sets instead the remaining thDamager in the config to na
cuz like for example, if in the config are supposed to be a top 10 but actually only 5 players hit the mob then the others one who can't fit a name and damage gets just na
that's the part i would like to optimize because sucks
the System.out.println(i); was for debug
they are normal entities and once they hit the ground, they turn into solid blocks (EntityChangeBLockEvent)
there isn't much more to them
does Collection.toArray return null or an empty array when the collection is empty?
empty
k
mfnalex can you help me with the code since you're here? XDD
that shouldn't matter. how did you spawn the falling block?
Which is the lastest version of the spigot 1.18?
are you using World#spawnFallingBLock to spawn them?
Build tools doesnt find the version
then you're doing something wrong
how does TreeSet sort its entries?
The elements are ordered using their natural ordering, or by a Comparator provided at set creation time, depending on which constructor is used.
https://docs.oracle.com/javase/7/docs/api/java/util/TreeSet.html
ok
and send your code
Try to spawn them 2 blocks higher and see if that makes them become solid once the hit the ground
seems like they are already "too low" when they try to become solid
Just for curious can i see your this#runCommand() method?
class lombok.javac.apt.LombokProcessor (in unnamed module @0x7bdb8858) cannot access class com.sun.tools.javac.processing.JavacProcessingEnvironment (in module jdk.compiler) because module jdk.compiler does not export com.sun.tools.javac.processing to unnamed module @0x7bdb8858
any1 know what this error upon compiling means?
what lombok version are you using?
are you using it via maven dependency?
what java version?
its compiling to 8
oh wow
that version is horribly outdated
use latest
1.18.22
ah yea
should work then
this isnt my project & never had that issue before
create a thread pool with fixed size
Allright do you have full code on github? I wanna to implement your way for executing data. Its looks really clean and insterest
yes, that did it. thanks ๐
dunno if there's really a profit of doing that
Because im just interested on the redis part
not really changing much in this case i guess
what was it?
try (final Response response = client.newCall(request).execute()) {
final Gson gson = TebexAPI.getGson();
final JsonObject json = gson.fromJson(response.body().charStream(), JsonObject.class);
if (!response.isSuccessful()) {
return TebexResponse.error(json.get(Constant.ERROR_MESSAGE).getAsString());
}
return TebexResponse.of(gson.fromJson(array == null ? json.getAsJsonArray() : json.getAsJsonArray(array), type)); // Errors here
} catch (IOException e) {
e.printStackTrace();
}
return TebexResponse.empty();
Server thread/ERROR Error occurred while enabling EmeraldsPlugin v1.0.0 (Is it up to date?)
25.03 17:07:08 [Server] INFO com.google.gson.JsonSyntaxException: java.lang.NumberFormatException: For input string: "tripwire_hook"
Any reason this is erroring?
tripwire_hook is not a number
What should I do then..?
maybe send the full error
show Responses line 30
k
{"categories":[{"id":2069325,"order":1,"name":"Keys","only_subcategories":false,"subcategories":[],"packages":[{"id":5027337,"order":0,"name":"Common Key x 5","price":"1.25","sale":{"active":false,"discount":0},"image":false,"gui_item":"tripwire_hook"}],"gui_item":"54"}]}
what's that? we need to see the source code
at me.emerald.emeraldsplugin.http.utils.Responses.getList(Responses.java:30)
Thats what the response returns? I thought thats what you meant.
You probably need the item id as number, not the name
formatting lol
no I meant the class that's mentioned in your stacktrace
Incorrect as im just simply printing it :/
This is the line
return TebexResponse.of(gson.fromJson(array == null ? json.getAsJsonArray() : json.getAsJsonArray(array), type));
Here is the class
what does TebexAPI.getGson() return? an empty gson object?
Returns:
private static final Gson GSON = new GsonBuilder()
.setFieldNamingPolicy(FieldNamingPolicy.LOWER_CASE_WITH_UNDERSCORES)
.registerTypeAdapter(new TypeToken<Discount.DiscountType>() {}.getType(), new Discount.DiscountTypeDeserializer())
.registerTypeAdapter(new TypeToken<Effective.EffectiveType>() {}.getType(), new Effective.EffectiveTypeDeserializer())
.create();
it expects "gui_item" to be of type int
hm you must have somewhere, somehow told it that "gui_item" is a number, which makes sense since your actual response contains "gui_item" twice and once it's actually a number
Well, here is the TebexResponse class if that helps
package me.emerald.emeraldsplugin.http.objects;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import java.util.function.Consumer;
public class TebexResponse<T> {
private final boolean successful;
private final T data;
private final String errorMessage;
private TebexResponse(@Nullable T data, @Nullable String errorMessage) {
this.successful = errorMessage == null;
this.data = data;
this.errorMessage = errorMessage;
}
@NotNull
public static <T> TebexResponse<T> of(@NotNull final T data) {
return new TebexResponse<>(data, null);
}
@NotNull
public static <T> TebexResponse<T> error(@NotNull final String errorMessage) {
return new TebexResponse<>(null, errorMessage);
}
@NotNull
public static <T> TebexResponse<T> empty() {
return new TebexResponse<>(null, null);
}
public boolean isSuccessful() {
return successful;
}
@Nullable
public T getData() {
return data;
}
@Nullable
public String getErrorMessage() {
return errorMessage;
}
public TebexResponse<T> ifSuccessful(final Consumer<T> data) {
if (isSuccessful()) {
data.accept(this.data);
}
return this;
}
public void ifNotSuccessful(final Consumer<String> errorMessage) {
if (!isSuccessful()) {
errorMessage.accept(this.errorMessage);
}
}
}
.. Didnt expect it to be that big.
Oops.
How much would you ask for your redis implementation system?
as said, one of those classes you want to deserialize probably has a a field called "guiItem" or sth like that that's a number and not a string
Oh damn. its cause of getAsJsonArray.
Its converting the keys into numbers.
how can I get an offline player with the username? (Bungeecord)
I don't think that bungeecord saves any playerdata
is there even sth like offlineplayer in bungee?
iirc no
any way to do it? I need a way to get the player uuid for database stuff
you can just manually store that data with a plugin
just create a mysql table / json file / yaml file / sqlite db / whatever
and save UUID <> name yourself there
I was trying to avoid having to do that but I guess I have to
Executors.newScheduledThreadPool(1).scheduleWithFixedDelay(() -> {
}, 3, timeMillis , TimeUnit.MILLISECONDS);
if timeMillis change
in between the delays
will the time chang
change
if not how can i do it
@tender shard Can I change how building works so it runs other commands on the terminal in intel idea
does HashMap.equals(HashMap) return true if both maps are identical in their keys and values, or does it consider loadfactor and initial/current size?
Key value pairs
having this, https://pastecord.com/dejazosumy.json , how could i get an element in a specific position? for example the element with location x = 3, y = 66, z = 5 (position 1)
is that a yes
You asked a or b, itโs not a yes or no question
hey guys I m using PluginManager.getPlugin("EssentialsX) to get the plugin EssentialsX but its throwing a NPE
Hi! How to close port with iptables?
Nothing to do with the channel?
Do you have a depend in your yml?
loadbefore: EssentialsX to ensure your plugin is loaded after EssentialsX
Ok, but where i ask it?
second i believe
Youโre forcing your plugin to load BEFORE essentials
Google maybe
They said it so..
Yeah don't listen to them
Use depend
Depend on all plugins that ever existed
only if you know every other plugin on the server. That entry is for libraries not to cheese other plugins
Youโre only guaranteed to load after the plugins you depend on
I want to get all the plugins of a server, so i can get their dcurrent version
You make a runnable that executes your enable code 1 minute after server start
Or I imagine there is an event for it
oo you know what time it is?
Bukkit Runnable Time
almost spelt the godly word wrong
I fixed my code, but had to redo a ton of it :/
I redid my code and have to fix a ton of it
what
I dont have code
afaik its called "Essentials"
i had the X one in my plugins folder
I have X in my folder
I have X in my folder
Wait, but I check for the plugin after it is loaded (When I execute a command)
im very sure its just Essentials
how can I get the UUID of an offline player using their name?
i woudlve used namemc api but theres definately a better way
How do I set my plugin support spigot and bungeecord ?
did you ever do any bungeecord plugin?
if you have code for both bungee and spigot, simply include a plugin.yml and bungee.yml
the bungee.yml obviously points to your bungee plugin main class while the plugin.yml points to your spigot plugin main class
could always ask the user cache
which one? bungee has none
well the server one is the only relevent one, since only known players would be in it
if a player made it to the proxy lobby and never joined a server, I am not sure they are really useful to know?
