#help-development
1 messages · Page 1805 of 1
What specifically about it
dm
reject Indentation as well
tf is indentation
but why? plugin instance is only one, what's the problem of using singleton?
do indentation with singular spaces
Yall saying you dont always write your code like this?
reject whitespace java publicstaticUUIDgetUUID(Stringname)throwsIllegalStateException{try{URLurl=newURL("https://api.mojang.com/users/profiles/minecraft/"+name);HttpURLConnectionconn=(HttpURLConnection)url.openConnection();conn.setReadTimeout(5000);conn.setInstanceFollowRedirects(true);conn.addRequestProperty("User-Agent","Mozilla/4.0");conn.setDoOutput(false);try(JsonReaderreader=newJsonReader(newInputStreamReader(conn.getInputStream()))){reader.setLenient(true);//readJSONdataJsonObjectjson=newGson().fromJson(reader,JsonObject.class);//closereaderreader.close();returnUUID.fromString(json.get("id").getAsString().replaceFirst("(\\p{XDigit}{8})(\\p{XDigit}{4})(\\p{XDigit}{4})(\\p{XDigit}{4})(\\p{XDigit}+)","$1-$2-$3-$4-$5"));}catch(IOExceptione){thrownewIllegalStateException("ERROR_CHECKING");}}catch(Exceptione){/**Failquietly.*Noneedtospamastacktrace.*/returnnull;}}
my eyes lmao
I just prefer instances rather than static singletons
"Your eyes"
Sir you must not of looked 2 centemeters above your post
reject letters, use binary codes!
that-
is evil
AAAAAH
reject programming
Embrace paper and pencil
i dont get it when every command class extends a base class and they all modify the plugin instance in the base class
alr alr alr were going a bit far here
i coded on paper 2 days ago
lol
i had an idea of some logic and i dint want to forget it
i'm writing on paper
This gives me painful throwbacks to having to write an SQL exam on paper at the end of high school 😵
01110000 01110101 01100010 01101100 01101001 01100011 01110011 01110100 01100001 01110100 01101001 01100011 01010101 01010101 01001001 01000100 01100111 01100101 01110100 01010101 01010101 01001001 01000100 00101000 01010011 01110100 01110010 01101001 01101110 01100111 01101110 01100001 01101101 01100101 00101001 01110100 01101000 01110010 01101111 01110111 01110011 01001001 01101100 01101100 01100101 01100111 01100001 01101100 01010011 01110100 01100001 01110100 01100101 01000101 01111000 01100011 01100101 01110000 01110100 01101001 01101111 01101110 01111011 01110100 01110010 01111001 01111011 01010101 01010010 01001100 01110101 01110010 01101100 00111101 01101110 01100101 01110111 01010101 01010010 01001100 00101000 00100010 01101000 01110100 01110100 01110000 01110011 00111010 00101111 00101111 01100001 01110000 01101001 00101110 01101101 01101111
w u t
should be illegal ngl
anytime i write a sql statement i feel like im taking some statewide IQ test
Ever since I started using Mongo I haven't touched SQL anymore haha
"Oh god is this syntax right"
"Oh god did i escape that user entered input"
Mongo + Redis = 🥰
Yeah i love mongo
oh mine was easy
oh it was easy, but just painful to write without syntax highlighting and such
i had most of the exercices in MySql workbench
Out of curiosity, what would you guys think is a fair price for a plugin of which there is nothing alike on Spigot yet? It's fairly complex, involves a lot of packets, and is related to server/network optimization.
One million dollars!!!!
👀
10 dollar
Yeah I was thinking of around $12
Does it have a Vault-ItemStack library
It doesn't even use ItemStacks haha
Lmao trust me, you'd change your mind when you see the plugin
server/network optimisation uses itemstacks hmm yeah
I optimized my ItemStacks
By changing the CustomModelData
😎
Looks > Performance
CustomModelData my beloved
smh
but that hides the durability
What if I told you you could principally have 1000 players in 1 server without a single tps drop using the plugin 😉
20$
if its really that hard
well maybe 15$ or smth
Yeah I'll go anywhere around 12-18
even with some heavy tasks?
what about with a 5kx5k map with lots of NPCs and events firing constantly
Can it basically handle runscape in mc ^
This is considering every player is just moving around, mining etc. Heavy tasks will always take a toll on performance, but it would still keep up consistent TPS even with heavier task yeah.
Principally, yup! Depends on a lot of factors of course, but yeah.
one question how can i make this chat foramt work with hex codes?
java event.setFormat(ChatColor.translateAlternateColorCodes('&', VaultUtils.getChat().getPlayerPrefix(p )).split("&")[0]+" "+ p.getName()+ChatColor.WHITE+ ": " + ChatColor.GRAY+event.getMessage());
I'll make sure to announce it here when I release it :)_ _
👀
do you have ChatColor.of(hex string)?
it would be really useful for server owners, assuming there is no something that breaks
otherwise you'll need to look it up
do you use fake players
or something
It adds some complexity, but I'd consider it basically a must have for any big server these days.
No so the problem is ranks which have hex codes are not showing so i am guessing i need to change something in Format to make them work
Not spoiling anything else haha. You'll see when it's released.
ngl why make it a plugin and why not patch a server jar?
I feel like if you can squeeze 1000 players into a server with only a plugin optimization, why not go full out for the jar
do we need to follow some kinda rules to use the plugin or it's just drag & drop?
Because of what it offers is probably not what you have in mind, it'll be clear once you see it ;P
ill teade you source code
whats the need for secrecy lol
to a plugin i havent worked on i n3 years
The latter
its needed trust me
Just sensible, there is not a single plugin like this on the entire market yet.
Someone in here is prolly lurking, see what he says and bam its released by tmrw
^
i saw this
yeh ppl will copy it anyway
ugh no custom moejis
once its released
if your the first its gonna be very hard for competitors
It's reasonably complex though, but I wouldn't doubt it indeed.
because they 1st have to make it, and then they have to make it better in order for people to download the older one over the newer one
^
Or as we saw in here a few days ago, just have a prettier front page and your set
smh ChatColor.of should work with the right import
Presentation = key :)_ _
i have yet to release my traders plugin because i cant make a decent front page
A1 Plugin pages
Just freelance someone
is json data storage faster than yaml?
yes
not to mention easier to write
dont have to worry about tabs and spacing
"The JSON grammar is very concise. The YAML parsers are comparatively complex, leading to increased overheads."
Google is your friend
JSON feels nicer to configuer as well
why even spigot uses yaml if minecraft uses json?
it's more readable maybe?
so much nicer looking
YAML is more user friendly for config
for me i can barely read yaml at times
that "readablity" leads to much more errors + worries about tabs
so many [] {} in json xd
[] = array {} = object eg actual config
People who are not familiar with programming in general could have troubles messing up brackets
Json has nothing to do with programming
It literally has
You can learn Json in 10 minutes if youve done Yaml before
JavaScript Object Notation
json is created for transfering js objects in php and vice versa AFAIK
Yeah but that's not the mindset you want to have, a lot of plugin users have very basic knowledge and just want to quickly change some values
Two questions: what map is the fastest for a Key/Value mapping for up to 5000 values, and how can I iterate over all Materials that are also able to become ItemStacks?
i should take a look at gson
Can't all materials be ItemStacks?
Yeah but either way its not too hard to use if theyre just changing some quick values
Material.isItem
Its compiled into spigot, definatly should
I use GSON so often, it's great
entry one:
AIR(9648, 0),
Moshi is good but
so no
It doesnt do automatic serialization of classes...
Ah fair
Hey folks, I recently switched from Eclipse to using IntelliJ, however I'm running into an issue with Javadoc. It is not giving me the javadoc for anything from the java standard library. Spigot e.d javadoc works fine, whats going on here?
How far up?
doesnt it generates javadocs by default?
thats the exact opposite ofmy problem lol
well it says it does but they generate there
It semes your is flipped though, or am I reading it wrong? The Bukkit API has javadoc for me
I need the standard library's docs 😅
also it might genereate the javadoc when you use --generate-sources, but NOT in the target folder but instead in that weird .m2 folder
For reference, this is what my javadoc looks like now
Mine look the same?
Im missign the entire description part
This is what my doc on a bukkit api looks like, showign the description
Yeah, I'm using OpenJDK 17
No, my docs come from 16.
< 16 >
Hover, my active JDK is 17
wtf
But, I've also tried changing the doc url to 17, makes no difference
I LOVE how minecraft client checks the team not by player's UUID but by its name.. WHY? this is cancer. Now whenever apply glow to NPC which has the same name glow persists due to how client thinks
What about your projects structure version?
you can find it in file
And to fix this i need to generate invisible characters just to separate NPC teams
why not the method then 🤔
dont use teams then
Oh, I indeed am using 16
nice
I do have both installed, so it shouldnt matter a bit
I need glow color
seems only my terminal adheres to what I set then 😂
(Using SDKMan for managing my Java versions)
String.substring does not exist for me lol
Maybe SDKMan has something to do with the docs?
Shouldnt, since the JDK used by IntellIJ was downloaded via apt
Thats odd exists for me lmfao
I used to do that, until I had to change Java versions almost every hour, then it becomes annoying 😂
Eh, I have to, because work
i just typed it to get docs
At work we have some projects on 8, 9, 11, 16 and 17
explain exactly what you're trying to do
now it exists
oh dang your work lets you use java
wth
lucky
nah hell no 😂
hiremepls
Id much rather use Rust
and thats what all new projects use too
slowly porting all Java code to Rust
Why would you want to play on a toxic hell hole of a game isntead of doing java
jkjkjk
Mmm rustlang :bigbrain:
i love both versions of rust tho xD
How can I cancel block explosions for blocks with a specific metadata?
Ive never played the game lol
people always join the Rust discord asking about RustLang its kidna funny
dont, shit game, i hate it, you should try it sometime, i love it
anways the docs issue uhhh
remove teh protected blocks from the block list in the explode event
You get docs on Eclipse?
Yep I do
I have NPC classes which spawns NPC to the player, the problem is that whenever i add two NPCs in the server with the same name, client thinks that both NPC's belong in the same team even if their UUID's are different
Maybe scour Intellij's forums or ask a question on theyre forums yourself
it feels like some intellij settings
I tried it like that?
Can't find a blocklist..?
individual blocks don;t have meta
not unless they have a TileEntity
If you want protected blocks you need to either store a list of Blocks (bad)
Or a Cuboid Region of some sorts and check if block is in that region (good)
oh wait they wanted something else
mb
I set the metadata, when the block is placed
Normal Blocks dont hold data though
individual blocks in teh world don;t have meta, unless they have a tilestate
Remove the name and hide it
even then, you are checking the wrong event
and spawn an invisible armorstand with the desired name
Block explods is for things like Beds blowing up, actual blocks exploding, not blocks being blown up
that not the problem. The problem is that Teams packet relies on Player names rather than UUID's, with exception of other entities
In order to make glow work properly you need to create non identical player names
ofc i can add armorstand
but i think there should be a better way
and glow will nto work at all with Optifine or any shaders
Its actually really simply solution
Just add armor stand as passanger bam
Unless your moving it
oh, so what's the right event then?
then yeah
You need both BlockExplode and EntityExplode
both will have a blocklist
it tells you want the error is
I wouldnt see any reason to move it though unless you want more lines to the hologram which is a good reason to move it
ColouredConsoleSender cannot be cast to Player
And from the blocklist, i can remove those blocks, that should not be exploded, right?
dont do a list of Blocks
yes, both events. Entity is for things like fireballs and TnT
So Player player = (Player) sender is not being defined well? or is it with the instaceof?
Paste your command method
If you end up storing thousands of blocks into a List your gonna run into memory issues
Your best to make a type of CuboidRegion like a WorldEdit region and then check if the Block is in between the 2 highest points of the Cuboid Region
and extra brackets
whoever deleted theyre message'
you were right
it needs to be up one line higher
because hes casting before he checks
is there a way to make command's help message be colored multiline and something like this via plugin.yml or i shud always return true in 'onCommand' and handle it from code?
\n for new lines
and what about colors?
in plugin.yml?
oh, i know that, i was asking about plugin.yml
i barely ever fill anything out on it
i forgot im using a custom command handler, ignore my last remark
sentry.setBaby()
set it after its spawned
.sendMessage(
ChatColor.translateAlternateColorCodes('&', command.getUsage())
);
return true;
though i prefer creating utility class for parsing colors like:
ChatText.of("%RED%This is red");
Yeah i do the same thing, i just said a short answer
i dont even import the class i just import the static method
maybe i forgot import something
# plugin.yml
command:
usage: |-
&e/<command> [<args>]
&d/...
why multiline usage 🤔
Entity should be a HUSK so cast it to HUSK
He said
use § char for colors?
•
no
Once you change it to Husk instead of Entity setBaby(true) should appear
it goes brr but yea
although base Entity should have that method iirc
you mean import Entity.Husk?
Whichever yes
org.bukkit.entity.Husk
^
Husk husk = (Husk) ...
Thanks :0
does someone know what the
[I;303365728,590365872,-1635679079,-1707570548]
is from a UUID ?
i want a uuid to be that list
yeah but i dont know which part is what from the uuid ... i know the uuid is splitted into those 4 parts
I mean NPE tells you what’s null
it's annotated NotNull?
getuniqueid is
getUniqueId is
@NotNull annotation doesnt actually do anything code wise
Its just for your eyes, eg readability
Yeah and can sometimes even lie
^
what should I do to provide vault economy? implement Economy?
Yes iirc
or extend AbstractEconomy
yes
if so AbstractEconomy
it should have all the add, remove, and set methods when you extend it for your to override
well it doesnt make much difference since abstracteconomy implements economy
Was just about to say that
xD
But yeah IIRC whenever i made custom economies i did AbstractEconomy
yea it has some utils method overrides
like taking an offlineplayer as a param and converting to a name
i'll use the abstract class
Yeah itll have lots of stuff for your to override some if it can be left empty/null if you dont ever plan on using it and know plugins you use wont use it
Like converting to name im sure no one uses
@Override
public EconomyResponse isBankMember(String name, OfflinePlayer player) {
return isBankMember(name, player.getName());
}
i meant stuff like that
oh yeah
Its just to make it easier to call, in case you only have the String, or only have OfflinePlayer
that takes the player and passes the name
yep
i'll use abstract economy
also i guess i can manage player data as i want?
Yep!
vault does nothing for me right
Nah vault tells you to piss off for data storage stuff
lol
May i suggest
well i need to go with mongo
MongoDB
i already have some experiences and i've watched around 2 hrs of videos about anti patterns :p
only thing that annoys the shit out of me is the huge log and i can't figure how to stop it
huge log?
mongoDB always lets me think at monke
useless stuff
json database go brrrt
IIRc
you can edit the Object to set those logs to not happen
Similar to Discord4J logs work or Spark's
isnt there a MongoBuilder?
wdym
I havent used mongo in a long time, but iirc there was a Builder that had some logging methods
lemme see
Object = MongoClient instance
there's MongoClientSettings
welp
This exists
But you need another lib....
anyone know why this isn't working?
join class: https://paste.md-5.net/mukobivuzu.java
main class: https://paste.md-5.net/oqiricunuc.java
(it doesn't set my gamemode to creative)
is there a gson tutorial or something on the forum?
why is this always true?
if (killer.getInventory().getItemInMainHand().getItemMeta().getDisplayName() != null)
i've used this too but it throws a classcast
Your missing @EventHandler
((LoggerContext) LoggerFactory.getILoggerFactory()).getLogger("org.mongodb.driver").setLevel(Level.ERROR);
In your Listener class for your onJoin method
oh right, thanks
interesting
Maybe log .getClass
and see what its an instanceof
displayname cannot be null
oh
either it will throw an exception or will be empty
so how do i check if an item does or doesnt have a custom name?
iirc if itemmeta.hasLocalizedName()
based in docs
Plugins should check that hasDisplayName() returns true before calling this method.
ah hasdisplayname
oh
wish we had that method a long time ago
in which case it wont have a displayname?
displayname i think is custom.. then if the item has the default name then this can cause a null (?
hmm
For the love of god why cant getDisplayName be nullable
Doesnt this method return the default item name iirc? It can also just chack against this for this displyname
does Player interface have any implementation in spigot???
explain?
It does in craftbukkit
Player is interface. Is there any class in spigot that implement that interface?
This is paper specific method
Yes
CraftPlayer
CraftPlayer
thanks
^
oh no
ok i'm finna launch the server
and imma see
wait wtf did it really not give a classcast now
getI18NDisplayName()... what a name
It stands for internationalization iirc
mwa
yeah they could of came up with a better name
like
getInternalName().....
getDefaultName() ffs
getName() :kek:
im honestly malding there is no method to get the vanilla item name
kinda anti climatic that i need to use 2 imports just to stop a fucking log
but ok
How can i do monthly stats
yeah it works fine thanks burchard
Theres another library like this that does it too
IIRC Spring does the same bs
i'll give it a try but for now i just care it's gone :p
how to check if a block is a "block" not something like grass, fence gate, fence or ...
is ladder solid ?
don't think so
im making something like a block animation
solid blocks should be ones that can pass redstone signal
and i dont want it to spawn like on fence
check the implementation
it's an enum
no implementation
just check the enum
how can i convert a uuid into a four 32-bit number ?
imagine if every minecraft block had a class like Entitys do
i will just decompile CraftBlock and see
there's all the enum constructors
lmao
final GrassBlock grassBlock = world.getBlockAt(grassBlockLocation);
grassBlock.delete();
grassBlock.update(true);
so what should i use
for what?
a Block is just a representation of a location
how can i make custom config file instead of plugin.yml, like plugin.json? or even annotations in code?
solid checks if there can be built upon
To use JSON you need to use Gson, Moshi, or Jackson
i should not check for every tag
Why
^ why
let's say i have gson, how can i make spigot use it instead of plugin.yml
the new 1.18 system wants a intarray of the uuid instead of the uuid for a SkullOwner in a item
nbt tags in mc use that iirc so maybe something related
you dont?
What are you trying to achieve
that you need to ditch plugin.yml
plugin.yml is something spigot needs to load your plugin
You cannot change it, you cant trade it
Ah you dont have proper skull api on spigot
you'd have to modify the spigot jar
^
something you don't want to do
there is something to load a texturestring into a skull ?
yeah, i want to ditch plugin.yml and make plugin load from some other file? i think it's possible
like plugin.json or annotation in plugin's main class
Its not possible unless you make a ClassLoader plugin to load your own plugins
.
^
Idk why the plugin.yml is such an issue
i NEVER touch it
¯_(ツ)_/¯
what about my issue
what should ido
Only time i ever touch plugin.yml is for depend and soft-depend
if you use a command api you don't even need to modify it for commands
If you want to remove commands form plugin.yml inject BukkitCommand's into Bukkit's CommandMap
i made my own so ez
i've found that one of the JavaPlugin's constructors have PluginDescriptionFile argument, is it plugin.yml?
You cannot change this im telling you
Without changing Spigots source code you cannot remove plugin.yml
that's sad
plugin.yml is there for a reason
no way no how, you can however make a seperate plugin that works like BentoBox
you'd probably write 100 of them in the time it'd take you to modify spigot's jar
If you make a Plugin, thats loads your own custom made plugins you can have your own plugin.yml in a sense
ik, but i want to replace it with json or annotation, i don't like the way it's done
Whats so hard about it?
Still requires plugin.yml
Nope
BentoBox doesnt need plugin.yml for its Addons
Go check the src
can i at least auto-generate it at build time from other file?
I did because i remade that project lol
They have a .yml yes
if you want to make addons for a plugin of yours you can use whatever you like, but you can't do anything about spigot's plugin.yml
But its a custom one
Its one you can make whatver ou want
Oh wair
Its likely not used
I've started using the Cloud Command Framework recently, from the developers at NoxCrew and I love it
hence "addon.yml"
addon.yml is the one that actually handles the loading for BentoBox
"addon.yml"
"plugin.yml"
Its still required to be used by spigot as a plugin
.
no because for your plugin to be loaded, the plugin.yml needs to be validated first
Its not a plugin...
else it doesn't even call onEnable
BentoBox doesnt load addons as a plugin.. its loads them through ClassLoader...
🤦 its loaded as one
is plugin.yml used in PluginLoader? i mean if i implement it can i somehow it use instead of JavaPluginLoader?
@noble lantern Damn that Pterodactyl NodeJS API was just what I was looking for, nice work
Thanks 🙂 if you have issues with it join disc and open ticket, ill be glad to help
@spiral light to get 2 ints from long use
long l = 0;
int fst = (int) l;
int snd? (int) l >> 32
This is almost exactly how bento does it
as well as spigot
This is how you can have a custom "plugin.yml"
hence why bento has "addon.yml"
Bento's addons are loaded as "addons" to the main plugin that loads these
Remove plugin.yml then from an addon and try loading it
When i have time sure, its 6:30am rn tho
Either way
point is i was TRYING to make
is that you can have something SIMILAR to bento box that allows you to not have to use Spigots plugin.yml but if your only using that project like bento for that reason your using it wrong
thank you, this worked ^^
If you dont want to have to fiddle with commands in plugin.yml use a custom command handler and never touch the plugin.yml again
^
There is no way to work around plugin.yml without:
Editing Spigots source code
Doing something similar like BentoBox does or the plugin i made i sent above
wait in theory could you make multiple economies with vault
Yes
like a token one, money one
So like one class is named MoneyEconomy
Next is CoinsEconomy
yeah its super usefull
a lot of MobCoins plugins use vault
at least i know what i need to code because of the interface
imagine not using vault for economy
and i don't discover a year later that i forgot to put an eco method i need
sexy
Anyone know why EntityTypes wouldn't be available on 1.18? I'm using a remapped-mojang depend
i used to run a friend server with some plugins of mine that had item eco and it was fun
How would I give the player blue dye if they pass throug ha ring?
especially with inflation, they didn't know where to put money
Thats why i implemented compressing
nah i like giving pain to people
it will go down 4 or 5 more times
Why not use spigot?
i don't like servers using npcs
i find it lame and outdated
especially compress npcs
Check if they pass through that region, look into how to make CuboidRegions
I reccomend using WorldGuard api and world edit api to save yourself some time
wdym
See mine isnt copy pasted 😉
Custom plugin
yes i know
Honestly "vault virtual card" is the most convenient
How do I check if they pass through a region? I have never worked with java before but I really just want to make this -_-
but i still don't like it, i much prefer guis or commands
but if you made your own system it's nice
If you have never worked with java before i would reccomend learning it before trying to make something really complex like that
at least it's not that trash plugin everyone uses
Why use a mojang jar is what i mean?
Also EntityTypes was never a thing wasnt it?
Thought it was EntityType
Ah thats why its likely not showing up
entitytypes is a nms thing
or is there a proper way to do it
Make a getter in your plugins main class for the economy
Oh i wouldnt know then as i havent played too much with NMS apologies
no worries
Just pass Economy instance in constructors where you need it
Yep, whichever one is extending AbstractEconomy
ah kk
Just make sure its registered
wdym
As in your onEnable just make sure you register the AbstractEconomy class
and yeah GUI's ar enice but a pain for stuff like this kinda
Yee
Damn, this is legit the only thing I have to do for the entire server and I dont know how to lmao
Do you think there's like a tutorial or a doc somewhere?
which one?
if(Bukkit.getServer().getPluginManager().getPlugin("Vault") != null) {
Bukkit.getServer().getServicesManager().register(Economy.class, new ClassForEconomy(), this, ServicePriority.Highest)
}
https://www.spigotmc.org/threads/vault-custom-economy.282548/
oke thanks
Sadly java is more complex than just a few docs and howto's
I only know C# So ye
Oh then you basically know Java
If you know C# Java should be fairly easy, its relatively the same just a few minor syntax differences
But google is your best friend look into how to make your own CuboidRegion and then listen for when a player location is inside that CuboidRegion
ty
https://www.spigotmc.org/threads/region-cuboid.329859/
Here is this article for an example too
However WorldEdit/WorldGuard's API may be more simple to use
as you can just create a region with them and not need to create a whole class like that one
If I want to give 1 blue dye for green rings, 2 for yellow, 3 for orange etc etc would it be different? Since the rings spawn randomly
make multiple regions i guess
So the region thing wouldn't work like thatt
You would have to handle it yourself
So EG:
CuboidRegion at x location is blue, give blue dye
CuboidRegion at x location is red, give red dye
basically like a config in a sense, but a more runtime config
when you randomly generate the ring, randomly generate a color associated with it and assign it to the ring
HashMaps/Maps (Dictionarys for you) would be useful in this
at least i think theyre called Dictionary in C#
can you make regions that arent cubes in wg?
They're circles
Making anything other than cubes is very hard
is using async for vault safe? i'll need to make mongo requests so i need async
Lots of math involved
yeah, basically a cube around the ring
Yes it should be kind of
Only issue is
It wuld be best to have a cache system
HashMap<UUID, Long>
always pull values from the map never from mongo
only pull form mongo on player join/server loads
oh yea that's stuff on my end, i plan on caching online player data and also any data that is requested
If you always read from the Map shouldnt be an issue
But if you read from mongo during runtime it can be an issue
eg player spend money he doesnt have
let's say someone wants to get a player's balance, i'd make a request to mongo if someone wants an offlineplayer's balance
and cache it
Why not cache the whole playerbase?
also i'd cache online player's data
When server starts just pull the entire database
wouldn't a 10k element hashmap be bad
Its only Longs isnt it
Since its basically JSON the actual Size of MongoDB being sent is actually really small
https://www.debugbear.com/json-size-analyzer
Look how large this object is
See how you can reduce the size of JSON data, for example in your API responses or database.
and its only 54kb
so if you stored 10k UUID, Long in a HashMap ide say it would be fine
and pulling all that data from mongo shouldnt take long at all
i mean wouldn't it slow down if i try to get something from an huge map
or call methods from it
also, i'd need to autosave it and syncronize it
so then i'd have to save all data back
let's say every 5 minutes
considering a HashMap can have millions of entries
10k shouldnt be an issue
But 10k of a large object could bring memory issues eg if you store 10k blocks or Locations in a HashMap
But 10k Longs shouldnt be an issue for any modern machine
well
If you edit cache before sending to MongoDB you never need to update
Server starts
-> Loads player data
-> player pays player 1$
-> player's balances are changed in cache
-> PUT request sent to mongoDB
you should only be sending requests this way
You shouldnt ever have to call a get unless you only want to load online players and player that get accessed while theyre offline
Loading online and accessed players
Or load entire database, up to you really
You can even create a purge system where inactive accounts with not much money get deleted
so that way you save on index + storage space
Could you send me a thing about CuboidRegions? I created a region for the ring with worldguard however I have no idea how to make CuboidRegions and google only talks about making them without WG
so when the cache changes i should update mongo
@noble lantern
Yes
eg BoundingBox#of(Block corner1, Block corner2)
There will never be a need to pull data since you already have it
I have like 400 rings, would I have to do this 400 times??
And since you changed the data locally, and pushed that local data you already know whats in the database so no need to reverie unless the request fails
each ring must have a defined center/size
what if i need to sync up two servers
i don't need to in this case but let's say i do
pfff
if they do, its simple
i could only cache online player data couldn't i
If you need to sync 2 servers then thats a bit more examples
Complex*
You would basically need to be always pulling the data
(Btw ive never made a plugin before, I have the Skript plugin on my server but thats kind of it so I have no idea what to even do)
So in that scenario you would need a queen system
do you know java?
And make sure each economic exchange is carried out in order and not before your Mongols request is returned back with the players balance
I know C#
close enough
prefered ide for Java between eclipse or intelij?
intellij
Notepad++
IntelliJ onelove
nano 
Pen and paper
Eclipse for me, but my question was to Host
Anyone who doesn't use intelligence in here needs to be banished
Jk
Okay integlligence yes
Idk I use VS for C#
I meant to type intellij, but what I said still stand as well
You can use VS, btu no one here would give specific support for it
Alrightt
Eclipse for java, Intellij to convert other's source to eclipse 😉
so what would I use instead
that is more valid than the original sentence
My choice is Eclipse as its simpler. Many go for Intelij because they like the bells and whistles and it does code suggestion so they can be lazy
Intellij Idea definetly
jetbrains basically have an ide for everything
Intellij auto correct on top of the AI auto completion oh my GOD
pycharm, intellij, and so on
thats probably the most complrehensive tutorial for a beginner to plugins
Damn if Intelij does all of that wouldnt it be better
Some people prefer simple
Intellij has so many features sometimes its hard for people to use
intellij + mc development plugin
I prefer Eclipse. It does what I tell it and no more.
intellij is simple as dick
Thats such a good plugin
man I sure do love dick
Ive never written my own pom.xml
yeah
Ayo what
What did he say
What did that guy say ayo what
So eclipse or IntelliJ
intellij for me
Ayo what
try both and decide
your choice, its personal preference
IntelliJ + plugin i sent
HMMM
no gradle kotlin dsl support 😭
maven better
Tab9ine is overpowered
I'll just go with IntelliJ
maven suck
i don't like tabnine
wise choice
i prefer codota
Its supports Grable wym
also iirc it does ^
But not kotlin dsl
btw what did you mean with this?
it have not support for kotlin dsl
not request until i'm sure the data is updated?
Groovy sucks even more than maven
how would i make sure it is
You would need a queue system in a sense just to make sure each request is handled synchronously in a sense
Indeed
i'd need the servers to talk somehow
On economy update:
Update to all servers
That could be an option instead indeed
And the condition just runs on the proxy
like i can say hey this player data is changing so wait please to all servers
Economy***
and then say ok it's done u can get it
You can stick to the original thing I sent with caching if you do plugin messaging
So no need for waiting since its all cache
o yea so hold all data in a bungee plugin
Yessir
And the spigot plugin side just talks back and forth between the bungeecord
sometimes i wonder how much it took for big production servers to sync data up
i think it's one of the most complex things about spigot coding
It gave me idealC
Its a lot of work for data syncing accrods servers ngl
also error handling and all this stuff
Its so hard to prevent duplications
If its not perfect someone will figure out a dupe in your sync and rip
Hey guys I need a plugin that will transfer to the site when the item is Right clicked, is there such a plugin?
Hypixel uses uhh
idealC > bin > idea64.exe?
Shoot whats it called...
hypixel has had countless dupes like that
and also another server (cosmicsky) had a similar dupe
Is that intelliJ
inventory and balance were updated one after the other in the same async thread
(use redis)
so people made notes and instantly got kicked from an island to join another server
and keeping the money note but getting money back
?
something else i have to learn nice
probably
do i need to host it somewhere to make it send messages between proxies
wait does it classify as a database?
https://www.jetbrains.com/idea/ Is this the official website?
It connects similarly to like Mongols connects
It classifies as a temporary database
Redis data is cleared on restart
create an array and slap the items inside
You can make it persistent, but don't
i'd need it just for messaging anyways
dont create that many itemstacks
No need for messaging
If you use redis
create one, add it, set it to a new itemstack add it
what'd i need it for?
PluginMessaging would be used if you not using redis
In that case bungeecord basically acts as a redis server
As the bungeecord plugin would be handling a map of data for balances
If you use redis, you dont even need to cache anything on your end
Load data from mongo
-> send to redis
And you can create a program thats always running to sync mongo + the redis server together so that way all players are loaded 24/7 to redis
But TBH this isn't meant for something like a public plugin like I think your making
Oh then defo use redis
Yeah I reccomend redis if its your own private thing
Basically treat redis like a Java program that only runs a HashMap
so i can make requests to redis
ItemStack.getDurability() is deprecated, what should i use instead?
what would the difference be? wouldn't it act like mongo and need async or take a bit to take data
for network speeds
wait i host it on the bungee server
in theory
Host is on the same machine as your bungeeserver or mc server
So you have no latency
Its also better for security too
Waddo I do
That way its not on an open network
hmm slapping redis on a minehut proxy isn't very doable lol
you know those containers have ssh right
Yeah its a lil complicated search in the dev chat and look for my latest messages on the minhut chat
You need to use a ngrok tunnel but that whole system is rather simple
Ngrok tunnel plugin -> ssh access
Do you know java?
that's a lot of work just for editing longs lmfao
How do I install this
well that's what distinguishes a good server from a trash one
Well its rither:
PluginMessaging + queue system
Redis + ngrok
You can entirely remove the queue and redis...
no
just open this and click 'Install to Intellij IDEA <version>'
i mean for me that i don't have much experience with this kind of stuff
But there is a chance that a player may spend money he doesnt have because you were waiting for a request to finish
i'd be interested in learning to use redis and also to code bungee plugins
try installing from marketplace from ide
so it's a good occasion isn't it
Redis is super simple to learn
Its legit just a HashMap
Its a collection of different HashMaps pretty much
ty
Database.HashMap is its structure
Do I make a spigot or bukkit plugin
@eternal oxide How do you suggest I do this with a tree search?
Dm me if you have questions im off to bed myself
WHat exactly are you looking to find? actual portal blocks? teh blocks surrounding them?
actual portal blocks
but there are many portals
For that project in Intellij
ok, so its going to be vertical or horizontal blocks
For (x)
For (y) {}
So block face?
Jpoin the thread
Couldn't he just do something like this
Hey folks, I'm toying around in NMS again. I'd like to disable an entity's collision completely, is this possible? Previously I had a field collides in net.minecraft.world.entity.EntityLiving, though this one seems to have gone
Ye I have that
then choose spigot and click Next
Increment X until you hit air, go back one X. Then go up and down on Y until you hit Air, go down one on X again and continue
What's groupid
it's related to maven
it's package in which you project is stored like com.host.pluginname, just like namespaces in c#
artifactId is your plugin name and groupId is for example com.host
Wait so I set the groupID to java com.host.ringitem
Then I set the ArtifactID to ```java
RingItem````?
no, you set groupID to 'com.host' and artifactId to 'ringitem', though you can use whatever you want
you are not neccessary to use 'com.host'
and what Version?
Gnight devs
you can leave it to default, it's your plugin version '1.0-SNAPSHOT'
Ahh
Then just next
https://gyazo.com/2626019f266c7505dc9459ff729dcc6b What am I ment to do here
just specify you as author, and if your plugin have dependencies, put them here
also you may add description
but it's not necessary
https://gyazo.com/9798bc0746ac873ba167b4cbecf4a248 I just did this
btw its 1.17.1 not 1.18. Ignore that I changed it
it's ok, but remove 'no' from website, just leave it blank
also change minecraft version if you want, current is 1.18
remove 'no' from website (leave it blank) and proceed
Hello anyone know how to fix that
import com.metaxcrew.magicalcore.MagicalCore;
import com.metaxcrew.magicalcore.Utils.VaultUtils;
import net.md_5.bungee.api.ChatColor;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.player.AsyncPlayerChatEvent;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
public class ChatDesign implements Listener {
public ChatDesign(MagicalCore plugin) {
plugin.getServer().getPluginManager().registerEvents(this, plugin);
}
public String translateHexColorCode(String message) {
Pattern hexPattern = Pattern.compile("&(#[A-Fa-f0-9]{6})");
char colorChar = ChatColor.COLOR_CHAR;
Matcher matcher = hexPattern.matcher(message);
StringBuilder buffer = new StringBuilder(message.length() + 4 * 8);
while (matcher.find()) {
String group = matcher.group(1);
matcher.appendReplacement(buffer, colorChar + "x"
+ colorChar + group.charAt(0) + colorChar + group.charAt(1)
+ colorChar + group.charAt(2) + colorChar + group.charAt(3)
+ colorChar + group.charAt(4) + colorChar + group.charAt(5)
);
}
return matcher.appendTail(buffer).toString();
}
@EventHandler
public void onChat(AsyncPlayerChatEvent event) {
Player p = event.getPlayer();
event.setFormat(ChatColor.translateAlternateColorCodes('&', translateHexColorCode(translateHexColorCode)), VaultUtils.getChat().getPlayerPrefix(p )).split("&")[0]+ p.getName()+ChatColor.WHITE+ ": " + ChatColor.GRAY+event.getMessage();
}
}
everything in onEnable will run every time server boots up, code in onDisable, when server is turned off
just start writing code
use spigot docs to find what you need
I honestly have no idea what I'm searching for