#help-development
1 messages · Page 362 of 1
What does that method do excatly?
The player's client will download the new resource pack asynchronously in the background, and will automatically switch to it once the download is complete. If the client has downloaded and cached the same resource pack in the past, it will perform a file size check against the response content to determine if the resource pack has changed and needs to be downloaded again. When this request is sent for the very first time from a given server, the client will first display a confirmation GUI to the player before proceeding with the download.```
Okay thank you, and I can provide a url with that method?
Last question, I can run that method any point the player is in the server right? Not just when they join
yes
uuh not sure if its bukkit
So it won't work without the spigot jar?
youll have to look that up yourself im not sure
no one uses standalone bukkit anyways
most things are a fork of spigot or paper so should all work
if you arent using spigot or paper to fork ( ignoring minestorm) you messed up
Hikari is killing me - does anyone know how to fix? i've tried the idleTimeout and maxLifeTime fix
https://paste.md-5.net/dewerefuwi.css
can you paste full stacktrace
Of course sorry! https://paste.md-5.net/azitiqadup.sql
can you send MySQLHelper.java:27
also are you sure
that your mysql server is running
like can you connect to it outside of plugin
I assume so, its hosted by hostinger - surely if its getting to this point its connecting
surely if its getting to this point its connecting
not really
doesn;t have to be
ah okay
also maybe your user doesn't have required permissions for database
try to connect it with workbench or smth
it usually have one more chained exception which describes issue closer
not sure why its not case here
also consider using prepared statements for queries if input may be declared by player
will do, just need to get it connecting first
workbench connects fine
[Multicraft] Skipped 119 lines due to rate limit
looks like multicraft skipped actual error
javax.net.ssl.SSLHandshakeException: No appropriate protocol (protocol is disabled or cipher suites are inappropriate)
ig you can just disable ssl in your connection url
as looks like driver isn't supporting it or whatever
?useSSL=false
your user doesn't have permission to access database
have you granted it all permissions ?
strange, its the user that created the DB
yeah, just gone and saved them again
....
I had the host as the username...
Genuinely surprised i've made it this far in life so far... thanks @hazy parrot
Most people dont have ssl setup on the sql db. Requires a cert and everything to be configured. Driver supports ssl just fine
Dont need ssl if db is on same host anyways. Just make sure you disbale listening for outside connections and make it listen on loopback only
Oh right, thanks for info 👍
Players in same scoreboard team can see each other while invisible, is there any way to disable that and let the player be invisible for everyone ?
found team.setCanSeeFriendlyInvisibles(false); will try it
Is there a way to bypass the 4 parameter limit in createExplosion method or are there any other way to create an explosion with more parameters?
Help, I try to build my plugin but everytime I do I get this error. Unsupported class file major version 60
I need it is because of the java version that my dependencies use but honestly the only one I see that can affect is bstats and if I disable it, it will give me an error saying I need it for other dependencies
anyone know how to load a plugin from a jar that came over rest api
not a physical jar?
Just update your java?
@quaint mantle Save the jar, load the jar. Delete after use.
Is it possible to make a custom item (Block ) and then detect when that item is placed or something? Can I attach a event trigger to an item? Do I have to listen for BlockPlaceEvent and check that it's my item?
I mean, yes everything is possible.
Is the best and simplest way just to listen to blockplaceevent? rephrase
Yes
?pdc
Well the largest parameter method of that takes 7 parameters. Do you need more? Lol
declaration: package: org.bukkit, interface: World
What does he need more parameters for anyway
What was a good tool to decompile plugins I was once told. It had a 1 word name
To convert to .java not just view
Quiltflower too
Luyten
That’s a decompiler gui
Ummm is there a difference or it just has a GUI compared to the others?
.
It still allows to convert to a zip so I assume it's the same
Sure, it’s just a gui on top of some sort of decompiler then
Thought so. Thanks
There is also jd gui too
Simple and lets you extract to a zip or directory. Nothing fancy but lightweight if that is all you need
Okay findind new Gson issues, let go ahead
Error dispatching event PostLoginEvent(player=Alexito2060) to listener dev.alex.net.inviter.bungee.listener.UserListener@1a1d3c1a
com.google.gson.JsonSyntaxException: java.lang.IllegalStateException: Expected a long but was BEGIN_OBJECT at line 1 column 129 path $.played
Please let me know!!!
Dunno which one you are talking about
Someone sent me a snippet of something and they used
StringUtils.deleteWhitespace(s) where s is a String
And there is no class called StringUtils
Maybe their own
So it must be a custom class
🤔
Oh. it's apache commons lang
Look for the class import
Oh yeah, also apache commons lang is already included with the spigot
Annoying lol
?
🤔
You are wrong, apache commons lang, is used for more things inside the Spigot
For example Locale if im not wrong
Also has some other handy methods too
Is
import java.util.*;
import java.util.stream.*;
Redundant? Doesn't util.* include everything? Why would this be here
Oh what seriously. tf I had no clue
I'm over here just doing code analysis
Collector<? super Object, ?, List<String>>)Collectors.toList()
error is
Could it be a difference in versions?
Show code
public static List<String> placeHolder(final List<String> list, final Map<String, String> map, final boolean b) {
Validate.notNull((Object)list, "The string collection can't be null!");
Validate.noNullElements((Collection)list, "The string collection can't have null elements!");
return (map == null) ? list : list.stream().map(s -> placeHolder(s, map, b)).collect((Collector<? super Object, ?, List<String>>)Collectors.toList());
}
Any lightweight just color library?
Must have unlimited gradients
And shit like that
I like iridium but there's only single gradient
I having some troubles parsing mongo long fields, what do suggest? Im parsing them via Gson
Because so far, mongo uses something really weird for storing the longs, its store as {"$longNumber": "1941841541"}, and so far gson cant serialize the object
Im getting this annoying issue while converting a user data from Mongo, into java object
com.google.gson.JsonSyntaxException: java.lang.IllegalStateException: Expected a long but was BEGIN_OBJECT at line 1 column 129 path $.played
at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$Adapter.read(ReflectiveTypeAdapterFactory.java:224)
at com.google.gson.Gson.fromJson(Gson.java:887)
at com.google.gson.Gson.fromJson(Gson.java:852)
at com.google.gson.Gson.fromJson(Gson.java:801)
at com.google.gson.Gson.fromJson(Gson.java:773)
at dev.alex.net.inviter.core.manager.UserManager.load(UserManager.java:32)
at dev.alex.net.inviter.bungee.listener.UserListener.onJoin(UserListener.java:22)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
hey whats a good way to send notifications to the player other than chat messages?
notifications in what way
you can spam them with sounds
morsecode the message
like text updates
in what context
player does action -> text pop up on screen
probably dont wanna use boss bars here or chat
i wanted to know if there is alternatives
hotbar, title, sound, hologram
whats hotbar?
and whats hologram
title is also a bit too big
okay i found action bars ty
You could even use scoreboards
Which might be better because you can hide the scoreboard after a delay
Hologram would be handy if you wanted them to stop and read it if it pops up in front of them
Hotbar is at the bottom where you can see items, you can have text above that
@timid jetty Try using achievements
Achievements have text in them, so you can use them as small action indicators (such as legendary item notif or something)
public static List<String> placeHolder(final List<String> list, final Map<String, String> map, final boolean b) {
Validate.notNull((Object)list, "The string collection can't be null!");
Validate.noNullElements((Collection)list, "The string collection can't have null elements!");
return (map == null) ? list : list.stream().map(s -> placeHolder(s, map, b)).collect((Collector<? super Object, ?, List<String>>)Collectors.toList());
}
error is
You'd just need to register one achievement
okay interesting
i mean i dont think thats really the best UX for what im working on right now but ill keep that in mind ty
Only thing you would need to do though is remove the achievement unless they are all unique
anybody have any resources on creating particles in an aura around the player before I go and make it myself lol
why are you doing these weird casts?
every single of your casts is unneccessary and the last one is even wrong
and you also cannot throw "s" into your placeHolder method because "s" is a string and not a List<String>
what is it even supposed to do? I don't really get it
I'm not doing them myself. I'm analyzing code
in case "map" is a list of placeholder->replacement, and you wanna apply it to all strings in "list", you'd do it like this:
public static List<String> placeHolder(final List<String> stringsToApplyPlaceholdersTo, final Map<String, String> placeholders) {
return stringsToApplyPlaceholdersTo.stream().map(entry -> {
for(final Map.Entry<String, String> placeholderEntry : placeholders.entrySet()) {
String placeholder = placeholderEntry.getKey();
String replacement = placeholderEntry.getValue();
entry = entry.replace(placeholder, replacement);
}
return entry;
}).collect(Collectors.toList());
}
What I'm trying to figure out is why would this actually compile and work on a different system when on mine it won't
it cannot compile
Yeah I thought so
where did you get it from lol
Quick Question: with a delayed task in bukkitscheduler, can you somehow delay the task even more after its been created?
you can with CraftBukkit code
BukkitScheduler().runTaskTimer(...) actually returns a CraftTask
CraftTask has a a package-protected method "setNextRun(long)"
why are you using Gson
you need bson right
for mongo document
is the type called crafttask?
CraftTask task = (CraftTask) Bukkit.getScheduler().runTaskTimer(null, () -> {
System.out.println(System.currentTimeMillis());
}, 1, 1);
try {
Method setNextRunMethod = task.getClass().getDeclaredMethod("setNextRun", long.class);
setNextRunMethod.invoke(task, 12345L);
} catch (ReflectiveOperationException ignored) {
}
this would set the "next run" of the task to 12345, which is probably is in "ticks since server startup"
okay i see
it would be easier to just run your runnable every tick, then manually check if it should do sth now
Instead of reflection you can optionally just cancel the task and reachedule it
this is what i was thinking too
I'd ust do sth like
on every tick:
if(this is correct tick) doSomething
set correct tick = current tick + nextDelay
But the better thing might be to create a method to check if it should run inside the task
And then this way you are not constantly cancelling tasks
Which is also what alex is saying
yeah i mean what alex is saying is definitely valid, but if im having a timer that refreshes on player action then what would be the most efficient way of dealing with that?
java.lang.IllegalStateException: EntityDamageByEntityEvent cannot be triggered asynchronously from another thread.
I got this error with a very simple line of code i dont know what the issue is here
public void run() {
// TODO Auto-generated method stub
target.damage(damage, source);```
wrap target.damage(...) into a scheduled task
@Override
public void run() {
Bukkit.getScheduler().runTask(() -> {
target.damage(...);
}, myPlugin);
}
beautiful you absolute life saver
hi
is there a good library for doing inventory GUIs?
i dont mind using another library for making inventory GUIs but i was just lazy and may have thought i would not need it, although, i might actually need it now.
IF is nice
i am writing a lot of boilerplate code i think right now.
probably writing boilerplate code that other libraries may already have something that abstracts it away.
dont wanna have NIH syndrome occuring to me.
or nvm
i might be too lazy to read that documentation probably i guess cuz i can just write my own code at this point and probably would end up taking the same amount of time.
yep, i am too lazy to read that documentation.
just gonna write my own event handlers.
I only know these two lol
and I haven't used neither
ehh
I just make my own
I also made an image rendering lib similar to java AWT
very similar to my menu system
because my menu system is basically a low resolution screen
how to track when player right clicked on armorstand made by packets?
ServerboundInteractPacket
probably
lemme check
yeah that seems to be it
it has a field "entityId"
and that's the NMS id of the clicked entity
I'm trying to make a small undertow API so I can send requests to my server via my plugin to do stuff triggered on other platforms, but it's not working.
This is the error:
[12:24:57 ERROR]: Could not load 'plugins\mcplugin.jar' in folder 'plugins'
org.bukkit.plugin.UnknownDependencyException: Unknown/missing dependency plugins: [undertow-core, undertow-servlet, undertow-websockets-jsr]. Please download and install these plugins to run 'HeathSynchronisation'.
at org.bukkit.plugin.SimplePluginManager.loadPlugins(SimplePluginManager.java:289) ~[paper-api-1.19.3-R0.1-SNAPSHOT.jar:?]
at org.bukkit.craftbukkit.v1_19_R2.CraftServer.loadPlugins(CraftServer.java:436) ~[paper-1.19.3.jar:git-Paper-399]
at net.minecraft.server.dedicated.DedicatedServer.initServer(DedicatedServer.java:273) ~[paper-1.19.3.jar:git-Paper-399]
at net.minecraft.server.MinecraftServer.runServer(MinecraftServer.java:1101) ~[paper-1.19.3.jar:git-Paper-399]
at net.minecraft.server.MinecraftServer.lambda$spin$0(MinecraftServer.java:316) ~[paper-1.19.3.jar:git-Paper-399]
at java.lang.Thread.run(Thread.java:833) ~[?:?]
And in my pom.xml file I have this as dependencies:
<dependency>
<groupId>io.undertow</groupId>
<artifactId>undertow-core</artifactId>
<version>2.1.0.Final</version>
</dependency>
<dependency>
<groupId>io.undertow</groupId>
<artifactId>undertow-servlet</artifactId>
<version>2.1.0.Final</version>
</dependency>
<dependency>
<groupId>io.undertow</groupId>
<artifactId>undertow-websockets-jsr</artifactId>
<version>2.1.0.Final</version>
</dependency>
So it should be fine...
Jeez 3 different deps for one thing?
And in my plugin.yml it's like this:
depend: [undertow-core, undertow-servlet, undertow-websockets-jsr]
That's what undertow says in their docs to import
I just want to make a simple API inside of my plugin for external things to connect to to do things on the server that I design
@vocal cloud do you know what the issue is or a better way to acheieve what I want to do?
Wait I'm confused. Did you put them as dependencies in your plugin.yml?
only if "undertow-core", etc are separate/standalone PLUGINs
^
I put them there AND pom.xml
you probably just want to shade your three dependencies. remove the "depend" from plugin.yml
also did you add the maven-shade-plugin to your pom?
dependencies in your .yml are other plugins that need to load before because your plugin depends on them
"depend: [mfnalex]" in plugin.yml means "I will not go the party before mfnalex has arrived.
"depends in your pom: mfnalex" means "I will go the party and I'll bring mfnalex with me"
java.lang.NoClassDefFoundError: io/undertow/Undertow
...
Caused by: java.lang.ClassNotFoundException: io.undertow.Undertow
at org.bukkit.plugin.java.PluginClassLoader.loadClass0(PluginClassLoader.java:177) ~[paper-api-1.19.3-R0.1-SNAPSHOT.jar:?]
at org.bukkit.plugin.java.PluginClassLoader.loadClass(PluginClassLoader.java:124) ~[paper-api-1.19.3-R0.1-SNAPSHOT.jar:?]
at java.lang.ClassLoader.loadClass(ClassLoader.java:520) ~[?:?]
?paste your whole pom.xml
you didnt shade your dependencies
as I said earlier, you need to use the maven-shade-plugin
how did you compile? File -> Build artifacts?
because that's wrong
you gotta use maven. are you using intellij?
yeah I built artefacts
yes
thats wrong. In the upper right corner of IJ, there's a "maven" tab. Go there, then go to "YourPluginName" -> Lifecycle -> Double click on "package"
now you got a working .jar in <yourProjectFolder>/target/YourPluginName-1.0.0.jar or similar
ok I double clicked package
but wait why did youtubers etc say to build artefacts then
it's been working up until I want a dependency
Did they remove PersistentDataType.STRING_LIST?
Because their tutorials are shitty and do not use maven
That never existed i think
Use this:
?morepdc
You can create custom persistent data types on your own, or use one of the many libraries available which have implemented those which match your needs. Learn about more persistent data types here: https://www.spigotmc.org/threads/more-persistent-data-types-collections-maps-and-arrays-for-pdc.520677/
Wait how do I change that package location then when I run that script? @tender shard
So it goes straight into a diff folder than target
@valid bay this allows you to use string lists in pdc (and much more)
Thanks but I already made my own hologram system anyways
Wait which plugin scope of my pom.xml file do I put it in? There's a plugin entries for the following artefact IDs: maven-compiler-plugin and maven-shade-plugin
You need to add the whole block as a separate plugin
So
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>3.3.0</version>
<configuration>
<outputDirectory>C:\mctest\plugins</outputDirectory>
<finalName>MyAwesomePlugin</finalName>
</configuration>
</plugin>
Inserted into my plugins part of my pom.xml?
"Plugin 'org.apache.maven.plugins:maven-jar-plugin:3.3.0' not found"
no problem, just hit "package" and it'll download it
it's just IJ complaining that it isnt downloaded yet, but maven will do that automatically
be sure to check that you don't have two versions of your plugins in your plugin folder though
Yeah I got rid of the old one, thanks
oki np
Uhhh looks ok?
AHAH: [io.undertow] starting server: Undertow - 2.1.0.Final
Yay it works, thanks a lot man - appreciate it :)
Lmfaooo yeah
I get that
I mean I'm coming from an entirely TypeScript and C++/Rust experience background, with some Kotlin - but no Java lol
But yeah thanks :)
yeah well you can ofc do java without using maven
but maven makes your life much easier in the long run. only at first, it's very confusing
Yeah but then you don't get the sweet packages 🤤
Yeah, I get that 🤣
Always use a build system
yeah
Did use Gradle with kotlin at one point and it was more painful than this lmao
Doesn't matter if it's gradle or maven
I also find gradle (kotlin) annoying
yeah gradle is much more complicated imho
you can also use kotlin just fine with maven
They mean gradle kotlin syntac
pog API is all working, got a Hello World back 🤣
Alright thanks guys, have a lovely day <3
God bless
thanks, you too!
Hi, i made the plugin add an effect but the effects don't combine, there's a way? this is the code i used
p.addPotionEffect(new PotionEffect(PotionEffectType.INCREASE_DAMAGE, 20 * Config.XANAX_COOLDOWN.getInt(), Config.XANAX_AMPLIFIER.getInt()));
Lmao a benzodiecapine plugin
Makes sense though, you hurt yourself all the time and do not really notice
Does anyone know how to get a string property from a config.yml file?
The following is all of my files in the plugins folder of the server:
bStats
config.yml
HeathSync.jar
The plugin is HeathSync.jar and I want to read off a config.yml file that I created that looks like this:
api-secret: "xxxxxx"
config.yml of your plugin must be inside of folder named same as your plugin
you shouldn't manually just yeet config inside of plugins folder
so then put that yml in a folder called HeathSynchronisation
oh yep
that works
thanks 🤣
how would weed regenerate or make someone healthy lol. weed would just make you anxious or sleepy and hungry
load the Yaml using YamlConfiguration.loadConfiguration(...) and then do myYaml.getString("api-secret")
hey, can anyone suggest a stress test method for my database helper class? realistic when will i start to notice lag using HikariCP/Mysql
just wrap every statement into a for(int i = 0; i <= 100; i++) statement lol
or run stress-ng on your database server with idk, 128 cpu workers lol
that's the best I can imagine
its more how many players will start to cause lag, the database update/inserts happens when a player leaves/quits
are you doing your database queries synced or async?
you would normally would want to use sth like CompletableFuture for stuff like this
then you can do DB queries WITHOUT blocking the main thread
Okay i'll take a look in to that
be sure to notice one thing: If you right now do stuff like this:
public void onJoin(...) {
int money = myDbHelper.getMoney(player);
you CANNOT just replace it with futures
you have to rewrite everything where you get your data from
a CompletableFuture is an object that does stuff in the background, you will make your code also want to wait until it got an "answer" without just calling .get() on it
Baeldung has a nice tutorial about CompletableFutures
thank you
Then explain why it is a med
it doesn't make you healthy, it just removes symptoms
if you broke your leg, morphine doesnt make it "unbroken" again, it just makes you not feel the pain anymore
I bet that weed causes more health problems than it solves, e.g. people suddenly starting to get anxiety problems or simi lar through smoking too much weed
but help-dev is probably not the right place to discuss this
Hey guys, How can I detect click item in a inventory to player inventory?
Like below pic
inventorydragevent
Oh, Thank u
It doesn't work,,
I think it's literally drag event
InventoryClickEvent
use getAction method ?
Yeah, you want InventoryClickEvent but there are going to be two of them. One for clicking in the top inventory, one for clicking in the bottom
This mean it need a two inventory click event?
No
You should only need to listen for the one
I want to change the death message in chat, so I wrote:
@EventHandler
public void onPlayerDeath(PlayerDeathEvent event) {
event.setDeathMessage(ChatColor.GRAY + "» " + ChatColor.RESET + event.getDeathMessage());
}
```but of course that also changes the death message in the menu, how can I fix that?
i think there's no way to change that message
oh okay :C
I think you can have a showDeathMessages gamerule set to false and simply broadcast the desired result
but then it doesn't show the death message in the menu too
oh then idk
maybe
there's a way to not send the death message
but probably not possible to do with spigot api
i dont get it - your code does exactly what you told it to do?
You just added >> to the message and it did that?
Making a fork
I think he wants to have different message in chat and in death screen
the death screen is client sided
no way to change this except maybe resource packs or sth
if you send a death cause it changes
even if, you still cannot use a "custom message"
if you want it to read "asdasd", you need a resource pack
that changes the language file
(if that's possible, at all)
doesnt it always say "You died!"?
no matter what the cause is?
you mean the second line?
Yeah
because the first line is always "You died!"
that's what they want to change
Separate chat message and the 2nd line
ok, then I have no idea if that's possible
It is actually
and how?
Don't know if the API can
But basically when the death is sent iirc there is some death cause
lemme check
yeah a death cause, but that still only then uses the default vanilla translation
ah ok
99.99% sure the API cannot change it
gotta listen to outgoing packets and change it there
Yep
time for a pull request
since my first actual CraftBukkit PR was merged, maybe this could be my second one lol
if someone opens a feature request on jira, I'll add it
Hey alex
talking about that
can you help me in #1075067821291225220
I did it before I just forgot how lol
?contribute
You can find information about contributing to Spigot at the following links:
https://www.spigotmc.org/wiki/cla/
https://www.spigotmc.org/wiki/guide-contributing-to-spigot/
https://hub.spigotmc.org/stash/projects/SPIGOT/repos/craftbukkit/browse/README.md
https://hub.spigotmc.org/stash/projects/SPIGOT/repos/craftbukkit/browse/CONTRIBUTING.md
And I also wanted to change the /kick message, how would you do that?
I tried this but for some reason it's not working (no error message or something like that):
package com.koner.the5utils.punishments;
import org.bukkit.ChatColor;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.player.PlayerKickEvent;
public class KickCommand implements Listener {
@EventHandler
public void onPlayerKick(PlayerKickEvent event) {
event.setCancelled(true);
event.getPlayer().kickPlayer(ChatColor.RED + "You were kicked!\n" + ChatColor.RESET + ChatColor.BOLD + "Reason: " + ChatColor.RESET + event.getReason() + ChatColor.BOLD + "\nAuthor: " + ChatColor.RESET);
//event.setLeaveMessage(event.getPlayer() + " was kicked because of " + event.getReason());
}
}
the message doesnt change, or the player doesnt get kicked at all?
StackOverFlow waiting to happen
why dont you just use event.setMessage(...) or sth?
the player doesn't get kicked at all
your server probably dies
^
because as oli said, it's an infinite loop
original event -> your listener -> new event -> your listener -> ...
ohhhhh
https://hub.spigotmc.org/javadocs/spigot/org/bukkit/event/player/PlayerKickEvent.html#setReason(java.lang.String) just use this
declaration: package: org.bukkit.event.player, class: PlayerKickEvent
oh i'm dumb
public void onKick(PlayerKickEvent event) {
event.setReason("Get rekd");
}
this should do it
but my server is still working fine xD
maybe it just shat the bed halfway through and carried on
maybe kickPlayer doesnt call an event
is it registered?
anyway, just change the kick message instead of kicking the player again
thank you
Does someone know if ProtocolLib has an enum for resolving this stuff?
not normally
The type int
How would I need to add the explosionDamage, knockback and setfire so it would work? It currently gives me an error if I try to add any of them.
Cannot resolve method 'createExplosion(org.bukkit.Location, float, boolean, boolean, boolean)'
Hastebin is a free web-based pastebin service for storing and sharing text and code snippets with anyone. Get started now.
import org.bukkit.block.Block;
import org.bukkit.block.CreatureSpawner;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.block.BlockBreakEvent;
import org.bukkit.inventory.ItemStack;
import org.bukkit.plugin.java.JavaPlugin;
public class SpawnerMinePlugin extends JavaPlugin implements Listener {
@Override
public void onEnable() {
getServer().getPluginManager().registerEvents(this, this);
}
@EventHandler
public void onBlockBreak(BlockBreakEvent event) {
Block block = event.getBlock();
if (block.getType() == Material.SPAWNER) {
CreatureSpawner spawner = (CreatureSpawner) block.getState();
ItemStack spawnerItem = new ItemStack(Material.SPAWNER, 1);
spawnerItem.setItemMeta(spawner.getSpawnedType().name());
block.getWorld().dropItemNaturally(block.getLocation(), spawnerItem);
}
}
}
So i have this code and the terminal gives me a long error when i want to compile it, can somebody help me please?
Whats the error?
declaration: package: org.bukkit, interface: World
can i dm you to write it cuz it too long?
?paste
return explosionSize;
}```
What is param used for?
thx man
use a proper build system not just javac
The home of Spigot a high performance, no lag customized CraftBukkit Minecraft server API, and BungeeCord, the cloud server proxy.
You didnt properly setup your project.
plugin.getExplosionStrength((float) plugin.getConfig().getDouble("explosion-strength")) > 0 🤔
returns event.getPlayer().getName() the player who kicked somebody or the player who was kicked
nope
is eclipse good?
i'm trying to change the player skin but i'm facing a problem when trying to refresh or reload the player, how can i do it?
you will have to either use a wrapper or modify the fields directly
How would I find a player that's currently on the server based on their username?
me?
thats not what he meant. search up maven or gradle
no, smile
declaration: package: org.bukkit, class: Bukkit
the player who got kicked since the kick doesnt always has another player involved
maybe there's a cause
its so good having 7smile7 back 🙂
so many more people will get help 😄
should say quality help lol
wasn't alex and me enough? :(
your help is bad 👎
you are not always here and alex is only helpful if he is sober XD
o.o
question for anti-cheat, if an item gets duplicated, is the duped item in any way different than the original aside from not fulfilling the == check? If yes, how?
@opal juniper can you help me in dms?\
i will hack your computer and delete it
it is different because it is a new instance
nope, do it here, whats the problem
careful, last time I told someone this they got upset XD
it wont be the same item in memory
so i downloaded maven to compile a java code
yep
so no, the == check wont work. other than that the item is the same
Can you find a player that is currently offline and access their PersistentDataContainer?
And modify it?
yes
get player from offlineplayer
and how can I then get the player who kicked the player
no
follow the guide, you need to setup your pom.xml
I want to check for when a potion is fully drank. Not just interacted. How can I differentiate it? I couldnt find an event relating to it.
its not recommended but u can do it
its just better to use uuid instead of name
store it on kick and get back to it later. or in real time listen for a kick command to be executed
But the spigot ItemStack implementation is actually evil. I would never rely on identity checks with ItemStacks. Only
if you know exactly what is happening in the Craftbukkit implementation.
There is no Player for OfflinePlayers
I've got an array of offline players like this:
OfflinePlayer[] offlinePlayers = getOfflinePlayers();
However, when I try and do offlinePlayers.find or get there isn't such method
there is if you create one 🙂
It's just an array of OfflinePlayers
not spigot
you can create player objects in spigot o.O
its not exactly easy and not recommended if you are still learning
well, you could fake a player object
^
what im looking for is a fast dupe check - clarification, im looking for the fastest way to check if a unique item (think can only stack to 1) has been duped. I've been thinking of generating and attaching a UUID as string in the item PDC, but im about 90% sure there is a better solution than that
wdym with store it on kick and get back to it later?
there isn't
to give it a UUID is most likely the best you can do
Are there docs/tutorials to do this? I just need to modify some data on their PDC
the only way you could check for dupe, is by monitoring the amount of items at any given time. Items currently existing, and items expected to generate
and then you detect if an item was created outside of this
if it was, it is a dupe
well i dont want to track dupes like carpet n stuff just items that have a lot of 'value'
idfc about carpet dupers
No not really. You'd have to create a fake Player, basically an NPC with the correct name and UUID
you cant retrieve the player who kicked the other player without storing it somewhere or listening to the command event to get your info there
you have to always know what items currently exist in the world, and basically all you are looking for is if an item gets created or generated that isn't expected to spawn or be created.
like my idea is to just periodically check all 'expensive' items in player inventories for their PDC and delete them if theres two with the same tag
Ok. So would the easier way to be to store the people in the config of the plugin?
they won't have the same tag necessarily
Depends what you are trying to achieve
I'm basically making an over-engineered mute command
dont item pdc copy if the items duped
how the fuck do you dupe an item while deleting its nbt
but lore does 
If a player is offline then mute is pointless. You only need to read data/mutes for Online players
No but if they are offline and I want to mute them so that when they come back online they wont be able to speak...
sometimes the server will just create the item out of nowhere
oh an admin mute
Yeah!
Use the world PDC
so, an instance where the server will create an item out of nowhere is by abusing world saving 🙂
world and chunk has pdc
just do world.getpersistent...
Bukkit.getWorlds()...
Wait but what if they were in the nether for instance
Would it carry over
Or would I set it on every world?
@opal juniper https://www.youtube.com/watch?v=s1xg9eJeP3E
i need to do whats in this video?
anyone? 🥲
yep looks good
@wet breach packets of what?
i tried these and it doesn't work
CraftPlayer craftPlayer = (CraftPlayer) player;
EntityPlayer entityPlayer = craftPlayer.getHandle();
PacketPlayOutPlayerInfo playerInfoPacket = new PacketPlayOutPlayerInfo(PacketPlayOutPlayerInfo.EnumPlayerInfoAction.UPDATE_GAME_MODE, entityPlayer);
PacketPlayOutEntityDestroy destroyPacket = new PacketPlayOutEntityDestroy(entityPlayer.getId());
PacketPlayOutNamedEntitySpawn spawnPacket = new PacketPlayOutNamedEntitySpawn(entityPlayer);
DataWatcher dataWatcher = entityPlayer.getDataWatcher();
PacketPlayOutEntityMetadata metadataPacket = new PacketPlayOutEntityMetadata(entityPlayer.getId(), dataWatcher, true);
entityPlayer.playerConnection.sendPacket(playerInfoPacket);
entityPlayer.playerConnection.sendPacket(destroyPacket);
entityPlayer.playerConnection.sendPacket(spawnPacket);
entityPlayer.playerConnection.sendPacket(metadataPacket);
1.8?
i made the skin changer things, but i cannot refresh/reload the player to itself, other players can see me changed my skin/name
basically the issue isn't that the server isn't updating it, rather clients cache other players information and you need the server to basically tell the client to refresh
yep
can't help sorry
oh other way around then
Just respawn the player
Wait can I store an object in the PDC of the world? E.g. one with their name and timestamp which they are muted until?
player#spigot#spawn() ?
Use their UUID not name
well its 1.8 so I don't know the relevant methods
Ok, but can I store it?
PDC only supports primitive data types. you need a library or some sort of serialization to store anything else
I don't use outdated stuff nor do I care to remember outdated stuff as I don't use it
simplest way is to encode to a byte array and store that
uhmm
its not hard to write a new DataType
look at teh javadocs, it has an example of creating one for UUID
all you do is the same as that btu for yoru own object which holds a UUID and a Long for teh timestamp
you could just use a string
yep csv
uhhh this will be scuffed but I guess it'll work 🤣
string is primitive depsite being an object
java is weird
String is not primitive
You can't modify a string after it is created
as it is immutable
so when ever you doing your operations to strings, it technically creates a new string object. But String is an object not a primitive
hello, how do I create a temp Structure Block just with Blocks and then send the blocks to the client?
You need a Structure already saved
you can then place a Structure block and set it's data or you can simply place the Structure using the Manager
String? Sorry I use CharSequence
I wanna create the Structure Block temp tho, I just wanna use it to send fake blocks
Then you don;t need a Structure Block
I do
ok
otherwise it would lag like hell
What I need is Arr-of-Blocks -> Create Temp Structureblock -> Send Structureblock to Client -> Remove Structureblock again
If you want to listen rather than argue...
save your Structure... It will create a nbt file..
you can then load/register the Structure
I cannot just save thousands of structures
you can access the internals of that registered Structure and read teh block array
use that and send fake blocks
the array is already given
how do i remove stuff that i have posted?
can I just feed the loading with my block array?
If you already have an array of Blocks you don;t need to go anywhere near Structures
just x,y,z loop over teh array sending fake block change
break it up into manageable chunks
so you are not sending the whole set of blocks at once
no im not
?workdistro
but it even lags like hell when I spread it
then you are not spreading it correctly
also, given of how hella fast minecraft loads structure blocks thats a literal joke
lol MC is TERRIBLE with Structures
it sends the client a shit load of blocks in a matter of ticks
problem is not server processing, it is the client rendering too much garbage
(or some weird networking)
well its a combination. Server processing, Server/client Bandwidth and client processing
I actually timed server time, it does not take long at all
I wrote a worldgen using Structures and it's terrible
SO much worse than normal worldgen
well, but, am I right that minecraft sends a shit load of blocks to the client via structure blocks?
so why won't that work with my fake blocks
because you don;t want to place teh Structure
No clue
how do i remvoe posts
press ... and select delete
i want to remove my posts how do i do
I just told you
i dont find it
Hover over a post, press ... on the right hand side and choose Delete
i find more options...
@opal juniper you still here?
anyone know of a plugin for 1.8 for when you eat a gap it gives you full health?
Guys , How to resize the face of teleport in spigot?
rightclick + delete = 
can somebody help? i want to compile my code in intellij ide but it gives me errors all the time (i dont know anything about programming)
rightclick + delete + enter = 
Anyone know how I can deal with the fact that minecarts set its pitch and rotation every tick, so setting its pitch and yaw in spigot results in it going back to the normal almost instantly? Can i create a super of the Nms minecraft class and remove that part of the code?
how do i remove posts on spigot
Yeah i think you need a custom nms implementation. What do you need that for?
"I dont know how to swim but can you help me do this 50m deep dive in the ocean?"
What is "teleport" and since when do teleports have faces?
Do you want to change the direction a player is looking at after teleporting him?
yeah
sorry for my bad english
Set the pitch and yaw of the teleport location.
thanks
Still the fighter jets
Nope, you need to use NMS or ProtocolLib for that.
But it wont lag your server then. I can imagine that using
thousands of minecarts for some jets in the sky will put
quite a strain on your servers performance.
Ah. So how do I proceed using Nms? And i am guessing that I won't be able to use spigot api for that packetless entity?
You wont be able to use any spigot api for that. You should probably write your own classes just for that.
Maybe first try getting it done without packets.
Why are you using Minecarts? Why not just ArmorStands?
Armor stand don't have pitch the same way
Armorstands have quarternion rotation
What is that?
You can literally rotate them in every possible direction there is
*The heads at least
Ah so if I pit a falling block on the head i can get yaw pitch and roll without having to mess with nms?
Yes
But I still need to rotate the main node of the plane where the player sits using a minecart.. Can you put minecarts on armorstands heads?
i cant use economy shop gui ı cant write /shop but it has files files are loded
you can put everything onto an armor stand, but non-full blocks usually get rendered as items instead iirc
what is the easiest way to get the current tps of my server?
Any to hwlp me to setup voting plugin dm me
it would indeed be better found on spigotmc.org
man this server needs a #recruitment channel
the forum is so much harder to navigate
There was nothing against it in rules my friend.
If you wish to request or offer development/art/building/administration services, please do so at https://www.spigotmc.org/forums/services-recruitment-v2.54/
@sullen coyote
what the ":" and the "?" means on a return sintax
in NMS are there returns and i don't understand what it means
for example:
return entityliving == null ? false : (!entityliving.isAlive() ? false : (!this.c ? !this.a.getNavigation().m() : (!this.a.a(entityliving.getChunkCoordinates()) ? false : !(entityliving instanceof EntityHuman) || !entityliving.isSpectator() && !((EntityHuman) entityliving).isCreative())));
thats called a ternary operator
in this case its a shorthand for an if statement
condition ? conditionTrue : conditionFalse
Don't nest ternary pls
so saying 27 + 3 == 30 ? "thats right" : "Nope" would return "thats right"
but that code you posted is ugly AF
and should be deleted from existence
the real issue with tenary is that if/else and tenary gets compiled differently
If you want to nest ternary, just use if in that case
so the fucking code up there is faster than an if else chain
thanks steaf
oh, is that because of the short circuiting?
like how does it get compiled diffrent
idk the exact bytecode but i know that the jmp is different
iirc either elgarl or 7smile actually knows the difference
hmm
https://paste.md-5.net/izapopovim.java
I got a lot of error in this code som1 can help me pls
a quick round of googling: the tenary pushes conditionally without storing
yeah I figured
interesting
fill every slot thats at either the first x or last x and any y
or any slot thats the first y or last y and any x
#bump
https://paste.md-5.net/izapopovim.java
I got a lot of error in this code som1 can help me pls
then teh /tps I use is from paper probably haha
The assaut map dont work som1 know why
I want to show it in the playerlist, so dym I should execute the tps command and somehow put the returned value to the playerlist?
oh
no I was in the wrong channel haha, I thought this was help server
srry I cant help you then
iirc either spigot or essentialsx has a tps command. just check the code of that one
EssentialsX does it with ```java
public double getAverageTPS() {
double avg = 0;
for (final Double f : history) {
if (f != null) {
avg += f;
}
}
return avg / history.size();
}
does bungee and spigot have google guava?
spigot does
any util/lib to do stuff with colors ? (multi gradients, rgb, rainbow)
nvm it has been merged into adventure now
https://paste.md-5.net/izapopovim.java
The assaut hashmap doesnt work so my code doesnt work i hate this
Som1 can help me pls ?
There are many problems depicted here. Show what your IDE looks like when viewing the code.
Where is your Assaut class?
Wait i send u the whole code
Thats the AssautManager class. Where is your Assaut class?
?!
xd
what is an assuat
Sounds like a type of sausage.
Show me one of your Requirement implementations
sorry there is no triggering problem, i took care of it 👍
ok
its assault in french
Yes i know but happen the same issue
For some reason it's having troubles while working with double and long values
Atleast integer works perfect
I think Is something related to how bson serialize/deserialize numbers
Is there any possibility to download premium resource from Spigot via API? The only possibility i saw is to use Spiget (don't know if it works), but still it's only for free resources.
that would just be an easy bypass to paying for them, doubt it exists or will ever exist
It could exist if there were login requirements for the API, but as it stands currently, it's not possible.
Oh, no this way. I thought about endpoint with authorize like JWT token
yeah ig
can I someone send a broadcast message but only for players, not for console
is a for loop good?
iterate over all players and send a message
for (int i = 0; i < 200; i++)
for (Player ps : Bukkit.getOnlinePlayers()){
ps.sendMessage(" ");
}``` but is it the most optimal solution?
why are you sending so many
for a clear chat command
send a tonne of newlines?
how can I do it in another way?
Hello !
I've a small problem i don't have any variables names anymore :/ (inteliji) I don't know why, i've the same build.gradle as another project and i've not the prob here.
If anyone knows the solution it will be helpful ty !!
(i can't post screen here)
?img
Not verified? Upload screenshots here: https://prnt.sc/
looks fine
same version, but i a other project 🤷♂️ https://prnt.sc/9RniUw1FpCzQ
is one spigot-api and one spigot
nop same build.gradle 😢
welp, i mean ultimately it doesnt matter
So general development hell question
Rideable pigs
ive been wracking my brain all day to try and figure out the best approach to getting a pig that rides like a horse
I would recommend verifying yourself ith ur spigot acc
So then you can send pictures and all we can see them
Actually better question
if a veichle had somehow stopped being controlable, (lets say a horse) how would you set it back to being controlable?
So essentially I have libsdisguise and i have disguised a horse as a pig
and i want to be able to turn back on the pig's rideability
Any other alternative for saving player time played, because mongo actually is having troubles for working long values
pretty sure this is a simple user error
Well i dont think, i thinking that is a Bson issue while serializing/deserializing long values, do you want to check the code?
Hmn im not sure tho
But i need to do it for bungee, so meh
The problem is when loading the document tho
I have tried many ways, like that in the picture, getting with Document#get("field", Long.class), with Gson
Im really confused, because i didnt have issues with numbers before while working with mongo
shouldn't that rather be a static method?
Yeah prob, but statics be like 💀
anyway, sorry, I cannot answer your question
oki
Error dispatching event PostLoginEvent(player=Alexito2060) to listener dev.alex.net.inviter.bungee.listener.UserListener@1a1d3c1a
java.lang.ClassCastException: class java.lang.Double cannot be cast to class java.lang.Integer (java.lang.Double and java.lang.Integer are in module java.base of loader 'bootstrap')
at org.bson.Document.getInteger(Document.java:243)
at dev.alex.net.inviter.core.api.User.load(User.java:30)
at dev.alex.net.inviter.core.manager.UserManager.load(UserManager.java:34)
at dev.alex.net.inviter.bungee.listener.UserListener.onJoin(UserListener.java:23)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:568)
at net.md_5.bungee.event.EventHandlerMethod.invoke(EventHandlerMethod.java:19)
at net.md_5.bungee.event.EventBus.post(EventBus.java:46)
at net.md_5.bungee.api.plugin.PluginManager.callEvent(PluginManager.java:399)
at net.md_5.bungee.connection.InitialHandler$6$1.run(InitialHandler.java:537)
at io.netty.util.concurrent.AbstractEventExecutor.safeExecute(AbstractEventExecutor.java:164)
at io.netty.util.concurrent.SingleThreadEventExecutor.runAllTasks(SingleThreadEventExecutor.java:472)
at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:497)
at io.netty.util.concurrent.SingleThreadEventExecutor$4.run(SingleThreadEventExecutor.java:989)
at io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74)
at java.base/java.lang.Thread.run(Thread.java:833)```
Mainly issues with numbers casting
Is there a reason you're not using Document#getLong?
I try getLong8) and same issue
I tried many ways and all have the same issue
If you look at the type in your database, is it actually saved as an Int64?
Its saved as: { fields: values, {"$longValue": "19418124141"}}
what's line 30 in "User"?
Where assigning the played time
1m i will send the db document to have a more near look
See coz getLong has worked for me in the past
{
"_id": ObjectId("63eb4428e4d2ef2bfa2bc55d"),
"uuid": BinData(3,"hz5tv5G9ev6A0W4V9LH9sQ=="),
"name" : "Alexito2060",
"played": NumberLong(-5737),
"points" : 1000,
"invites": 10,
"inviter": null
}```
That is my current doc for testing
please send the exact line
okay, will try again using Document#getLong(), maybe the issue was causedusing old documents
random unrelated other thing, is there a reason you're not just using the player's UUID as the _id?
it used to cause me issues, for saving and loading that why
Oh. Interesting
Yeah and everything was okay, so that why i didnt use it
if you do not tell use what exactly is "User" line 30, it's a waste of time to discuss anything about it here
sorry i was taking the cap
why are you casting it to "Number" in the first place?
just use the appripriate get<WhatEverNumberTypeYouNeed> in the first place, as people already suggested
That is like 30, in first place used to be a Document#getLong() but caused the same issue, so i read on overflow that mongo deals with numbers diffenrent
But in my case happens backwards, the issue is caused when i need to read a Long value
right, my field type is "long"
Let me check because, before i was having the current issue
1m
Ash fkg maven multi modules, it takes ages to compile a simple 20 modules project 💀
Also is correct to load the document when the player joins? or need to load it when plugin start?
Because i have been reding arguments about that and there are big dicussions abou t it
tbh if you got 20 modules, it's not a "simple 20 modules project"
20 modules automatically means that your project is not "thaaaaat simple" anymore
I mean there is a common modules which doesnt even have 40 packages, and then smaller modules, doesnt make sense haha
no clue what you're talking about
do you actually have a parent pom that consists of 20 sub modules? If so, I wouldn't exactly call it "simple"
haha you are confusing verano with IkeVoodoo
Are u sure you can compile a maven multi module with 20 modules in 2 seconds
sure, maven ALWAYS needs 2 seconds
@sterile token
You can literally compile the whole linux kernel within 2 seconds
I proba have to move up to Graven the new technology for java
maven's O(...) thing is == 2 seconds
wait im an idiot i didnt even open mc, to test the plugin
you know, lynx and me are something of a scientists ourselves
🧑🔬
engieeniers*
if only I still had a photoshop license
Same issue mfalex
19:10:48 [ADVERTENCIA] Error dispatching event PostLoginEvent(player=Alexito2060) to listener dev.alex.net.inviter.bungee.listener.UserListener@1a1d3c1a
java.lang.ClassCastException: class java.lang.Double cannot be cast to class java.lang.Integer (java.lang.Double and java.lang.Integer are in module java.base of loader 'bootstrap')
at org.bson.Document.getInteger(Document.java:243)
at dev.alex.net.inviter.core.api.User.load(User.java:30)
at dev.alex.net.inviter.core.manager.UserManager.load(UserManager.java:34)
at dev.alex.net.inviter.bungee.listener.UserListener.onJoin(UserListener.java:23)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:568)
at net.md_5.bungee.event.EventHandlerMethod.invoke(EventHandlerMethod.java:19)
at net.md_5.bungee.event.EventBus.post(EventBus.java:46)
at net.md_5.bungee.api.plugin.PluginManager.callEvent(PluginManager.java:399)
at net.md_5.bungee.connection.InitialHandler$6$1.run(InitialHandler.java:537)
at io.netty.util.concurrent.AbstractEventExecutor.safeExecute(AbstractEventExecutor.java:164)
at io.netty.util.concurrent.SingleThreadEventExecutor.runAllTasks(SingleThreadEventExecutor.java:472)
at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:497)
at io.netty.util.concurrent.SingleThreadEventExecutor$4.run(SingleThreadEventExecutor.java:989)
at io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74)
at java.base/java.lang.Thread.run(Thread.java:833)
what's line 30 in User?
this.played = document.getLong("played")
are you sure you're getting the line correct?
integer != long ?
getLong does not call getInteger, so I don't think it can be that
correct, hence you get this error
but im not getting an it
Im saving a time that why im using long and not int
remember that int is limited and not use for time
getLong -> get -> documentAsMap
getInteger is not called anywhere when doing getLong, so that's a separate error.
^
no
Either you're not updating your plugin correctly, or line 30 is something different.
But integer cant be used for working with timestamps or time based fields
That error does not point to you running getLong at all. getLong is not called anywhere with that error.
you can cast a "long" to an "int" but you cannot cast a "Long" to an "Integer"
Im no doing any casting ?
primitives != erm... the wrapper types
Line 30 is this.points = ... 🤦♀️
you do by using getLong()
Not this.played
What type is this.points and what type is points in the database?
int this.points
here the db doc
1000 obviously is not a Long...
mfnalex if I'm gonna be honest, ur lost.
i mean the isue is confusing
no, you guys do not understand the differences between primitives and wrapper types
We're not talking about a long any more, because the line referenced was incorrect. The issue now is that the different field, this.points which should be an Integer is a Double.
you cannost just cast a Long to an Integer.
you can cast a long to an int but you cannot cast a Long to an Integer
is there any way to instantly delete an entity (like without waiting for a tick)
no
alright
no, because how minecraft works
Why when server invokes command event is triggered but when players does there is no event? @EventHandler public void cmd(PlayerCommandSendEvent event) { Bukkit.getConsoleSender().sendMessage(ChatColor.BLUE+"Player CMD event "+event.getPlayer().getName()); } @EventHandler public void serverCmd(ServerCommandEvent event) { Bukkit.getConsoleSender().sendMessage(ChatColor.BLUE+"Server CMD event "+event.getSender().getName()); }
So my issue change mfalex, i thought that line 30, was the long thing which was wrong that line
what?
So now the issue im having is that mongo is treating my int points as a double value
ngl no idea what the type of the numbers actually here is. Is there maybe a different way that you can output the document?
I'm used to reading them like this:
{
"_id": {
"$binary": {
"base64": "mPwMGiHiTZec49XHlD7sZQ==",
"subType": "04"
}
},
"currentUsername": "TS3Moderator",
"currentlyOnline": false,
"firstLogin": {
"$date": {
"$numberLong": "1675813679000"
}
},
"lastOnline": {
"$date": {
"$numberLong": "1675813684000"
}
},
"totalPlaytime": {
"$numberLong": "5762781913"
}
}```
Also gonna check my previous mongo code to see how I save a regular integer.
I would need to listen for commands in form of events so I wounder how to achieve that
right, really thanks because im really confused
What are u expecting to do?
PlayerCommandPreProcessEvent or similar
Yeah that the right event
roller right now mongo confused me a lot, because why would he treat my int field as long, doesnt make sense
Ok I don't do anything special when saving/reading an integer, so I'm not quite sure. Could you send your whole User class please.
Yeah
?paste
Yh I would recommend changing the methods btw like earlier. Not sure though
@sterile token
sql be like 💀 when need to work with arrays
is entity metadata cleaned when removing the entity?
yes
Do you have the document with types? Similar to the document I sent above
How i see that?
stop using racist database types and you'll see that everything's going to work just fine ;P
I just use Mongo Compass and then copying it from that gives it to you
hmn right i will install mongo compass
The TLDR is basically, for some reason points is coming back from your db as a Double type, not an Int32
why would you use mongodb in spigot plugins anyway? like 99.99% of servers use SQL databases
"mongo"db has its usecases, but spigot plugins aren'T one of them. also fuck mongodb for choosing that name, "mongo" is an insult against disabled people in at least 20+ languages, including german, and the dude who invented this weird system is a german so yeah... fuck mongodb
mongodb is beste. I will never go back to relational databases in spigot.
lol
Same mentality as me
I cant go back to sql neither for webs/nest apis
See I love mongo, but I don't use spigot sooo I don't apply to it anyway 😆
okay, let me just forget for one minute that the original developer of "mongodb" chose an insulting racist slur for the name of his db system - can someone give me an example on how/why mongodb does anything different/better than usual SQL databses? (honest question, I am curious)
Mainly for its simplicity while working with no needing for losting time with the foreign keys, relational thing
no clue what you mean
how are you going to access any data if the value is not associated with any key?
In sql you can lost hours and hourst just for saving such a simple arrays or objects, you have to harcode it a lot
erm no?
In mongo you dont have a ugly syntax which you have to remmeber for example, you use Flters instead
