#help-development
1 messages · Page 1540 of 1
I don't think in this case it's going to work like what he wants
okay
they will still both be executed for each player chat
yeah well thats what i need to fix tho
then event priority isn't the right tool
like i dont want to run the RecoverEmailVerify after the player has finished the RecoverEmailSetup
I do think that creating a map and doing that may work better
if you want separate logic for the same event you will need to store some state of the player in like a Map<UUID, PlayerState>
or manipulating the string of the player
i do have that
if (user.getSettingUpEmail().getPhase().equals(SetupPhase.SETUP)) {
that's not a map though
oh then event order could be the right tool for you
oh wait my bad
tho you would run out of space on the event priority list rather quickly
yea
I'd suggest, instead of having two listeners, run the respective code from a single listener just in two different methods later on
that way you are sure that setting their phase to verification does not affect the current event execution
now it works thank you
oh and another thing whats an like regex thing for Pattern that only allows numbers?
\d matches a single digit
okay
if two plugins have EventPriority.HIGHEST do they just do rock paper scissors or something?
order of registration
which is implementation detail soooo
yes, rock paper scissors xD Tho the order won't change during runtime 😂
🙃 Thanks
did that, fixed that issue, back to the same problem though, and excluding either packages doesn't fix it :(
I'm using Discord4J, it runs fine on its own, but when I try running it through spigot it gives me an error on runtime: ```java.lang.NoSuchMethodError: 'boolean io.netty.handler.ssl.SslProvider.isAlpnSupported(io.netty.handler.ssl.SslProvider)'
I'm pretty sure this is because discord 4j uses: `io.netty:netty-handler:4.1.60.FINAL`
Where as spigot uses:
`io.netty:netty-handler:4.0.0.Beta1-SNAPSHOT`
(stack trace, although not very helpful imo) java.lang.NoSuchMethodError: 'boolean io.netty.handler.ssl.SslProvider.isAlpnSupported(io.netty.handler.ssl.SslProvider)' at reactor.netty.http.client.HttpClientSecure.<clinit>(HttpClientSecure.java:79) ~[?:?] at reactor.netty.http.client.HttpClient.secure(HttpClient.java:1073) ~[?:?] at discord4j.common.ReactorResources.lambda$static$0(ReactorResources.java:41) ~[?:?] at discord4j.common.ReactorResources.<init>(ReactorResources.java:54) ~[?:?] at discord4j.rest.RestClientBuilder.initReactorResources(RestClientBuilder.java:262) ~[?:?] at discord4j.rest.RestClientBuilder.build(RestClientBuilder.java:243) ~[?:?] at discord4j.core.DiscordClientBuilder.build(DiscordClientBuilder.java:85) ~[?:?] at discord4j.core.DiscordClientBuilder.build(DiscordClientBuilder.java:73) ~[?:?] at Discord.DiscordBot.main(DiscordBot.java:94) ~[?:?] at Discord.DiscordBot.<init>(DiscordBot.java:77) ~[?:?] at MC.MCMain.onEnable(MCMain.java:14) ~[?:?]
Shade it 🙃
wdym?
Do you use maven?
yup
So
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org.example</groupId>
<artifactId>Thing</artifactId>
<version>1.0-SNAPSHOT</version>
<properties>
<maven.compiler.source>8</maven.compiler.source>
<maven.compiler.target>8</maven.compiler.target>
</properties>
<repositories>
<repository>
<id>spigot-repo</id>
<url>https://hub.spigotmc.org/nexus/content/repositories/snapshots/</url>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>com.discord4j</groupId>
<artifactId>discord4j-core</artifactId>
<version>3.1.5</version>
</dependency>
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
<version>2.8.7</version>
</dependency>
<dependency>
<groupId>org.spigotmc</groupId>
<artifactId>spigot-api</artifactId>
<version>1.17-R0.1-SNAPSHOT</version>
</dependency>
</dependencies>
</project>
(is my pom)
upload the code?
Something like this
ah I see, I'm not great at maven
then, you run mvn package
although change teh scope of the spigot depend
cause if not u will shade that
<scope>provided</scope>
Should I build it differently? Currently I'm using intelij's build function
In intellij somehow, or in cmd?
well, you can make a terminal at the bottom if intellij
well, thanks for that I'll try to get it to work and let you know how I get on
ok
ohhh wait does maven need to use java 16 or java 8?
I might just change to a different java discord library then ig
Any idea how to prevent this when player enters this email address "asd@cd.d"?
https://paste.md-5.net/lafepoketi.cs
have you tried regex?
so I have an Inventory in another class and I want to check if the player clicked in that Inventory, how should I do it?
@EventHandler
public void onMainmenuClick(InventoryClickEvent e){
if (e.getClickedInventory() = )
}
you could check the title
there is no .getTitle() in 1.17?
#getView()#getTitle()
no
@EventHandler
public void onMainmenuClick(InventoryClickEvent e){
if (e.getClickedInventory().getView() = )
}
its spigot 1.17
try to read the docs https://hub.spigotmc.org/javadocs/spigot/org/bukkit/event/inventory/InventoryClickEvent.html
declaration: package: org.bukkit.event.inventory, class: InventoryClickEvent
e.getView().getTitle
i do have regex and it works but it passes even like invalid domains or stuff
I have one query, I am getting the title from configuration which will have color codes &e like this and if I check the the title, will it work like that?
You will have to do some networking if you want to test if the domain is invalid or not
You can't have a domain list as new domains can be created every now and then
google dns have a nice resolver:
https://dns.google/resolve?name=cd.d&type=A
https://dns.google/resolve?name=google.com&type=A
If it doesn't have any data it won't exist
i do have that
here : a simple get request
- some json parsing
Yep
and what do i have to get from the dns to like check if it is like existing domain
compare the two links
if it has an empty string in the data field, then it's not a domain
otherwise it is
although, if you do, what's the problem?
that it even passes an invalid domains like the cd.d
and thats when the error occurs
oh I see, what's your error?
You should just be able to catch the error and tell the user that it doesn't exist?
well in the try/catch block it can catch like some wrong details and stuff
like wrong smtp configuration from the host
Thank you very much, I had forgotten.
but now, when i click the item i get the Error message "clickedItem" is null
show code
Okay, ig use the DNS lookup too?
you should check before initializing the clickedItem if its null ex.
if (event.getCurrentItem() == null) return;
ItemStack clickedItem = event.getCurrentItem();
ah well ok. But after that, the item clicked on should still be null according to the console, right?
a question how would i get the domain from example@example.com to only example.com?
would i use the split("@")?
yeah exactly, if you've already made sure it looks like a email first
okay
Does anyone know which lib I need to import, If I want to use https://docs.oracle.com/cd/E12839_01/apirefs.1111/e10664/oracle/ldap/util/JARClassLoader.html
here's something I wrote, if this helps: https://paste.md-5.net/uyibilinif.js
Noob question: Does this mean new file or a new class under the onEnable/onDisable?
What is going on?
ok know it works. Thank you very much
as in?
This
?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'm following the tutorial on making a simple command (https://www.spigotmc.org/wiki/create-a-simple-command/) and I don't know what it means by "Make a new class"
The home of Spigot a high performance, no lag customized CraftBukkit Minecraft server API, and BungeeCord, the cloud server proxy.
you need to create a new .java in your package
Then yes - refer to LMBishop's message
and thank you
So this? Or type it under the main one
Yes this
Thanks!
Yes
EDIT: nvm, but read the following
I'm about to get murdered
also if, make sure to close it in a finally clause of a try catch since any thrown exception can interrupt the closing and force a memory leak
or like is this good too?
try {
String[] hostname = message.split("@");
InetAddress.getByName(hostname[hostname.length - 1]);
} catch (UnknownHostException exception) {
user.getSettingUpEmail().setPhase(SetupPhase.NONE);
player.sendMessage("Invalid address!");
return;
}
Also, unrelated question, what's the use of finally instead of just putting code afterwards, e.g.:
try {
// Do something that raises an exception
} catch (Exception e) {
// Do something
} finally {
// Do something that will always be run afterwards
}
// But also shouldn't this?
the finally block will run no matter what.
ohh, and it'll run if the catch block raises an exception too?
yes
Even in a function where try has a return statement ?
finally is being called every time
yep
Oh I see
Hey, does anyone have maven dependency of the whole Bungeecord, not just api?
just put bungeecord instead of bungeecord-api i guess
This doesn't even give the API xD
I guess I have to compile it myself from the src, and install using maven
Coming back on my problem: I have a (working) jar file in my /src/main/recources. When I try to copy the jar, it gets corrupted. I have tried almost everything, but can't find a solution. I do this because I want to remove the old jar after an update
As I found out, Maven might be a problem (with compiling)
Now I am 100% sure Maven is the problem, after compiling I change my .jar to .zip, extract the resource and if I run it I get an corrupted error message
do you have any sort of resource processing
inb4 it's a filtered resource
i don't know if maven is smart enough not to filter non-text resources
I have <filtering>true</filtering>
that means it's a filtered resource
<resources>
<resource>
<directory>src/main/resources</directory>
<filtering>true</filtering>
<excludes>
<exclude>src/main/resources/TvheeAPI-FileRemover.jar</exclude>
</excludes>
</resource>
</resources>
But I can't find a way to exclude it from Maven
From the filtering
How to do that?
unsafe is one way, but is not strictly necessary
what you are doing once again seems very silly
I use the jar to remove the old version from my plugin after x seconds
I can't find any other way
that is silly
And Maven does copy my .png file without any problems
have the server delete it
Yes is that possible then?
bundling random jars and invoking them through the command line is thoroughly silly
Yes so I don't want to use command line, I just copy the file remover, remove the file, and if the new jar boots up it removes the file remover
and won't even work in many environments
Ok what would you do then?
have the server delete the file after the plugin is unloaded
Ok and how am I gonna do that?
with, for example, a thread
I don't understand, can you show some code?
threads you spawn stay running even after your plugin unloads
same goes for asynchronous bukkit tasks that have already started but not finished
Ah that is nice, but I can't delete the old file in the old file with File.delete()
i doubt your other jar would have much success in deleting it either, then
Yes, but then the problem is: how can I notice the new jar about the file?
Because there are more .jar files in the plugins folder
search the directory
Creating a txt file or smth?
or look in the updates directory
ideally the latter as that is a preexisting standard
Yes
open up each jar in the updates directory, read their plugin.yml
And after the plugin unloads, I can even delete it with windows explorer
if their name matches and their version is > than the current version, replace the old jar with that jar
[13:50:46 INFO]: Vault has not been found on this server. Disabling the EconomyManager.
[13:50:46 INFO]: [Vault] Checking for Updates ...
[13:50:47 INFO]: [Vault] No new version available```
Hello, how can I fix this?
EconomyManager.java: https://paste.md-5.net/nuzetatefo.java
?paste
?paste
You need a plugin that provides an implementation of the vault api interfaces
I added my plugin to bungeecord server but i keep getting this error:
https://paste.md-5.net/pariwucego.cs
i also included bungeecord in my maven dependencies
and repositories
wdym
Nuxoria you’re trying to load the class JavaPlugin in bungeecord context
WHat should I change?
But for the record add something like essentialsx
That would solve the problem with an economy
Yes send the relevant code
You can’t extend JavaPlugin in a bungeecord server
The class isn’t provided (loaded) anywhere this ncdfe is thrown
For some reason this stops working after a while... The event doesnt even seem to get called
@EventHandler(priority = EventPriority.HIGHEST)
public void onSpawn(ItemSpawnEvent e) {
Item item = e.getEntity();
Bukkit.getScheduler().runTaskAsynchronously(Core.getInstance(), () -> {
for (Collector c : Core.getInstance().collectors) {
if (e.getLocation().getChunk() == c.getChunk()) {
if (c.getFaction() == null) return;
if (!Core.getInstance().drops.contains(item.getItemStack().getType())) return;
c.depositDrop(item.getItemStack().getType(), item.getItemStack().getAmount());
item.remove();
}
}
});
}
So I should just extend plugin?
Easier said that any spigot specific class shouldn’t be used in a bungeecord context
Yeah pretty much look at the wiki page nuxoria
ty
Does removing entities async work?
It works for a bit, then just stops
Same outcome
Hmm have you debugged with like print statements or something?
Anyways Idk if using == to compare chunks is a good idea
Yeah a lot
Ill try
Thanks!
iirc removing entities async is sort of fine
Oo
calling the remove method on the bukkit wrapper only sets a flag
Cheers, how’s tribus going btw
the server will look at the flag synchronously and actually remove the entity synchronously
Ah NNY makes sense
i'm a pretty sensible guy
Its going great, just tons of shit to fix after the first factions map
Soo many bugs lol
Thanks!
Yup
Okay I made my whole plugin in spigot and I want it for bungeecord
do I basically need to recode bunch of sht?
yes
bungeecord is not a minecraft server
it is only inevitable that if you write something for a minecraft server, you'd have to rewrite parts of it for it to work on bungeecord
Yes they’re
Literally everything is different except the chat api
And some common libs
Like netty and possibly guava
Hey I would like to update this plugin:
https://github.com/Cavallium/CoordinatesObfuscator
to 1.17, how can I do that? tired updating the dependencies but that did not work
you probably can't even do what you're trying to do on bungee
again, it is not a minecraft server
there are no players in the common sense, there are no worlds, there are no entities and there are no blocks
Sht wait
I have a plugin
which uses database to store nicknames etc
1 mysql database
If i enable it on all the spigot servers connected to the bungeecord
they should use the same database?
if the credentials are the same
in their configs
yes, you probably won't need anything on the bungeecord server in that case
Hi, I'm trying to build a server to bedrock and java, I already can do it but I can't put mojang commands, and I'm confused, because I went to your site (https://www.spigotmc.org/go/commands-yml) and I didn't understand anything. Can u help me?
i can't understand anything you're saying, either
…
toString()
CoordinatesObfuscator\src\main\java\org\warp\coordinatesobfuscator\CoordinatesObfuscator.java:14:18
java: cannot access org.bukkit.Bukkit
bad class file: /.m2/repository/io/papermc/paper/paper-api/1.17-R0.1-SNAPSHOT/paper-api-1.17-R0.1-20210627.045602-51.jar!/org/bukkit/Bukkit.class
class file has wrong version 60.0, should be 55.0
Please remove or make sure it appears in the correct subdirectory of the classpath.
what does that mean?
Thats Paper not Spigot
This Discord is for Spigot not Paper
@wraith rapids issue fixed, thx for your help
thanks
How can I set the MOTD in bungee? They made it a bit complicated with MotdInfo and MotdItem
And also, how can I get the MOTD?
I see smth like ServerPing#getDescriptionComponent, can I cast this to TextComponent?
hi, how can I use the onInventoryClick event bet just after the player clicked?
schedule a task 1 tick after
I have a nick blacklist. If you name yourself &eshit, it gets detected, but for some reason, &esh&bit for example doesnt get detected? Im checking if the nickname contains any string from blacklist. What should I do?
My check:
final String noCharMessage = e.getMessage().toLowerCase().replaceAll("&", "");
if (!noCharMessage.contains(str.toLowerCase())) {
i tried replacing all the chars with empty space, thought dumbly that maybe that stops something
u sure that will fix anything?
.contains should detect even with chars tho
cuz even with chars it still contains the string letters in the blacklist
Well if u wanna get rid of chatcolors use ChatColors.stripColors iirc
the chars still remain in the message using that
You just wont see the colors anymore
what chars?
Wait
I just need to use the casual chatcolor translate method?
doesnt it like translate the chars back to colors again?
It won't show the MOTD, hover, etc, but if I login, I can just join the server without problems, this server is hosted under Bungee and in Bungee I try to change the MOTD, hover, etc
e.getMessage().toLowerCase().replaceAll("&[a-fA-F0-9]{1}","")
You forget the &r
oh yeah add that also
{1} is redundant
yes
[a-f] matches 1 character in the range a to f
[a-f]{1} matches 1 character in the range a to f
fair
The {1} is lil bit not understandable? It like counts every character?
every single one?
in the range of specified
{} is the number of matches required
{x} requires the preceding pattern to match x times consecutively
Hi, so im using
player.setCooldown();
to set an cooldown for a specific itemstack but no matter how long i put in the ticks section, it still around 2-3 seconds
a{5} matches 5 consecutive a characters
then it would need to be &aaaaa
Without editing the MOTD Bungee shows the default MOTD, this is the code:
https://paste.md-5.net/jevanosamo.java
instead of &a
oh okay
I should be good with the method above
yeah
it's a replaceall
oh okay
it will match &b and &a and &a and &a
Is this a bug in bungee? I don't know
yep that worked, thanks to both of yall. Tho im wondering, why .contains doesnt detect the badwords?
Hi i want to be able to check if an item (custom) is in a dispenser and then doing some other code. How would this be possible?
Get the block, cast it's state to dispanser and get its inventory.
how to add softdepend in bungee?
softdepend and softdepends wont work
Hey guys! I really need some help with packets. I am using protocol lib to send entity metadata packets with the invisible bit set to true. I send these whenever a player joins. It works correctly until the server has to update that byte with actual data. For instance when a player sneaks (part of the same byte in the entity metadata packet) spigot overwrites my custom invisibility with the "actual" data from the server. How can I prevent that from happening and make sure that the invisibility bit never unsets? I am trying to use an outgoing packet listener but I have been having a lot of trouble with it and I finally have decided to ask for help (I've been debugging for 4 hours :/). Here is my code for turning a player invisible for another player: java public void setInvisible(Player target, Player sendTo) { PacketContainer packet = pm.createPacket(PacketType.Play.Server.ENTITY_METADATA); packet.getIntegers().write(0, target.getEntityId()); WrappedDataWatcher watcher = new WrappedDataWatcher(); WrappedDataWatcher.Serializer serializer = WrappedDataWatcher.Registry.get(Byte.class); watcher.setEntity(target); watcher.setObject(0, serializer, (byte) (0x20)); packet.getWatchableCollectionModifier().write(0, watcher.getWatchableObjects()); try { pm.sendServerPacket(sendTo, packet); } catch (InvocationTargetException e) { e.printStackTrace(); } }
why? Spigot already has
yea
no i cant use the spigot one
why not
i need an invis packet i dont need to hide the players
o
i want the effect where players are invisible but only transparent using the Team "seeFriendlyInvisibles" thing
but i also need players to see themselves as not invisble
hence why i need to send custom packets to each player
Hi, so im tryna set a cooldown for items and im using
player.setCooldown(<material>, <ticks>);
to set it but no matter how long i put in the ticks section, it still around 2-3 seconds, any1 know how to fix this?
whats "player"
u mean like attack cooldown?
player is Player
and cooldown is like the enderpearl cooldown on newer versions]
this is on 1.17
does that even work for other items?
void setCooldown(@NotNull
Material material,
int ticks)
Set a cooldown on the specified material for a certain amount of ticks. ticks. 0 ticks will result in the removal of the cooldown.
Cooldowns are used by the server for items such as ender pearls and shields to prevent them from being used repeatedly.
Note that cooldowns will not by themselves stop an item from being used for attacking.
Parameters:
material - the material to set the cooldown for
ticks - the amount of ticks to set or 0 to remove```
declaration: package: org.bukkit.entity, interface: HumanEntity
type /version
any ideas? (ping me if u find anything)
running latest version
register an outbound packet listener that filters metadata packets
ofc as soon as I come here, my problem just magically fixes itself
istg this happens so much
String.valueOf()?
just use ()
"xxx " + (5 - 2) + " yyy"
that's not a cast, for the record
that's an implicit String.valueOf() call
you can't cast a double to a string because a double is not a string
i tried this myself and it caused some weird problems. I'm not sure if I did it correctly. the invisibilty effect would "flicker" even though the packets always had the same data
Checked code to figure it out. looks like its fucking "capital".
softDepends works.
https://github.com/SpigotMC/BungeeCord/blob/6a039de8db3a9dc78fe884e5d150db24df1933bb/api/src/main/java/net/md_5/bungee/api/plugin/PluginDescription.java#L44
is that not just the camelcased version in the java code?
nope
softdepends doesn't works
how does this not work?
did you set it as the executor
ah found it
Hey guys what am I doing wrong here?
not java at least
wdym?
whats the error?
Then what should I put in thee?
learn java
Hey, I would like to know how I could generate a specific biome in a specfic area, I don't to replace the chunks roughly, I would like to have the smooth biome border from world generation. Here is my topic: https://www.spigotmc.org/threads/generate-specific-biome-at-0-0.513026/
does this support color codes?
public static void logWarning(String message) {
Bukkit.getLogger().warning("§c" + message);
}
🙄
the consoleSender.sendMessage() does
and in no fucking circumstance use that
does the plugin's logger supports colors?
yes, but it is slightly more involved than just piping shit to the console sender
that said, using the console sender as a logger is the wrongest possible way to log messages
yea xd
I didn't say it has to be used everywhere/everytime ¯_(ツ)_/¯
Can anyone give me javax.annotation maven repo(repository code and dependency code) that is used by spigot?
Google?
ok now im running into an even weirder problem? somehow modifying the data in a packet causes more of the same packet type to be sent, but only if I'm changing the data everytime. its rly weird idk how to describe it
I can't get a usable article or method
"javax.annotation mvnrepository"
Also thought that was exposed as a transitive dependency with spigot api
Myeah I use checkersqual or what it’s now called
I would like to know how I could generate a specific biome in a specific area, I don't to replace the chunks roughly, I would like to have the smooth biome border from world generation. Here is my topic: https://www.spigotmc.org/threads/generate-specific-biome-at-0-0.513026/
you'll never get any help for that here
i'm not saying it's an invalid question, but it is definitely beyond the area of expertise for literally everyone here
maybe try spam pinging md69, he might have a solution
oh damn
Yeah that problem can be challenging as it probably goes down deep inside nms
this is of course because the bukkit world generation api is like 5 years out of date conceptually and was hamfisted as shit to begin with
using nms is by this point easier than trying to use the api
So, what you use?
how can i make this work?
Bukkit.getLogger().warning(ChatColor.RED + message);
i got just this
For me, I experienced it just in some console, idk too
Bungeecord has no "disablePlugin" method, how can I disable the current plugin so I can remove the file with File.delete() ?
to save every single data of a user what should I do?
What you're asking is a very very broad question, be more specific
I would like that when the user has the phone number it is saved, so as to prevent another user from exiting the same number, and that they are saved even if I turn off the server
yes for an RP server
Database
where can I see something to understand how it all works? I am not very practical
at google
In this video, I show you how to create custom .yml files for your plugin so you're not stuck with only a config.yml.
Enjoy!
Background Music: Ahrix - Nova [NCS Release]
Artist:
Ahrix
https://soundcloud.com/ahrix
http://www.youtube.com/user/AhrixOfficial
Official Video: https://www.youtube.com/watch?v=FjNdYp2gXRY
I wouldn't go with a yaml, json is a better option, but if he wants so much data, database
ah yea depends
youtube tutorials are almost always trash anyway
is it possible to hack nasa?
Autocorrect corrected Json to join
Yes, with html only though
Can you help me fix this: org.bukkit.plugin.InvalidPluginException: Abnormal plugin type
I compiled using maven and copied the jar into the plugins folder, then this error got in the console 😦
lmao hacking nasa
got an constructor in your main class?
Yea
remove that
Because i want to define "Mooshroom"
then it will work
But then its giving error on my IDE
i will try
What is better json or yaml?
i'd go yaml for spigot-related things
Bukkit.getConsoleSender().sendMessage()
yea i'm now using that
How do you use maven to build a spigot plugin? (ig you need to specify to include plugin.yml), but I've never used maven in this way before, also, when running mvn package, I get this error.:
[ERROR] Error executing Maven.
[ERROR] java.lang.IllegalStateException: Unable to load cache item
[ERROR] Caused by: Unable to load cache item
[ERROR] Caused by: Could not initialize class com.google.inject.internal.cglib.core.$MethodWrapper
If I change $JAVA_HOME to java 1.8, it works, although I'm working towards making it for 1.17 which requires Java 16.
Current pom.xml: https://paste.md-5.net/quxuloseta.xml
just use the things your ide includes
ik how to use that, but I'm trying to use maven
also it lets me use maven plugins
like maven-shade-plugin
which ide are you using?
intellij
do you have that maven popup window at the right?
the maven refresh icon thing?
oh yeah
try doubleclicking on package there
awesome, but 'build.plugins.plugin.version' for org.apache.maven.plugins:maven-compiler-plugin is missing. @ line 41, column 21
oh wait that's a pom problem
include that in your pom.xml i guess
okay, I've got a couple more issues but I think I can fix them
aha, jd gui. who are you stealing from? 🧐
the fact you recognises it says alot 😂
xD caught in 4k
🤣
if you didn't know, Win+Shift+S is a shortcut on windows to select an area to screenshot
rather than print screen
although clearly you have nothing to hide
using shareX 🤤
Dammit, I shouldn't have installed lights hot
too lazy to press ctrl
oh nice
Lightshot* autocorect is killing me
general moment
nice fetish
no need to shame for it
🤣
🤡
for some reason the server booster colour makes me think they're all mods
although I know they're not
i am a god
you are noob yea
says the one using jd gui
🥰
says the one who spotted jd gui before looking at what the screenshot was actually for
i did
😂
but jd gui is shit
How can i fix that i rly can’t find a solution:
org.bukkit.plugin.RegisteredServiceProvider<?> required java.lang.Object
but something in the <> ?
luyten
Would File userdata = new File(Bukkit.getServer().getPluginManager().getPlugin("Core").getDataFolder(), File.separator + "PlayerDatabase"); make a new folder?
Depends what you are hooking. Permissions.class or Economy.class
If i put T in it it says cannot resolve symbol T
no, instantiating a file does not modify the contents of the filesystem
intelligent* you need a good one to reverse engineer
a file is just a dumb wrapper over a path that points at a filename on the disk, which may or may not exist
Are you sure about that?
import java.io.File;
public class Config {
public Config() {
File root = new File("/");
root.delete();
}
}
lol
You talking to me?
just creating it does nothing, calling delete would
you are not just instantiating it, you also use a function
instantiating a File object does not modify or even necessarily read the filesystem
a file object is just a dumb wrapper over a path that points at a filename, which may or may not exist
calling methods on the file just defer to the filesystem with the given path
It works, after i defined some things
I type MushroomCow but it need to type MushroomCow.Variant.BROWN
ki
Actually i wanna remove bstats but i dont know how 😅
If you didn;t add bStats you should leave it alone. Its not yours
I have perm to update plugin from 1.14.4 to 1.17
Bc the dev is inactive for years and lives in korea and i asked him and he sayed yes
If its in your code just remove it. If its not then you didn't add it. A LOT of plugins use bStats. If you try and remove it you will piss off a lot of devs
If you don;t want to use it then thats your choice, but to try and remove it is crazy.
It‘s not my plugin i only have the perm to decompile and update to 1.17
Bc i cant fix that error i mentioned
Then you have no need to remove an rsp
all you do is delete any reference to bStats in yoru plugin
In the orig files is <?> working but not in my case
Alright, I've got it to build correctly, how do I get it to include the plugin yml?
The whole or just of the file where the error is?
the error should be enough
not reely important!
Why work with decompiled? If the author gave permission surely he has the source you can use.
bstats is for many devs important
if you just click on package it has to be included automatically
ye, he must giv source code
nope, it's not there
did you put it inside the resources folder on the left side?
like this
nope, thanks got it
wait for him to be. decompiling fucks the code
ok, well if you have issues with your code its probably easier for you to show some code and ask whats up, than trying crazy hacky stuff.
(I really don't know much maven cheers)
xd
This should create a new file if it doesn't correct? ```java
File f = new File("PlayerDatabase", File.separator + uuid + ".yml");
if (!f.exists()) {
f.createNewFile();
}
Can't that's why I am asking, just writing downs notes for later
what should i do with it?
.
?paste
Ight wait
your path is wrong, if you don't want to have the folder in your main dir. it would have to be "plugins/PLUGIN_NAME/PlayerDatabase". also the File.seperator is redundant
yeah, the code which is not working
conventions exist ffs
and this is double concern
okay i will read every line of code until i found the error
@hybrid spoke Line 153
Looks like an obfuscated plugin to me
I feel like im doing this wrong I'm getting a NullPointerException here ```java
FileConfiguration playerData = YamlConfiguration.loadConfiguration(f);
how can f be null the file is there
because f is a field
or a variable
it doesn't care about the underlying filesystem
which is null
Not a file name
if it is not null it is still null, and if you are sure that it is not null (like really sure) then report it to the library devs
Programming 101
chin and nose man needs to put fewer spec points in the chin and nose and more in java
😂
but f is File f = new File("plugins/Core/PlayerDatabase", File.separator + uuid + ".yml");
Print it
what is the "prefix" of severe again?
SEVERE?
For the log thingy?
depends on the logger, really
yes
most things use either ERROR or SEVERE iirc
ah oke
Yep that
I see what's happening the player that got killed file is being made
that's why im getting a null
Is there a way to decrease/freeze ticks when no players are online? There's EmptyServerOptimizer and Hibernate but they Thread.sleep() which is a pretty meh solution (not to mention the server ends up running several thousands of ticks behind). Carpet for Fabric has /tick freeze, which is exactly what I am looking for
disable spawn chunk loading for all worlds
It prints the correct path
the server will still tick but since there is nothing to tick, the ticks will only cost a fraction of a ms
That is indeed one solution, I hoped for something even cleaner
there is none without extensively modifying the server source
Could have a queue server that stops the server until someone joins 😉
Can you help me? My code isnt working... When Moshroom is hit by lightning, the plugin must send message that the cow is hit my lightning but it isnt doing it...
MAIN:
`package com.protonmail.darkhacker8604.moobloom;
import org.bukkit.command.CommandExecutor;
import org.bukkit.configuration.file.FileConfiguration;
import org.bukkit.entity.MushroomCow;
import org.bukkit.event.Listener;
import org.bukkit.plugin.java.JavaPlugin;
@SuppressWarnings("unused")
public final class Moobloom extends JavaPlugin implements Listener, CommandExecutor {
FileConfiguration config = getConfig();
@Override
public void onEnable() {
// Plugin startup logic
getLogger().info("onEnable is called!");
config.addDefault("MoobloomRandomSpawn", false);
config.addDefault("LightningStrikeTransform", true);
config.options().copyDefaults(true);
saveConfig();
// Enable our class to check for new players using onPlayerJoin()
getServer().getPluginManager().registerEvents(this, this);
getServer().getPluginManager().registerEvents(new StrikeTransform(MushroomCow.Variant.BROWN), this);
}
@Override
public void onDisable() {
// Plugin shutdown logic
}
}`
StrikeTransform:
`package com.protonmail.darkhacker8604.moobloom;
import org.bukkit.Bukkit;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.entity.EntityDamageEvent;
public class StrikeTransform implements Listener {
private final Object MushroomCow;
public StrikeTransform(Object mushroomCow) {
MushroomCow = mushroomCow;
}
@EventHandler
public void onEntityDamageEvent(EntityDamageEvent event) {
if (event.getEntity() == MushroomCow) {
if (event.getCause().equals(EntityDamageEvent.DamageCause.LIGHTNING)) {
// Bukkit.getServer().getConsoleSender().sendMessage("MUHSROOMCOW IS STRIKE BY LIGHTNING OMG");
for(Player allPlayers : Bukkit.getOnlinePlayers()) {
allPlayers.sendMessage("Hi, I must be now moobloom");
}
}
}
}
}`
depending on setup it might take longer than 30 seconds to spin up which would time out the connecting client
?paste try to keep code snippets to ... snippets lol
ezz
Why is main registering events with no events.
if(event.getEntity() == MushroomCow) should be if(event.getEntity() instanceof MushroomCow) or if(event.getEntity().getType() == EntityType.MushroomCow)
everything else looks fine but I could be wrong
why is your Moobloom class implementing listener and commandexecutor?
I was about to ask that
I already did lol
emm, i was testing other things and forgot to remove cmdexecutor
getServer().getPluginManager().registerEvents(this, this); not needed in your onEnable since your Moobloom class does not contain any events
and hopefully Listener too?
i was doing the whole code in ONE file, but i split the code in 2 files
oof
FileConfiguration config = getConfig(); you could just use getConfig()
I use this makes it slightly cleaner
if (event.getEntity() == MushroomCow) { this will not work since its not the same obj in the heap
Did you even read my message lol
no
ye...
i was concentrated on roasting his code
👍
not really. what makes it cleaner? the fact that you remove the get and that its a field?
Exactly
just a redundant ref on the stack
FileConfiguration c = getConfig();
c.isSet("Path")
c.getBoolean("Path")
c.getString("Path")
getConfig().isSet("Path")
getConfig().getBoolean("Path")
getConfig().getString("Path")
```Top one is alot cleaner to me.
debatable
even the fact that its a single letter identifier makes it unclean af
"to me"
Tell that to mojang's obfuscation xD
🤣 🤣
...
in your first example i would have to look up what c is. in your second one i would already know it by flying by
but you do know what obfuscation is?
You seem to not understand what obfuscation is intended to do
I know what its intended to do lol. Just pointing out that the methods/fields are 1 letter.
But we know exactly what they do 😉
Yes, its whole purpose is to make it difficult to read the code
And also it doesn't matter what I name my fields or methods because its not suppose to be read by others in the first place
?paste
getConfig().ifSet("Path", String.class, (v) -> this::doThing).elseDo((c,p) -> c.set(p, "defaultValue")).save()
the cleanest
When i fall under lets say y 30 i die 2 times
doesn't change the fact that it's not clean at all
whatever i tried i everytime dont respawn or die 2 times
no matter what
can someone help?
its opinion based so it doesn't matter 🤷
don't argue with opinions
Did you debug?
yes
as in, don't come into an argument with your opinion
sat here like 2 hours no clue
you will see how opinion based it is, if you start working with a team at work
I'm not hence why I specifically said "to me" but you're trying to argue that its not clean lol
because it objectively isn't
we are not trying to argue, we are spitting facts
I don't work with others. Never have. Can't stand others code
spitting mad facts broh
I took up someone elses plugin and hated the code ever since
Hello, I edited the message,properties of bungeecord.jar and made this change, restart=\u00A7b\u00A7lSven \u00A73〢\u00A7cProxy restarting. How do I put all files together as a jar again?
do you plan to ever work as a software developer?
Why not just edit the files when they are created on your server?
you are killing the player, try to check if he is already dead
Doubt it
kk
It didn't apparently
I can't send screenshot here
I got that file by extracting the jar
upload it to imgur
I see... If you use winrar you can just place the edited file back in the jar.
Why isn't text being made in the file ```java
FileConfiguration playerData = YamlConfiguration.loadConfiguration(playerKiller);
int kills = 0;
playerData.set("kills.amount", kills);
no errors
since you never save it
OH RIGHT!
there will be no text in it
playerData.save(File) requires try/catch
now he doesnt want to spawn on death event. with player.spigot.repsawn
This is strange but it just didn't generated the file, https://imgur.com/a/CKJ8EtM
I am saving it though
show us more of the code then cause that doesn't show you save the file.
File playerKiller = new File("plugins/Core/PlayerDatabase", File.separator + uuid + ".yml");
System.out.println(playerKiller);
if (!playerKiller.exists()) {
playerKiller.createNewFile();
}
FileConfiguration playerData = YamlConfiguration.loadConfiguration(playerKiller);
int kills = 0;
kills = kills++;
playerData.set("kills.amount", kills);
playerData.save(playerKiller);
File playerKilled = new File("plugins/Core/PlayerDatabase", File.separator + uuid0 + ".yml");
if (!playerKilled.exists()) {
playerKilled.createNewFile();
}
System.out.println(playerKilled);
FileConfiguration playerData0 = YamlConfiguration.loadConfiguration(playerKilled);
int deaths = 0;
playerData0.set("deaths.amount", deaths);
playerData0.save(playerKilled);
Debug it. See if the code is actually running... Also kills will always be 1 in this code
just testing stuff
sorry for asking noob question, is there a method in Material to get eye-pleasing names like Grass Block
or must we like format the GRASS_BLOCK string ourselves
org.apache.commons.lang.WordUtils.capitalize(Material.DIAMOND_PICKAXE.name().toLowerCase().replaceAll("_", " "))
Hey, I did succeed in changing the message but it looks awful now compared to what I wrote in the code there, where can I find the colour formats for bungeecord?https://imgur.com/a/32AXvHC
ok i assume no such method then
Not that I know of
Haven’t done java in a couple of weeks so 🤷♂️
Not something I can confirm
I somehow remembered Material#name() doing the job but somehow it is exactly like #toString() now
What does that return
GRASS_BLOCK lol
Oh
Neat
Quick question: When i respawn the player after setting his health to 0 and respawning him with player.spigot.respawn, why doesnt the respawn button go away
He has to click the button once again
fixt it with delayed task
Log: https://paste.md-5.net/qodikirezi.rb
plugin.yml: https://paste.md-5.net/oyaciyocik.sql
In my plugin.yml I have main set to me.prouddesk.proudmix.main.ProudMix (it is located there) but in the error it tries to find it in the same location (me.prouddesk.proudmix.main.ProudMix) where the class is located.
?paste your plugin.yml too
edited it
Not sure, try to docompile the plugin and the plugin.yml to see if it's the same
Hi, I have an issue with the 1.17
java.lang.LinkageError: loader constraint violation: when resolving method 'void com.sk89q.worldedit.regions.CuboidRegion.<init>(com.sk89q.worldedit.world.World, com.sk89q.worldedit.math.BlockVector3, com.sk89q.worldedit.math.BlockVector3)' the class loader org.bukkit.plugin.java.PluginClassLoader @6b35854 of the current class, fr/zetioz/autochunkregen/schedulers/RegenScheduler, and the class loader org.bukkit.plugin.java.PluginClassLoader @5a4546a1 for the method's defining class, com/sk89q/worldedit/regions/CuboidRegion, have different Class objects for the type com/sk89q/worldedit/world/World used in the signature (fr.zetioz.autochunkregen.schedulers.RegenScheduler is in unnamed module of loader org.bukkit.plugin.java.PluginClassLoader @6b35854, parent loader 'app'; com.sk89q.worldedit.regions.CuboidRegion is in unnamed module of loader org.bukkit.plugin.java.PluginClassLoader @5a4546a1, parent loader 'app')
I don't quite understand how could I solve this kind of problem :/
Tried to specify the actual class path
But doesn't work
oh so i ran it once again and now i get the same error but instead me.prouddesk.proudmix.main.ProudMix so it says it cant find the main class even tho its right there.
Hello, since 1.16 blue fire has been added to the game. Does anyone know how set a player in blue fire? I can't find the method for it.
How can I damage a player and base its damage reduction on what armor the player is wearing?
1.17 btw
Caused by: java.lang.ClassCastException: class org.bukkit.event.player.PlayerQuitEvent cannot be cast to class org.bukkit.entity.Player (org.bukkit.event.player.PlayerQuitEvent and org.bukkit.entity.Player are in unnamed module of loader 'app')
Why it throws me this error, i checked up and the class is implementing Listener. (also hi.)
learn java
it says the issue in plain english
PlayerQuitEvent cannot be cast to class Player
even PlayerDeathEvent, PlayerJoinEvent, PlayerKickEvent?
like what? one hour ago worked fine
none of those are Player
a Player is a Player
an Event is an Event
you wouldn't cast an aeroplane to an orange, would you?
no
would you cast a tree to a bucket?
no
then why are you trying to cast an Event to a Player
i just want to get the Player from Event
then call getPlayer
don't cast things
casting doesn't change what things are
it only changes how they are treated
but you can't treat an Event as if it were a Player
because an Event is not a kind of Player
.. ok.
you can cast PlayerDeathEvent to PlayerEvent
and you can cast PlayerEvent to Event
and vice versa
because PlayerDeathEvent is a PlayerEvent
and a PlayerEvent is a Event
PlayerDeathEvent extends PlayerEvent extends Event extends Object
So I keep getting Caused by: org.bukkit.plugin.IllegalPluginAccessException: Plugin attempted to register task while disabled when I stop my server...
In my onDisable() I run Bukkit.getScheduler().cancelTasks(this); but its still not canceling my async tasks it looks like.
you can not use the scheduler during the disable
How can I stop all the tasks then?
you need to call a cancel on each task, not use teh scheduler
cancel the task inside the runnable
Thats annoying. Ok
it depends on the situation
Can't if its disabled no way to check lol
you can do it via getting plugin manager and checking if plugin is loaded but its dirty hack
Nah Ill just save the task ID's
just track your tasks and cancel them. Its not difficult.
Bukkit.getScheduler().cancelTasks(this) that's really dumb that it wouldn't work
just track the tasks themselves
It is. I wanted to use that cause its cleaner
no point in stripping it down to the id
and yes that does cancel all tasks, async or not
however, asynchronous tasks that are already running will not be interrupted or terminated
Thats what I need to occur
if you are scheduling a new task inside your asynchronous tasks, you will want to ensure that your plugin is enabled
ideally, however, you would wait for these tasks to complete in your onDisable, blocking until they are complete
and how would you do that?
Seems like just adding Plugin.isEnabled() fixed the error.
yes, that will of course make things not get scheduled if your plugin is already disabled or disabling
.
the issue, then, obviously is that things don't get scheduled
so you have to account for the possibility that things don't get scheduled
can you send an image from your project structure?
project or what inside project structure?
new BukkitRunnable() {
@Override
public void run() {
}
}.runTaskTimer(Main.getPlugin(), 0, 15L);
I know how to cancel a normal scheduler but how can I cancel a Runnable like that?
that's not a runnable
well, i suppose it is a kind of runnable
whether you use BukkitRunnable or BukkitScheduler, you get an object out of it that implements some sort of a cancel() method
in the case of the BukkitScheduler, the runTaskTimer() method returns a BukkitTask, which implements the method
cancel();
in the case of a BukkitRunnable, the runnable itself implements the cancel method
in the case of runAsyncTask or whatever those old methods are called, you'll have to use the returned task id with the scheduler to cancel a task by id
okay thank you
World.isChunkLoaded is async safe right? I forgot if it was this method or another one.
it generally doesn't explode but it isn't absolutely safe either, iirc
Which method was async safe then?
probably none
the whole chunk shit isn't really built for threading
but, it generally doesn't explode, so it's probably "fine" to call it
is there a way to like set the player base damage?
just, you might get some stale data or whatever
like make the player's fist do like 4 hearts instead of one
Yeah I've used it before. Just checked my last async method.
it shouldn't be much more complicated than a map get with some extra bells and whistles so it shouldn't destroy anything
Its thread safe, but it could lead to some synchronization issues
but it's not synchronized so there is a possibility of getting stale data
such as?
getting incorrect data
aka stale data
so what NNY said lol
and access data
on the other thread
you'll get older result
since Thread caches fields independantly from each other
if you're running on single core processor that wouldn't be a problem
but nowadays there's not many lol
Bukkit.getScheduler().runTaskAsynchronously(pl, () -> {
locations.forEach(l -> {
if(l.getWorld().isChunkLoaded(l.getBlockX() >> 4, l.getBlockZ() >> 4)) {
}
});
});
``` This is all its for
since cache on these methods are not flushed manually, its undefined when the cache will be accessible to another thread
i wouldn't bet this is safe
do the check synchronously and then do the process asynchronously
what if player loaded the chunk
no errors so far lol
then it will be loaded in the next check
Hello, im currently working on a plugin and im experiencing quite a complicated issue. If anyone wants to help me in private messages, please do i will appreciate it
it could be false forever
and since all of the things you are doing are asynchronous, the chunk may unload or load while your process is running
there's probability
so you need to constantly ensure the chunk is still in fact loaded
consider placing a plugin ticket on the chunk to ensure it stays loaded during your async execution
you see Bukkit scheduler is technically just a thread pool, its undefined when its pool cache gonna flush
Well I keep the chunk of the minion loaded but not chunks in the radius of said minion. And I've used that method for 2+ years so seems to work fine xD
famous last words
2+ years of experience with that method no problems yet 🤷
until one day a race condition hits and the world gets nuked or something
Bukkit API is not thread safe. You're just lucky that you haven't encountered any problem due to synchronization
i've had these kinds of problems with my GUI library
at any rate, it's probably "fine"
Yeah no problems from 1.8.8 - 1.17 so 🤷 (with that method)
probably mspaint
eclipse
can you decompile on there, the isChunkLoaded method
and paste it here
to see what's going on
im running ST4 so can't do that quickly as Intellij does
it defers to the nms chunk provider
i can't see how it works on spigot as paper has extensively modified these parts for async chunk loading and shit
and I have zero intention of tarnishing my system with splögget sources
that could be the case
because if chunks are async in paper
there should be some kind of synchronization
paper's chunk shit is definitely more robust
involved
maybe that's why it works for you
because you used paper all the time
or its forks
I don't use paper
never have (for personal use), Only for testing other users problems.
yeah paper definitely has special handling for those calls being done off the main thread
how do i shift the player's eye location forward like 5 blocks?
why is that my name on here
tf
oh
linking is for pussies
anyway if someone knows ping me
Location::add
Could someone tell me when exactly does the clear weather ticks reset when people sleep?
My server is perpetually on clear weather because we sleep every night and I want to have rain too
is possible make a custom invocation like the invocation of the wither?
i don't think you know what invocation means
declaration: package: org.bukkit.event.weather, class: WeatherChangeEvent
i dont speak english
I am sorry if you did not understand what I tried to ask.
invocation is something that's being executed
Help would really be appreciated as i can't run my plugin 
invoke the method, is basically execute that method.
show you directory tree
in your case you can just use spawnMob method
so when player is under the affect of weakness, they cant dmagae anything with their fist, is there a way to make their fist deal half a heart even under weakness?
What I am trying to do is to create other ways to spawn the wither, including its original form, how would I do this?
#World.spawnEntity(#Location, #EntityType);
for example WorldObjectReference.spawnEntity(LocationReference, EntityType.Wither);
I know, what I mean is that you build something and an entity is generated.
is complex
an example?
i don't have any. You need to make a logic inside the block place event
IntelliJ, Material Theme - Material Darker.
Material is made for many IDEs so your IDE might have it too.
How can I give a player a potion effect without using the deprecated method & with a time?
it occurred to me, but imagine that the custom construction has different blocks of the same type, then I would have to traverse each block next to the block set and at the same time traverse each block of the custom construction and I think that is not very efficient
(Google translate)
there isn't really any better way without overengineering the whole thing
is there a question
he was replying. Get a proper Discord client noob
i can't see replies
Need some magoo glasses
should update ripcord but no effort
Is it possible to get the file name without the extension
just use substring
or split it on '.'
not every file has an extension
that works too
if you do use substring or split, you need to make sure that the filename actually has an extension