#help-development
1 messages · Page 2062 of 1
is there a method like this for doing that using a circular radius? or no
You'd have to make your own
alright
thanks
but it should just be a continual task then?
that wouldnt ruin my tps right?
I think I just found the issue...
I made actualZ to actualX the whole time...
Ah yeah that'll do it 
is there any way to download all minecraft assets?
packaged in a zip
or something
no java classes
from a mojang api or something like that
you mean the default resource pack?
yeah
i don't think so
Isn't most of it just in the JAR?
yes sure
So go steal it out of that 
i mean i could download the jar and only extract the assets
thanks
ill look into it
maybe he doesn't play MC
but i need everyone that runs the server to have it
maybe he only codes plugins and never tried them
oh yes of course
my mistake
i cant rely on the host computer to have all the jars
Huh
if(!(section.contains(key + ".title") &&
section.contains(key + ".world") &&
section.contains(key + ".min.x") &&
section.contains(key + ".min.y") &&
section.contains(key + ".min.z") &&
section.contains(key + ".max.x") &&
section.contains(key + ".max.y") &&
section.contains(key + ".max.z"))) continue;
Is this the best way to write such an if statement?
oh god no
xD
What the hell is section and key and are you really sure that you cannot just get rid of the (implicitly) uncached string builder?
If it has key x you can assume it has y and z as well
It's for ittering through a ConfigurationSection:
private ArrayList<Koth> getKoths() {
final ArrayList<Koth> koths = new ArrayList<>();
final ConfigurationSection section = DataConfig.get().getConfigurationSection("koths");
for (final String key : section.getKeys(false)) {
if(!(section.contains(key + ".title") &&
section.contains(key + ".world") &&
section.contains(key + ".min.x") &&
section.contains(key + ".min.y") &&
section.contains(key + ".min.z") &&
section.contains(key + ".max.x") &&
section.contains(key + ".max.y") &&
section.contains(key + ".max.z"))) continue;
final String title = section.getString(key + ".title");
final String worldName = section.getString(key + ".world");
final World world = Bukkit.getWorld(worldName);
if(world == null) continue;
final int minX = section.getInt(key + ".min.x");
final int minY = section.getInt(key + ".min.y");
final int minZ = section.getInt(key + ".min.z");
final Location min = new Location(world, minX, minY, minZ);
final int maxX = section.getInt(key + ".max.x");
final int maxY = section.getInt(key + ".max.y");
final int maxZ = section.getInt(key + ".max.z");
final Location max = new Location(world, maxX, maxY, maxZ);
final CuboidSelection sel = new CuboidSelection(world, min, max);
koths.add(new Koth(sel, title, this));
}
return koths;
}
My point still stands
Why?
I do not see the need for the if statement...
Because you wrote it that way?
One should assume that where there is a title all the other values will follow
I think you can assume that all keys are present considering this does not look like something that is configurable
Just tell them no touchy
Or store it internally
If I was to write the software I'd use my favourite class (DataOutputStream) instead of configurations - far faster that way and people will not be going to try to edit the values
It is saved via command, but I also wanted to make it so that the player can edit it in the config. If a key is missing, it breaks.
at best - log an warning message that a key is missing
Okay, thanks for helping everyone
The command shouldn't be screwing up a save so there is no reason to check key existence
any front end dev?
any idea how do i set nbt data to an entity in 1.18.2?
how do i make an aside tag stick to the right
using right property in css makes it unresponsive
float:right; doesnt work
?pdc
I'm trying to serialize a ItemStack by Gson, but it throws
java.lang.IllegalArgumentException: class org.bukkit.craftbukkit.v1_18_R2.inventory.CraftMetaEnchantedBook declares multiple JSON fields named enchantments.
Actually it's caused by CraftMetaEnchantedBook. I noticed ItemMeta has a serialize method, but there's no deserialize method?
looks cool
Bukkit.getWords().get(1) is the nether world
you can probably just do .equals on it but comparing the names would work too
make me a storage design
any idea why all of my zip entries have size -1
probably meaning that couldnt be read
I need help putting a hashmap into a yml file
you can also use uuid's with worlds if that matters
I crated the yml file already but idk how to add the hashmap stuff in
config.set(key, map.get(key))
what is hashmap?
an extension of map that uses hashes
Hey guys im making a plugin that interacts with pearls. Is there a way to get the pearl entity in the playerteleport event? (like in projectilelaunch event)
basically i need to get the ender pearl entity here```java
public class ListenerPearl implements Listener {
@EventHandler
public void onPearl(org.bukkit.event.player.PlayerTeleportEvent e) {
if (e.getCause() == org.bukkit.event.player.PlayerTeleportEvent.TeleportCause.ENDER_PEARL) {
e.getentity here
lets gooo i did it it works
shit
i wanted to disable pign
sorry
You're good, glad it works
If you're unsure use equals
I'd expect == to work though but you might have to do some testing
like this?
economyConfig.set(economyManager.playerEconomy.keySet().toString(), economyManager.playerEconomy.values());
Yes
Yes
oh ok
for (String keys : economyManager.playerEconomy.keySet()){
economyConfig.set(keys, economyManager.playerEconomy.values());
}
like that?
get
yes
how would you teleport a player using specific coordinates in spigot?
by using the teleport method
alr
i made a website
to store any image and view it online
i think ill make an app now
that captures ur screen
lol
and uses ftp to put it in the server
so i can screenshot and give people the image without the file being on my pc
:D
but i have a problem
my website description
top secret ok but i have to hover my mouse over every elem to read it ;-;
is getting removed when i use its domain
You heard of snipping tool?
ayy this is a filter which i can remove
my domain is removing my website's (which im cloak forwarding to) description
how do i stop it
from doing that
and btw
if my website has smth like
url/page.html
and im having a domain cloak forwarding to url
domain/page.html doesnt work
so if i have
qwe.rty.uio/abc.html
and a domain cloak forwarding to that url (asd.fgh)
asd.fgh/abc.html does not work
yea but how do i store xyz into a location
and <meta description....> of qwe.rty.uio doesnt work with asd.fgh (doesnt move to it)
create a location object
no shit sherlock, i asked how to store x y and z values in a location object, may you please tell me how to do that or ill be on my merry way
a very nice way to treat someone that shouldve blocked you from your question
if you don't know how to create an object in java
then you probably should learn java
?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.
oh my goodness i asked how do i store xyz values in a location object e.g. `Location example = //how do i use xyz values here
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.
Location location = new Location(world,x,y,z);
not sure what is hard about that unless you don't know java
you guys are assholes
so please go learn java basics before asking basic questions
Yes we are because you are looking to be spoonfed instead of learning java like everyone else has
?spoon
Spoonfeed a newbie for a day and they'll come back with more questions. Teach them to find their own answers and you'll both be better off: you won't get stuck answering the easy questions and they'll be much more productive than before.
i asked a simple question because i didnt know what to do, least you can do is not be an asshole about it
?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.
children where
what
Now let's be nice guys he can also try learning kotlin
There are plenty of other jvm languages
no he should learn scala
Really? I thought there were more
Java
Scala
Kotlin
Groovy
Clojure
Yeye what is Scalas thing that makes it great
scala sucks
Lol
always nice to have a child calling others children. If you are indeed an adult, then its a shame you rather not bother learning basics of java
a nice example you are 🙂
I wanna make a cube is there a more efficient way than this?
for(int x = minX; x<maxX;x++){
for(int y = minY; y<maxY;y++){
for(int z = minZ; z<maxZ;z++){
Location loc = new Location(world, x,y,z);
loc.getBlock().setType(Material)
}
}
}
how does bukkit about the "double annotations" javadoc bug?
I use the exact same javadoc plugin version as bukkit :<
how does what?
Eh that code looks fine no need to overoptomise
erm
I mean how did they fix it
annotations show up twice in the javadocs
but bukkit somehow doesn't have this problem in their docs
do you add documentation?
if you don't add documentation stuff to methods, then the javadoc will just use what is in the method instead
it's definitely bugged
/**
* Creates a DataType holding a {@link Hashtable} of the given DataTypes
* @param keyType The existing DataType for the map's keys
* @param valueType The existing DataType for the map's values
*/
static <K, V> MapDataType<Hashtable<K,V>,K,V> asHashtable(final @NonNull PersistentDataType<?, K> keyType,
final @NonNull PersistentDataType<?, V> valueType) {
return asGenericMap(Hashtable::new, keyType, valueType);
}
it anyway adds @ NonNull twice EVERYWHERE
:<
they appear correctly in the summary table
guys what does this mean
java.lang.RuntimeException: java.io.IOException: The process cannot access the file because another process has locked a portion of the file
at net.minecraft.server.MinecraftServer.loadWorld(MinecraftServer.java:610) ~[patched_1.17.1.jar:git-Paper-266]
at net.minecraft.server.dedicated.DedicatedServer.init(DedicatedServer.java:306) ~[patched_1.17.1.jar:git-Paper-266]
at net.minecraft.server.MinecraftServer.x(MinecraftServer.java:1212) ~[patched_1.17.1.jar:git-Paper-266]
at net.minecraft.server.MinecraftServer.lambda$spin$0(MinecraftServer.java:319) ~[patched_1.17.1.jar:git-Paper-266]
at java.lang.Thread.run(Thread.java:833) [?:?]
Caused by: java.io.IOException: The process cannot access the file because another process has locked a portion of the file
at sun.nio.ch.FileDispatcherImpl.write0(Native Method) ~[?:?]
at sun.nio.ch.FileDispatcherImpl.write(FileDispatcherImpl.java:68) ~[?:?]
at sun.nio.ch.IOUtil.writeFromNativeBuffer(IOUtil.java:132) ~[?:?]
at sun.nio.ch.IOUtil.write(IOUtil.java:76) ~[?:?]
at sun.nio.ch.IOUtil.write(IOUtil.java:67) ~[?:?]
at sun.nio.ch.FileChannelImpl.write(FileChannelImpl.java:285) ~[?:?]
at net.minecraft.util.SessionLock.a(SessionLock.java:40) ~[patched_1.17.1.jar:git-Paper-266]
at net.minecraft.world.level.storage.Convertable$ConversionSession.<init>(Convertable.java:338) ~[patched_1.17.1.jar:git-Paper-266]
at net.minecraft.world.level.storage.Convertable.c(Convertable.java:308) ~[patched_1.17.1.jar:git-Paper-266]
at net.minecraft.server.MinecraftServer.loadWorld(MinecraftServer.java:608) ~[patched_1.17.1.jar:git-Paper-266]
... 4 more
i cant start my server
The process cannot access the file because another process has locked a portion of the file
Exactly what the log says, what do you think is causing this?
someone have idea for why getBlockData of CMI doesn"t work ?
@tender shard Hey you helped me with a problem with BuildTools and remapped jar but after I compiled BuildTools.jar with the --remapped parameter there is the same error :
- What went wrong:
Execution failed for task ':compileJava'.
Could not resolve all files for configuration ':compileClasspath'.
Could not find spigot-1.18.1-R0.1-SNAPSHOT-remapped-mojang.jar (org.spigotmc1.18.1-R0.1-SNAPSHOT:20211220.014539-2).
Searched in the following locations:
https://repo.dmulloy2.net/nexus/repository/public/org/spigotmc/spigot/1.18.1-R0.1-SNAPSHOT/spigot-1.18.1-R0.1-20211220.014539-2-remapped-mojang.jar
hi
private OfflinePlayer getOfflinePlayer(String name) {
OfflinePlayer[] players = plugin.getServer().getOfflinePlayers();
for (OfflinePlayer op : players) {
if (name != null && name.equals(op.getName())) {
return op;
}
}
return null;
}
this or OfflinePlayer#hasPlayedBefore
which is better
I am trying to make a plugin to change your name with packets, but i get lost y sending packets to everyone except the player that issues te command. Can anyone help me with this?
did you add mavenLocal() to your repos?
did you build 1.18.1 with --remapped?
if the only location it searched is dmulloy2.net then it didnt seach locally
Yes I even asked you if the thing that I was going to execute was correct
.
Yes it's in
ayo boys how can i get if a player is breaking a tree?
yeah but how should i get if it's a tree
Try to get if it is a log?
Can see if the log is connected to a leaf
Any reason why you aren’t just using Bukkit#getOfflinePlayer()?
how do you do that?
You are going to have to write your own detection method for detecting trees. You can use TreeFeller plugins as a good starting reference, but you also have to define the scope. What constitutes a tree? Should you just check for default trees? What about player made trees? Etc etc
@kind hatch Do you know how to send packets to ervryone except one player?
Loop over every player and exclude the person who you don’t want to see it.
I know but how?
How can i not loop that one player
Collection<? extends Player> online = Bukkit.getServer().getOnlinePlayers();, i cant just remove a player out of this collection
Make a copy of the online players array and remove the player. Or you could add a check to see if it’s a specific player.
I have tried to make a copy but i still can't edit it
because i'm trying to get a existing player
if it not exists then i will not execute
Hmm. Well that’s the point of making a copy. So that you can modify it. How are you doing that?
Collection<? extends Player> players = new ArrayList<>(online);
no idea then
Or do i need to use addAll?
RIP I just released this in an update
int statistic = player.getStatistic(Statistic.PICKUP,item.getType());
player.setStatistic(Statistic.PICKUP,item.getType(),statistic + pickedUpAmount);
5 minutes later I see that player.incrementStatistic exists >.<
this
cuz if u use hasPlayedBefore
u will have to Bukkit.getOfflinePlayer()
which if the player hasnt joined before itll send a request to mojang servers
a blocking request btw
looping through players that have joined before is better than that
since ur not gonna use the offlineplayer except if he played before therefore u will avoid pointless blocking requests
yikes
I’m pretty sure you can just do something like this.
List<Player> online = new ArrayList<>(Bukkit.getServer().getOnlinePlayers())
yeah but dont
instead
Set<Player> onlinePlayers = Sets.newHashSet(Bukkit.getServer().getOnlinePlayers());
Why would that make a difference?
incrementStatistic probably does the same anyway 😄
it does
ur using arraylist which doesnt make sense for it to be ordered
Who said it had to be ordered?
You
When?
its not supposed to be ordered
you use a set when you want to assure that stuff cant be added twice
a hashset is sorted too
Yea and I don’t think there can be duplicate players
that's what i meant
hashset isnt ordered
it is
tbh it doesn't matter at all which one you use
what
but it isnt sorted
yes but it has an order
yeah it says that but I never experienced a situation where it actually changed the order
just not a useful one
anyway, who cares, use a list, or set, whatever, it makes no difference
its not ordered in a way you can access an element from an index
a set is more appropriate
a set is to ensure that there are no duplicate elements
- you do not need it being ordered so you dont need arraylist feature
- there wont be duplicate players so you dont need arraylist feature
there won't be any duplicate players so you can use any collection you like
I would use arraylist if there would be duplicates
otherwise Set
just makes sense to me
You do know that getOnlinePlayers changes all the time right? Trying to get a player by an index would t work at that point.
the set checks on every add() whether it already exists this thing
Mhm, thank you for proving my point
When i trie to use this is stil send packets to all player, i remove the player by:
Player p = Bukkit.getServer().getPlayer(player.getName()); //player is the player that did the comamnd
List<Player> online = new ArrayList<>(Bukkit.getServer().getOnlinePlayers());
online.remove(p);
and
What does it matter if they are looping over the whole array anyways?
tho idm I mean, both ways you guys provided would just return a defensive copy
IT DOESTN
not like you instantiated a view
That looks fine, you just need to loop over the new array you created.
And how do i do that?
for every player in online
Send packets
I use this to send packets ```for(Player all : online) {
Hi i have discovered a bug or something similar with maven modules, because when im creating a multi module maven project. And i create a new module that its not a parent module its doesnt resolve any dependencie
Your on the right track. You just need to send the packets at that point. I gotta go though. Lunch break is over.
Btw @tender shard
i use:
for(Player all : online) {
PlayerConnection connection = ((CraftPlayer) player).getHandle().b;
connection.sendPacket(new PacketPlayOutEntityDestroy(ep.getId()));
connection.sendPacket(new PacketPlayOutNamedEntitySpawn(ep));
}
```
add the keyword java after the 3 chracter for code formating
- You dont need its feature that allows duplicates
- You dont need its feature that allows maintaining insertion order
- You can use HashSet and benefit of the hashing feature as well
Because it does t really matter for their specific use case.
It does in the long term
Your code should always go under good practice, even in small projects
Please help!
I tried to make a plugin that changes the player's name, not on the tab, but above it (version 1.16.5) and there are no bugs, but the plugin doesn't work.
?ask
If you have a question, please just ask it. Don't look for staff or topic experts. Don't ask to ask or ask if people are awake or available. Just ask the question to the channel straight out, and wait patiently for a reply. Make sure you use the right channel regarding the topic of your question. Create a thread in case the channel is already in use!
The command doesnt work
?notworking
"Does not working" is a useless statement. Please describe what exactly is not working, what you expect it to do, and what actually happens. If you get any console errors, also ?paste the entire stacktrace.
finally
code:
ScoreboardManager sm = Bukkit.getScoreboardManager();
Scoreboard scoreboard = sm.getNewScoreboard();
Team team = scoreboard.getTeam("inc");
if (team == null) {
team = scoreboard.registerNewTeam("inc");
}
team.setPrefix("§c[INC] ");
team.addEntry(s.getName());
return;```
You need the main scoreboard
generating a new scoreboard each execution?
How?
wow.
getMainScoreboard
ScoreboardManager has literally 2 methods kekw
Agree with you
The code i use =
public class Nick implements CommandExecutor{
@Override
public boolean onCommand(CommandSender sender, Command cmd, String label, String args[]) {
if(!(sender instanceof Player)) {
sender.sendMessage(ChatColor.RED + "You need to be a player for this command!");
return false;
}
if(cmd.getName().equalsIgnoreCase("nick")) {
Player player = (Player) sender;
EntityPlayer ep = ((CraftPlayer) player).getHandle();
for(Player all : Bukkit.getOnlinePlayers()) {
PlayerConnection connection = ((CraftPlayer) player).getHandle().b;
connection.sendPacket(new PacketPlayOutPlayerInfo(EnumPlayerInfoAction.b, ep));
}
try {
GameProfile playerProfile = ((CraftPlayer) player).getHandle().getProfile();
Field ff = playerProfile.getClass().getDeclaredField("name");
ff.setAccessible(true);
ff.set(playerProfile, args[0]);
player.sendMessage(args[0]);
} catch (Exception e) {
e.printStackTrace();
}
for(Player all : Bukkit.getOnlinePlayers()) {
PlayerConnection connection = ((CraftPlayer) player).getHandle().b;
connection.sendPacket(new PacketPlayOutPlayerInfo(EnumPlayerInfoAction.a, ep));
}
Player p = Bukkit.getServer().getPlayer(player.getName());
List<Player> online = new ArrayList<>(Bukkit.getServer().getOnlinePlayers());
online.remove(p);
for(Player all : online) {
PlayerConnection connection = ((CraftPlayer) player).getHandle().b;
connection.sendPacket(new PacketPlayOutEntityDestroy(ep.getId()));
connection.sendPacket(new PacketPlayOutNamedEntitySpawn(ep));
}
}
return false;
}
}
?paste
Done
Why 3 for loops 👀
I have seen that too
setAccessible
I need to sebd some packets first
It is not a field
u should make it false after you finish I think
Done just 1 loop and do all stuff inside the loop?
Field ff = playerProfile.getClass().getDeclaredField("name");
mmm
This is a field as far as i can see
also dont create an arraylist for that
I need to send two packets to everyone
and two to everyone except the player that issued the command
How, i don't know a thing about packets
you're creating a new packet every iteration
this is a mess
Im not even talking about packets
Why are you checking what the command name is?
It already should trigger if you've registered it properly
Prob he dont know the basics about java
Where by cmd.getName?
agree, that why exists
getCommand("command-name").setExecutor(plugin, new CommandClass())
^
So i can use unnick later
because the hashset checks contains() everytime you add something
because the hashset checks contains() everytime you add something
That doesnt change anything
hashset performance is better than arraylist eitherway
ScoreboardManager sm = Bukkit.getScoreboardManager();
Scoreboard scoreboard = sm.getNewScoreboard();
sm.getMainScoreboard();
Team team = scoreboard.getTeam("inc");
if (team == null) {
team = scoreboard.registerNewTeam("inc");
}
team.setPrefix("§c[IC] ");
team.addEntry(s.getName());
return;
}
}``` it still does not work
afaik
depends on the size and when you only iterate, it won't be faster
Hi, I'm writing my first plugin and I have a problem with config, I can't make some lines in the mysql line and I still have an error there
but as I already said, noone cares whether it's a set or a list
I would still use Set
there is no field called "getConfig"
getConfig() is a method
i wouldnt use a class that has 2 features i dont ever need
just cuz it MIGHT have better performance
yes and for me the "unneeded feature" you are talking about is the contains() check
but I said it 10 times already, noone cares whether to use a set or list
?
But how can i send packets to all players except one?
is that even in your class that extends javaplugin?
getConfig() is a method defined in Plugin. You can't just randomly use it everywhere
???
where?
I know but how do i do this?
Damn I will use protocol lib then
Or do you know a cursus to learn java?
Already answer hat to do
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.
@tender shard from here
Dutch
Course is cursus in het Engels @true star
Olivo i have discovered something that looks as a bug. This happens when using Maven multimodule project. Let say i have a main proejct (as pom packaging) and then inside i have more modules. If the modules doesnt contain parent their doesnt resolve any dependencies i dont know. why
hey i was following a customYaml files tutorial and i got this error
12:58:38 [SEVERE] at java.io.UnixFileSystem.createFileExclusively(Native Method)
12:58:38 [SEVERE] at java.io.File.createNewFile(File.java:1023)
12:58:38 [SEVERE] at online.shakiz.networkcore.files.CustomFile.<init>(CustomFile.java:28)
12:58:38 [SEVERE] at online.shakiz.networkcore.files.FilesManager.createFile(FilesManager.java:28)
12:58:38 [SEVERE] at online.shakiz.networkcore.files.FilesManager.<init>(FilesManager.java:19)
12:58:38 [SEVERE] at online.shakiz.networkcore.BCore.onEnable(BCore.java:34)
12:58:38 [SEVERE] at net.md_5.bungee.api.plugin.PluginManager.enablePlugins(PluginManager.java:265)
12:58:38 [SEVERE] at net.md_5.bungee.BungeeCord.start(BungeeCord.java:285)
12:58:38 [SEVERE] at net.md_5.bungee.BungeeCordLauncher.main(BungeeCordLauncher.java:67)
12:58:38 [SEVERE] at net.md_5.bungee.Bootstrap.main(Bootstrap.java:15) ```
this is the code where the error is
https://paste.md-5.net/joyecipaci.cpp
am using bungee and it wouldnt work :(
?paste
Please paste the code there
mkdirs
what
Create the dirs of the parent files/folders
There you have olivo and thanks for trying to help
Could you put your project on github so I can take a look
File#parent#mkdirs
Yeah
That's the method you need to use. You need to make the folders before creating the file
okay
me ? or verano
Verano
where should i use it ?
??
am confused
it returns boolean
nvm i found it
That using Bungeecord or spgiot?
sure
my domain is removing my website's (which im cloak forwarding to) description how do i stop it from doing that and btw if my website has smth like url/page.html and im having a domain cloak forwarding to url domain/page.html doesnt work so if i have qwe.rty.uio/abc.html and a domain cloak forwarding to that url (asd.fgh) asd.fgh/abc.html does not work
bungee
ughm what do you mean with "cloak"?`never heard that word before 😄
fixed the thing tho
uh
masking
What means cloak?
ht access rewite is my guess
Isnt called sub domain?
how kekw
why don't you just add the new domain to your vhost config?
one sec
That the format for sub domains and domains
googleripoffhaha.com will show google inside of it
now api.jeff-media.com and api.jeff-media.de and <IP> all show the same result
but normally you should not do that
google hates you for duplicate content
google.com is a domain
cloud.google.com is a sub domain
the proper way is to do a 301 redirect
Isnt that the way?
yes
eh nah i dont care about google hating me
then just use ServerName and ServerAlias
how doe i dont get it
nginx has the same option, it just has a different name
are you using apache or nginx
apache
you have a vhost config in /etc/apache2/sites-enabled/
it begins with ServerName mydomain.com
how would I get a player from a task?
now just add ServerAlias myotherdomain.com
wdym?
one sec
from this
what the issue?
how would I get all online players
MainClass#getOnlinePlayers()?
In your case just plugin#getOnlinePlayers()
but can you cast that into a player?
That will a return a Player collection
Well yeah
You should loop the collection to get each player
@tender shard Good news! in fact I can use NMS but Github returns me Could not find spigot-1.18.1-R0.1-SNAPSHOT-remapped-mojang.jar even if I can use NMS
Bukkit.getOnlinePlayers
are you using github actions to compile?
So I would make a list and a for loop?
That its simple java
Maybe I don't know if i use github actions or not
You can learn java and then try to use the spigot api. Because not many people here like helping people that atleast doesnt know the basics of java
lol well you should know that 😄
I thought I could skip at least a bit of java learning coming from C#, guess I was wrong 😦
java and c# are pretty similar
Casting a list to a single object won't work in C# either
which player to you want to get anyway?
i will search if i use that or not
just every player on the server
thanks
So t hen you have to loop the Collection<Player> to get each player object
Okay I use Github Actions
No
oh
Collection<? extends Player> allPlayers = Bukkit.getOnlinePlayers();
System.out.println("There are " + allPlayers.size() + " online:");
for(Player player : allPlayers) {
System.out.println("Player " + player.getName() + " is in world " + player.getWorld().getName());
}
you can just do for(Player player : Bukkit.getOnlinePlayers())
for (Player player : Bukkit.getOnlinePlayers()) {}
that's an enhanced for loop, so you don't have to iterate yourself
thank you guys so much!
To be clear, you could do it manually, but it’s so much easier using the foreach
yes github doesn't have spigot in their repo. you have to use a script that downloads buildtools and runs it everytime before you compile your plugin
can the totem animation be triggered but render a different item?
Really shity that
well
yes and no
it can only show totems
but you can use any custom model data you like
It makes sense. GitHub shouldn’t be expected to just work with anything and everything like that.
So if I were to give a totem a custom texture with custom model data, the used totem would display that model?
that's so fucking weird
So why do they have github actions?
so it does render an itemstack, but there's no way to make it render a different one?
that's some bullshit
Convenience
it uses a basic totem if the player doesn't have a totem in their hand, or use the totem's custommodeldata if they have a totem in their hand
Did you dig through nms and packets to see if this could be handled in a more direct way to just play the animation and supply it item data?
If not, I know what I'm going to be doing today
https://www.youtube.com/watch?v=1Ul7puf0rzE&t=93s you want to something like this right?
yes that requires a custom modeldata for the totem, there's no other way
so resource pack is required
oh god
I FEEL
the Kevin MacLeod
coursing through my bones
kevin macwhat?
does anyone have that link to the protocol wiki thing
Ah wait this is Bensound
Either way
All royalty-free music sounds the same
it was builtin to windows movie maker lol
just do it with NMS, it never changes in remapped 😛
@Override
public void playTotemAnimation(final @NonNull org.bukkit.entity.Player player) {
final ServerPlayer entityPlayer = ((CraftPlayer) player).getHandle();
final Packet<?> packet = new ClientboundEntityEventPacket(entityPlayer, (byte) 35);
final Connection playerConnection = entityPlayer.connection.connection;
playerConnection.send(packet);
}
It'd be cool if Bukkit had a proper packet API
that is so cringe
@tender shard love u i fixed my problem
genuinely annoyed that totems render actual itemstacks with meta but you can't choose what item to send
yes it'd be nicer if the client would just use the main hand
Admittedly it's a small thing to get annoyed about but still, the capability is right there just locked away
When I eventually make my own framework, Limestone, I'll just have all code mapped to Yarn or smthn
instead of main hand if it's a totem or generic totem if it isn't
Is there any way to make a custom item texture for an item without regard to its durability?
custommodeldata
requires a resource pack, of course
gotcha, been doing some research on custom textures and all the tutorials out there need you to set the item to unbreakable and stuff
yeah in ancient versions, people used durability
e.g. a stick with a damage of 69
but that's not needed anymore since 1.9 or so
my intellij always gets angry when I don't make everything final lol
why
light mode
with a Location block
so people cant do url/directory/ to see content
who hurt you
either Location or Directory
<Directory /var/www/DangerousDirectory/>
Order Deny,allow
Deny from all
</Directory>
where do i write that
in your vhost config
/etc/apache2/sites-enabled/mydomain.com.conf
e.g. like this
only that you add Deny from all instead of what I have inside
I accidentally selected 1.18 on maven for my project version, but it's supposed to be for 1.16.5. Do I have to recreate the whole project to change that?
no
just replace 1.18 with 1.16.5 in your pom.xml
and java ver
whew, thanks!
yes you should set the target and source to java 8 for 1.16
https://blog.jeff-media.com/common-maven-questions/ third headline
i should make a blog
what to post, no clue
but i should
shower thoughts
you... don't wanna know my shower thoughts
i want to
yeah no you'll start questioning existance
oh ig so
i just used
<?php header("Location: http://" . $_SERVER['HTTP_HOST']); ?>
so should i change this snip bit to 8?
Do you know if any ItemStack has custommodeldata that you can use for custom textures?
Or are there limitations to different types of item e.g. tools
yes that will ignore the part after /
How come player.getPersistentDataContainer() isn't recognized? I imported org.bukkit.entity.Player;
yes
its item meta
you can use custommodeldata on ANY item. but the default vanilla pack doesn't have any "CUSTOM" modeldata. you have to create a resource pack yourself
thats exactly what i needed
entities don't have PDC
always?
I've always used that
Gotcha thanks
because you're on 1.14.0 or earlier
ofc entities have PDC lmao
I've been lied to
I'm on 1.8 apparently wtf
lol
this has PDC:
1.14.1+: Entities, TileEntities, ItemMeta
1.16.3+: Chunks
1.18.1+: Worlds
omg thats so useful
it is, why do you think I have so many PDC libs lol
would I have to change theese two to 8?
nvm, I'm on 1.18
why does this return a map?
yes
it will change to what you set bove
shouldn't it be PluginCommand
???
@tender shard
${java.version} will be replaced with that
set <source> and <target> to "8"
thats not the api you use tho
are you using maven?
maven automatically does it
yes
I know how properties work
when why tell them to change it
alr, I'll give it a shot. thanks
either add 8 into source and target, or change the property in <properties>
makes no difference
they did
it does the same thing
look in your pom.xml
what version of spigot-api do you have in your <dependencies>?
probably not 1.18.x
should i have to change this to switch from 1.18 to 1.16?
1.8 is fine for java 8
you should however also set your dependency of spigot-api to 1.16.5 or whatever
then look into your server log
interesting
01.04 19:03:12 [Server] Server thread/ERROR Could not load 'plugins/original-PoisonWasteland-1.0-SNAPSHOT.jar' in folder 'plugins'
it would be helpful if you'd show the full error message instead of just this
this isn't it but it might be the root of the problem
01.04 19:06:26 [Server] INFO org.bukkit.plugin.InvalidPluginException: Unsupported API version 1.18
you have set "api-version" to 1.18 in your plugin.yml
you must obviously use "1.16" or lower to make it work with 1.16
I always use "1.13" since that works with ALL versions
if you don't care about supporting 1.15 and older, go for 1.16
is there a difference between 1.13 and 1.16?
in "api-version"? no
the only important thing is that you have set it to a valid value at all
so why would I not just use 1.13
you can use 1.13, as I said
api features which are only in newer versions
they will still work fine
I ALWAYS use api-version 1.13
that doesn't mean you can't use features that were added in 1.18.2
not if they don;t exist in older versions
if your server is 1.13 you can't use features which only exist in 1.16
ohhhh
obviously, noone said anything against that
we were talking about the fact that even if you set "api-version" to 1.13 in plugin.yml, it doesn't prevent you to use newer features
if you set your api version to 1.13, that plugin will attempt to run on 1.13 if they try it
no...
as in if they put it on a 1.13 server
01.04 19:10:09 [Server] Server thread/WARN Task #3 for PoisonWasteland v1.0-SNAPSHOT generated an exception
01.04 19:10:09 [Server] INFO java.lang.NullPointerException: null
01.04 19:10:09 [Server] INFO at me.thebreadperson.poisonwasteland.tasks.Poison.run(Poison.java:30) ~[?:?]
not quite sure why I'm getting null exception
the if(player)
why?
because they don't wear a helmet
ok got it
one last thing though
just tried re-packaging after a change, now I'm getting this
seems like you are running java 7 or older
I just changed the duration for a potion effect
file -> project structure -> project
what value do you have for "SDK"?
It should be 8 or higher
im dumb
May even have to be 1.8 unless Maven made exceptions
works now!
It was 1.1 -> 1.8 iirc, then they changed the release naming scheme to 9+
nope 8 works fine
They must have made exception then
no idea, but 7 works fine too 😄
send your log
no errors
Still, send us the log, please
then you didnt put it in the plugins/ folder
i did though
then there's an error
one sec
?paste
how do I use this
you paste your stuff, then click on the save button, then send the link
the api version must be "1.16" and not "1.16.5"
np 🙂
Nothing changed
if you try to compile it, what's the error message?
cannot find symbol
send the full compiler log pls
to get the full log, click on the uppermost entry here
then copy everything from the output on the right
What Java version are you using?
Well, you need 17 for 1.18
is there anyway to increase fog in spigot?
no
lemme send POM
bukkit is compiled against java 8
there'd be other error messages anway if this WOULD be the problem
yea
very very weird
Pretty sure I already had a similar issue which was fixed by switching to Java 17, because 1.18.1 is compiled with Java 17
no, bukkit / spigot-api is compiled with java 8
yeah, if depending on the API, should be fine to compile with 8
and even if it would the problem, it'd say stuff like "bad major minor version" or "cannot stat org.bukkit...."
How can I do that?
instead of just not finding a certain method
Okay, weird I guess 🤷
Though if your minimum target is 1.18, you really might as well jump to 17 lol
click this
There might be an option in your IDE, bram. Either there's a checkbox that says "debug" or you can specify the args yourself
Ye
mvn clean package -U -X
Is it possible to mix variables and text in java like in js? (i mean something like is: `text, ${variable}`
Not quite to the same degree but there is format methods
"My name is %s".formatted("2008Choco");
this is the full build thing
what if i have multiple
[ERROR] /F:/IdleClicker/src/main/java/me/cosmic/commands/WipePlayer.java:[30,59] cannot find symbol
[ERROR] symbol: method getPersistentDataContainer()
[ERROR] location: variable target of type org.bukkit.entity.Player
Are you sure you're compiling against Spigot 1.18?
Because it can't find that method which was added in 1.14
Dependency is what matters, not the plugin.yml
The pom.xml, what's the version set for spigot-api?
Useful table of all that's supported in formats,
https://www.javatpoint.com/java-string-format
<dependency>
<groupId>org.spigotmc</groupId>
<artifactId>spigot-api</artifactId>
<version>1.18.1-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
just for fun, run buildtools with --rev 1.18.1
or change 1.18.1 to 1.18.2
maybe you have somehow miraculously installed some other version to your local maven repo or sth
that's the only thing I can imagine lol
Nah, I'd just imagine there's another transient Bukkit dependency
<dependency>
<groupId>com.jeff_media</groupId>
<artifactId>CustomBlockData</artifactId>
<version>1.0.5</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.github.MilkBowl</groupId>
<artifactId>VaultAPI</artifactId>
<version>1.7</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.spigotmc</groupId>
<artifactId>spigot-api</artifactId>
<version>1.18.2-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
all dependencys
Ofcourse
🙂
it works on another plugin, I can just compile rn with the exact same code
Nothing obvious that stands out there, though you should put the spigot-api at the top. I believe ordering matters
but there is a lot more code in there so I wanted to create a cleaner version
lemme try taht
that
worked
damn
Yeah, I think Vault compiles against a much earlier version of Bukkit (because it really doesn't need anything beyond when services were added)
It was taking priority over your dependency
oh
fuck vault
Sure, but it's still good practice to put it at the top
That way you don't have to exclude
What eco plugin would you use then?
i kinda get it, so i put 3 %s but i have them all the same, do i need to add them manually or theres a way to use the same one in all places
ex: "%s %s %s".formatted("a")
returns "a a a"
or create ur own?
I mean declarative exclude > order
I just said fuck vault because it messed up your pom lol
ah ok
isn't it possible to maven to show the whole dependency tree?
saw it somewhere earlier today someone saying that "vault is a joke"
Yeah you can specify the index. I think it's $2%s for argument 2
Or something like that. I always forget it. StringFormatter has documentation on how it works iirc
It's %2$s
maybe do mvn dependency:tree and send it. spigot-api should be in that list before vault is, like here:
https://paste.md-5.net/ixiqofisas.rb
seems to work!
thanks for help, tho why does java always do stuff the most complicated way lol
js approach is more than good enough
and clean
C# formatting is relatively similar, though JS' in-built expression evaluation is nice
it's not complicated and JS is not clean
if you enter "asdasdasd${asd}" I expect it to print exactly that
Well, it does
if you want ${asd} to be replaced with something, you must a method for that
yes but they want java to automatically look for variables in the string
it only prints variable if its defined
You have to use ` for it to insert lol
oh yea lmao
String literals
"asdasdasd${asd}" will print exactly that, whereas `asdasdasd${asd}` will fail to compile
Stupid backticks
UGH lol
- you always know what is what cuz u can do ${name} instead of %s nobody has fucking idea what that is until checks later code
Nah it's just that asd doesn't evaluate to anything
I just always do
string = string.replace("{player}",player.getName());
`Hello ${name}` will insert the name variable
cough: public static void main(String [args])
but do u see how much longer that is
String name = player.getName() + "" > everything else 
it's for user configurable messages obviously
except u cant do that with json messages for example
mkdirs also creates missing parent directories
e.g. if you do "C:\SomethingNonExistent\Something" . mkdir
it will fail
because C:\SomethingnonExistent doesnt exist
np 🙂
how do you get player name from msg.getSender()?
its message from asyncplayerchatevent
Message is a strong
What kind of .getSender are you calling ?
And yea, what morice said
How can I give people the ability to enter data into mysql in config, I've tried every tutorial and I don't know something is not working
i would advise against letting players directly insert into a database
I already told you
- getConfig is not a field
- to access the METHOD getConfig() from another class, you need a reference to your instance of the class that extends java plugin
and I also sent you a link on how to do that
hytale???
lol
also UpperCase.ConfigNodes are cringe
how do i increase the power of a fireball spigot?
When it hits you just set the damage to whatever you like
set it to Double.NaN and see what happens
ok but... how?
Double.MAX_VALUE
EntityDamageByEntityEvent I guess
Yeah probably that event
you can either cancel the event and subtract health to deal guaranteed true damage or just up the number in the event
public static void main(String... args) {
double nan = 0.0d / 0.0;
System.out.println("0.0d / 0.0: " + nan);
System.out.println("as int: " + (int) nan);
}
0.0d / 0.0: NaN
as int: 0
NaN is weird
I imagine it counts as sorta null and since numbers can't be null it defaults to 0?
it's a normal number value though
A constant holding a Not-a-Number (NaN) value of type double. It is equivalent to the value returned by Double.longBitsToDouble(0x7ff8000000000000L).

also and this is the weirdest thing:
Double.NaN == Double.NaN returns FALSE
nan == nan: false
(int) nan == (int) nan: true
casting it to float will make it false again
At least it isn't something that will come up often
Anyone know how to fix this? Let me know if you need to see any other files. Also, when I compiled/exported the .jar it didn’t seem to take the yaml files with it.
is there a way to enchant player heads?
they don't get enchanted but every other thing yes
why is minecraft cursed
Mojank as we like to call it
cant a playerhead have The Curse of Binding and the Curse of Vanishing chants ?
or what u want 2 give them?
it can only have that?
dunno
idk just a random enchant to get the visual effect
its not important what enchant
but i can't add curse of binding...
version?^^
what does curse of vanish do? (don't remembe rxD)
1.18.1-R0.1-SNAPSHOT:20211220.014539-2).
