#help-development
1 messages · Page 1623 of 1
instead of manually dispatching commands tho, you could code against the multiverse API instead

I can't see where did I static abuse
I mean, still not a fan of the namespaced key enum/static plugin instance setup but w/e
static = global = good???? /s
ItemStacks.qq() sounds very obvious that it is projectile protection?
Even then
Use an item builder
Imagine you're just some beginner
or you're looking at old code
and it's like hmm okay lemme just change a mention
So you use your IDE autocomplete
And it just returns
silk()
eff()
unb()
sh()
mn()
sm()
sq()
qr()
bl()
qf()
pf()
qq()
You'd just want to learn NMS at that point because you're a literal god if you understand what's going on
first 1-3 lines are somewhat fine
but after that
this might be really dumb but uh how am i supposed to do DI on that
nah
why can’t it be static? Totally fine to have it static
sth can be brought up about thr amount of code duplication
But its fine to have that static
static abuse is the code I run on production
um
Static is fine if the variable is constant
and appropriately named
static is just … not using an instance
You can either ditch all static
or you can make them all public static whatever
and make an init method
Static fields imply they will always be present in-memory
Only garbage-collected if they're nulled out iirc
For the lifetime the jvm
I fail to see how that’s an issue with the shown ItemStacks class
Static fields aren’t necessarily bad, as long as you dont keep collections which are infinitely growing
Static abuse means that someone is using static for convenience and not following OOP principles
am i doing that
Collections, database connections or really any mutable objects shouldn't be kept statically
how
public static ItemStack PROTECTION;
...
public static void init(MyMainClass main) {
PROTECTION = ...;
}
for example
that solves nothing
Passes his variables
I don't see a big problem needing to be solved
If you DI everything you don't really need static at all
its an utility class, its fine
I'd only use something like that if I need the values on an enum
is the best way to store things such as a kill counter for each player json files?
If the plugin somehow gets disabled those itemstacks are still kept in-memory
If you need an instance, design it following the factory design pattern
individual storage files are good
even better if they're proprietary
but ultimately, a database
for a small scale server?
do you mean one file per player?
ah ok thanks
Is there a way to block the click on a furnace recipe? I have a custom Inventory and i dont want that the player can click on the recipe in this specific inventory (Without removing the furnace recipe)
singleton
for example
bad
o
still uses static
inventoryclickevent
@quaint mantle e u cant help?
if i didnt already help you then i dont plan on it
just use dependency injection
bruh
<dependency>
<groupId>me.clip</groupId>
<artifactId>placeholderapi</artifactId>
<version>2.10.9</version>
<scope>provided</scope>
</dependency>```
"just use"
"Dependency 'me.clip:placeholderapi:2.10.9' not found"
It seems im static abusing by getting ItemStacks from another class
1s
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
am i using the wrong version or something? i've tried 2.10.10 as that's the newest
It’s a tip
It’s really not. You have like 10 billion other issues you need to fix too lol
There’s a ton of repeated code
w h a t
how is that repeated
bro u didnt see how it was before lmfao
u wouldve murdered me if u saw it
how
@paper viper how to fix it
You can also condense all those statements into one and just pass in some sort of enum or something to identify
You know, this is why when we tell you something not related it’s because it’s something related to basic Java that is good to point out and bring to your attention
As those basic mistakes are definitely supposed to be fixed first
how can i find memory leaks?
not really a surefire way except to leave your program running and see if the allocated memory is unexpectedly high
@paper viper btw if ur gonna help
at least sned me a tutorial
its not like i didnt try :/
i didnt find any good tutorial
i went on those
its ?learnjava
?learnjava
Here are some links to get you started on learning Java:
- https://www.codecademy.com/learn/learn-java
- https://www.sololearn.com/learning/1068
- https://www.learnjavaonline.org/
- https://programmingbydoing.com/
- https://docs.oracle.com/javase/tutorial/java/index.html
The last one is the only official one, however some of those concepts assume that you already know a bit about programming.
i read the first 4
LMAO
exactly the one i focused the most on
it doesnt even have enums
2hex still need help?
2GB+ on server without players (on start how 0 players 800MB)
But idk what plugin
And how my plugin idk where
honestly
the most annoying thing to hear is learnjava
i legit spent days finding tutorials i found nothing useful
?ask
If you have a question, please just ask it. Don't look for staff or topic experts. Don't ask to ask or ask if people are awake or available. Just ask the question to the channel straight out, and wait patiently for a reply.
1s
tbh i found a solution some guy helped
they dont help
and u did nothing, even the command i told u it lmao
thats not how helping works, ur just making my day worse
Yes im serious
thats not how to help
shrugging
isnt helpful
uh
all I see is just a ludicrous argument going on here
solving static abusing
then it went to java
then shit
my guy
u know i wont even bother
static abuse?
So I'm looking for a way to get the block a player is standing on. But the block the person is actually standing on, not just the block under the player as it doesn't account for sneaking and going to the edge. For some reason this sounds easy but turns out to not be easy. I've been looking through forums but haven't really found an answer. What would be the best way of doing this?
no worries but I think your point has come through here
I can try it but i can't imagine that the recipe book will be triggered at the inventoryclickevent
2hex alright srsly
either give me a solution
Helsingin yliopiston kaikille avoin ja ilmainen ohjelmoinnin perusteet opettava verkkokurssi. Kurssilla perehdytään nykyaikaisen ohjelmoinnin perusideoihin sekä ohjelmoinnissa käytettävien työvälineiden lisäksi algoritmien laatimiseen. Kurssille osallistuminen ei vaadi ennakkotietoja ohjelmoinnista.
oh sorry, i thought you meant an actual item
No xd
something what wont make me look dumb
i have no idea if you can @crude sleet
:/
yeah
i found one
I believe
that has
?jd-s
check BukkitTask
140 hours full course
or BukkitScheduler
ppl told me its originally a 1 year
someone show me how?
bump 🙃
mmm that would require a lot of performance for a simple check :/
well simple...
apparently not
Anyone have a idea?
sneaking to the edge of a block or just standing on the edge of a block
any ideas?
I could check the blocks around the player but that would still be a meh solution
Hey !
I have a question
Is it possible that when you type in the chat @ and you press TAB, the list of the online players appears ?
like that
ah damn I can't send a picture in the living room
would love to see your living room
development
I'm french sorry 😅
so it's possible ?
aah is not possible in vanillia ?
ty !
can someone show me how to decrease the health of the bossbar every second till 1 minute?
im fairly sure that happens by default as a tab complete
from the context of the message they appear to be trying to alter tab completions for chat
which is impossible
except you dont need the @
task = new BukkitRunnable() {}.runTaskTimer(plugin, 0L, 1200L);
Bukkit.getScheduler().scheduleSyncRepeatingTask(plugin, new Runnable() {
@Override
public void run() {
int r = 1;
if(r > 9) {
r = 1;
} else {
ChangeSkin(player, r);
r++;
}
}}
, 0L, 1200L);``` I have 2 runnables I want both of them to run at the same time what do I do to make that happen?
I'm sure it's possible
why not make it one runnable
is it possible to do a 20fps animation in mc
yes
like refresh blocks once per tick
yes
but it will lag a lot?
depends
like the calculation wont lag much but
the block placement and stuff
it lags a lot
so is there a way to like
you can use certain entities and nms or something to do more than 20fps
optimize block palcement
Quick question, but how do I reference a potion? Ik it is like material.POTION and then I do not know what should come after it
spawning entites still lags?
well you dont need to spawn and remove them constantly
wait is the lag client side or serverside
both depending on how much youre doing
u do?
spawn and remove 20 times per sec?
again depends on how much youre doing
is it 500 blocks or 50,000
360p is a resolution
yeah thats gonna lag
both ways
and i dont think you can even do that many blocks 20fps/tps
yea
lets say i want to do a 20 by 10 block animation
and it ends up lagging
is there a way to optimize it
without
lowering the resolution
feel like minecraft is really unoptimized
...
especially java edition
well mc isnt designed to play "an animation" at 360p 20fps
hmm will it help if I send the new packets after all blocks are replaced
ik, but its a nice idea
XD
not really realistic but
meh why not try it out
Someone managed to play 4K on like 25 frames in MC
With my plugin and idek how they did it
Probably beefy ass PC
But it was smooth
client mod?
Okay wow, making a multi version plugin may be much more of a pain in the ass than I thought
I literally changed the version and everything broke. It like all broke
It uses VLC media player and FFmpeg to play the video
So pretty much C, C++, and Assembly
I didn’t think I’d have to interface so much
But like everything broke. Tf
There’s no PersistentDataContainer in 1.12. Wtf am I supposed to do then
NBT API
Like, the 3rd party thing?
Why does that matter
Because the only NBT API I know is that one library plugin
I’m asking if you’re talking about that
Does it hit harder server side or client?
I’d guess server
I suppose - although I forget how it is implemented
I guess with enough packets you could fill up the netty buffer
But that has no real performance effect
Just latency
Client
hey
is it possable to make something i make in an item stack that can only be broke once?
so that when the person brakes it it just destorys?
is this a mod or a plugin lol
plugin
Its not published
ahh kk
im still developing it
noice!
ya
Thanks
does it run mp4 or url vids?
both
oooo
can someone help me out with this lmao
ik its probs easy just i can't wrap my head arround it
someone already made it
then its a mod not a plugin XD
What…?
sorry bud but
here
make sure to do throughout research before making a plugin
XD
the server sents packets and the client matches the packets with the code and put on the correspodding texture correct?
that is how mc works?
u said multi version plugin soo
Yeah….and who said the first ever?
well
Dude
well whatever u do ur thing
I do not care
idc not my problem
LMAO
dude im just trying to help you
You’re doing an awful job
i thought you were wasting time making a already existing plugin :/
Imagine making plugins based on the amount of downloads you would get lol. ViaBackwards never would have been made in the first place.
its maps
then what do you make your plugin for, if you spent a week making a plugin that gets downlaoded like 3 times
lol
what will you feel
What’s that? You’re trying to do something challenging for fun? You can’t do that someone already did that!!!
😡
I make plugins for my own entertainment. Other people downloading or buying them is just a plus.
Do not misunderstand. I did not say you cannot do that
wow you sure have a lot of spare time
Sure as hell looked like it
I make plugins for the cash 😏
but i dont sell it
im jealosu tbh
I'm not sure why this is happening but when a player gets a multiple cooldowns then leaves the first cooldown stays but the other ones get removed. When the user disconnects I am saving their data into a db and grabbing their data and storing it into a map when they join.
Who tf says this
supa
i did
Ew
yes?
https://www.spigotmc.org/resources/superadmin-plugin-admin-permission-manager-abandoned.89120/ maybe you should of done some research tbh 😏
Since when did this discord have so many toxic people
WTF?!
yea i learned it the hard way
YOURE CALLING US TOXIC BRUH
so i abandoned it
my plugins are the best
If I didn't sleep, eat or other human need I would have 24/7/365 😉
I got some experience out of it but im still complaining
i hate u luckperms
luckperms is great
If your motivation is solely to be the first you won’t get too far
In a lot of things
well, what motivates me is to new ideas. I try to make things that don't exist so I can contribute to society. I also try to make stuff better, if I see a poorly coded plugin that has a nice idea and can be proven useful for the minecraft community, i will try to re-code it to make it better
thats just my personal opinion
🤷♂️
Shrimp
XD
You immediately assumed I was trying to make a new idea though, pushing your ideology onto others. Most people I know don’t think like you
Sure new ideas are great. But it’s not something to pursue religiously
That isn’t how you grow
luckperms isnt badly coded tho
sorry but please dont assume that I am religious
i believe in science
you can be both religious and believe in science though
I give up
Dude, I wasted a lot of time making a pre-existing plugin I was just trying to point out that what you are trying to make already exists. I am not trying to make u think the same way as me
I am only trying to help you...
🙁
wdym
That may be the formal meaning, but informally it can mean with a lot of dedication
why should i leave
That is how I’ve often seen the word used too
did i say you should
“wasted a lot of time”
i wish. If I can be a 8 year old rn i would love to, that is if i keep my memory
Yeah Operation you used it right dw lmao
bump ```java
public long getTime(IPlayer iPlayer, String cooldown) {
PlayerData data = playerMap.get(iPlayer.getUuid());
if (data.cooldownMap.get(cooldown) == null) {
return 0;
}
return data.cooldownMap.get(cooldown);
}
You grew from the experience. In the end, the attempt made you grow as a programmer. That’s not wasted time
Trying things done before is not wrong at all
I have an itemstack on another class. Is it possable to use that instaed of mat.white_bed ????
dude i said this
ItemStack#isSimilar
bump
?
Okay but why are you complaining
You can check the similarity of two itemstacks
well what made you think i left
idk
You still assumed that my motive was like yours right away
what does that look like in code lmao
like ItemStack. ?
itemStack.isSimilar(itemStack2)
I did not. I only pointed out that your idea has already been made into a plugin by someone
@plain scroll A#b means “an instance of class A, method b”
how many times do i need to tel you yhis
And no one asked?
I sure as hell didn’t
so like this...
you were complaining about your plugin not working in this discord
dude
no
OKAY AND????!?
LMAO
also since when hasn't spigotmc been toxic 😏
Where the fuck are you drawing the connection
Can yall fucking drop it
😐
it isnt a static method
idk if will matter since it's a broken block
no point in comparing item stacks
stick with material
well, if you are unconsiously making a pre-existing plugin. You usually won't ask if this plugin has already been made. Use your head pls
yea but idk why the blockBroken.setType air wont work with just a mat...
many people make identical plugins
u did not
so when i brake the bed taht was made with IS it jjust drops a bed
doesn't mean they're not smart
I didn’t
but yeah take it to DM or drop it
You’re trolling me at this point
😎
Im just wasting time on someone with scattered nerves at this point
hm thats not a very funny metaphor
is there a way to edit the item stack's drops without needing the event?
when you break a bed it drops a bed
did you code custom drops?
nah
prolly not
oh
oh
remove the drops
delete the block in blockbreak
because idk why it wont work with material
what event is this again
or delete the drops in itemdrop
i forget
what kind of drops
block break or item drop?
you might be able to inject or modify the world loot tables
thats what im doing lol
idk
and it didnt work?
try removing the drops from drop item event
code*
it's not dropitemevent if ur breaking a block and removing the block
it's blockbreakevent
don't cancel the event, just remove the event drops 😏
are you ✨ registering the listener ✨
u canceled the event before setting the material?
good smart idea
yea
XDDDDDDDDDDDDDDD
i think so lmao
idk why i lefit that in there 😅
or broadcast
just check lol
try canceling the event after you do the .setType
and put a log at the beginning of the method
method*
bump
ill try this
sorry never messed with databases
what do you databases for? I mean you have the ram and hard drive to store stuff
uh okay sure
why ask me...
ok here is the "bug" i get
what should i say in the comment
so what if I say dog water (I wont) but what if
if the bed is called Sleeping Bag it drops the bed but if i sleep in it and it becomes White_bed it drops nothing when it breaks lol
u'll get beat up
lol
u'll get blocked
probably
nah
I wanna get my thing done ugh
do it
ask in papermc or uhh
codedred's discord i suppose
I can't im typing blocked
what thing are you trying to do
well it seems to have a lot of features
can u test it 😳
this Joch
ok but why are cooldown string?
uhh this is not a malware right?
its on github 🙂
It's the name of the cooldown
can i send ua better method for cooldowns
github has anti malware checks?
https://github.com/jhalterman/expiringmap
ExpiringMap<UUID, UUID> cooldowns;
cooldowns = ExpiringMap.builder()
.expiration(plugin.getConfig().getInt("settings.cooldown", 5), TimeUnit.SECONDS)
.build();
if (!manager.getCooldowns().containsKey(player.getUniqueId())) {
manager.addUser(player.getUniqueId());
} else {
long duration = manager.getCooldowns().getExpectedExpiration(player.getUniqueId());
duration = TimeUnit.MILLISECONDS.toSeconds(duration);
if (duration != 0) {
manager.send(player, Objects.requireNonNull(plugin.getLanguage().getString("variables.cooldown")).replaceAll("(?i)\\{duration}|(?i)%duration%", String.valueOf(duration)));
return true;
}
}```
basically little snipets of how i use it
thing is u can do that
but without doing that
any entry into the map is automatically given a time
public boolean isOnCooldown(IPlayer iPlayer, String cooldown, int ms) {
return getTime(iPlayer, cooldown) + ms - System.currentTimeMillis() > 0;
}
``` my math
supa?
okay now what
did you get my ip finally?
try swear
lol
as a player dumbass
haha okay lol
try saying shit !~
dont be op
ok
See Joch https://imgur.com/NnCoC4y I have the cooldowns but when I join the last one doesn't get added to the map it's like it ignores it {dailyKit=1628291120492}
try bypass
ugh this is so annoying
it kicked me when i did s hit
yeah you can't even do
V
s@#($@)(#h@#(%$@)#($i@#)(%@#)(*$t
cool
alt 0138
im too assed to do it
nah I thought u did something smart like remove the word from the swear list
lol
as a player i cant do that right?
a normal player cant mess with the code
yeah they can
uh no?
backdoor
plus that plugin is way too large for me to do anything
thats... not a normal player
So i have this ```java
Set<InstancedMethod> methods = subscribers.keySet().stream()
.filter(key -> key.isAssignableFrom(event.getClass()))
.map(subscribers::get)
.collect(Collectors.toUnmodifiableSet());
But it returns `Set<Set<InstancedMethod>>`. Basically what i want to do is get a single set of `InstancedMethod` from this stream. how would i do that
and delete it
wait seriously?
🤡 I thought helpers in this server are not supposed to say shit like this lmao
it's large because of hibernate
i dont use dependencies and those seem like code to me soo lol
i am stupid
Nah we are a toxic community
nah im just messing with supa
stupid stupid stupid stupid stupid stupid stupid stupid stupid stupid stupid stupid stupid stupid stupid stupid stupid stupid stupid stupid stupid stupid stupid stupid
lol
toxicity
yay
yay
Joch so im guessing you don't know what could be causing my issue?
Does this look good for an EventBus
private final Map<Class<?>, Set<InstancedMethod>> subscribers = new IdentityHashMap<>();
public <T extends Event> void post(T event) {
Set<InstancedMethod> methods = subscribers.keySet().stream()
.filter(key -> key.isAssignableFrom(event.getClass()))
.map(subscribers::get)
.flatMap(Set::stream)
.collect(Collectors.toUnmodifiableSet());
for (InstancedMethod method : methods) {
if (event.isCancelled()) return;
try {
method.invoke(event);
} catch (InvocationTargetException | IllegalAccessException e) {
logger.severe(String.format("Unable to call handler %s on %s",
method.getMethod().getName(),
method.getObject().getClass().getName()));
logger.severe(ExceptionUtils.getStackTrace(e));
}
}
}
the event posting
In a small town with an unfortunate name, let's talk about filtering and innuendo. And use it as an excuse for as many visual jokes as possible.
I'm at https://www.tomscott.com
on Twitter at http://twitter.com/tomscott
on Facebook at http://facebook.com/tomscott
and on Instagram as @tomscottgo
(Thanks to James Paulsen for prompting me to do th...
I use a Map but i mostly use it as a set which is the weird part
yeah but the thing is
i will break that problem
by blocking every word
bro i didn't add all words
uh okay
that would be MCSF
😏
How can I find the latest version of specialsource-maven-plugin?
that one blocks all words?
Thanks!
no it just has an insanely large blocked word list
but i'm working on arecode it doesn't work correctly
okie GL
ur plugin is underrated?
using packetevents and im trying to convert a textcomponent -> json but have it not be broken from packets :D
hehe lemme test my swear word dictionary
oh
okay lol
since i filter all messages with MCSF it uses packets to bypass other plugin
i give up i dont know what 2g1c is
oh no
thats a lot of words...
let's not talk about what 2g1c is
oh i just googled it
ew
EW
EWWWWWW
🤢
think that's bad? this is my whitelisted words, words that can never be filtered
i don't host it on github because of how big it is
the thing is some words have different meaning based on the sentence
and AI would be perfect for identifying it
more efficient
probbaly?
oh i see
oh right here is the regex i use for matching
it's a bit out of date
oh i stole these from a game
lol
some kids game where u could only say certain wrods
oh yes abridged anime
words
they are the best
what kind
which one i mean
"Oh my god, my eyes are gone. Help! Help!"
yeah i know that one
which abridged anime?
😂
XD
No its not allowed.
question will this code decrease the bossbar health every second? https://paste.md-5.net/vinazubapa.java
why would you dm a mod?
No
ofc
I read it wrong at first.
All you are doing is removing the boosbar when seconds is 0
how do I make it so that every second the health of bossbar goes down until it has reached 1 minute
?
@stone sinew ?
what about this? https://paste.md-5.net/uqetojoqin.java
That might work but the IDK how much progress the bar has
like this? bossbar.setProgress(100);
IDK how the boss bars progress is set so IDK if its based on 1-100 or something else
can someone link me to some sort of documentation for spigot?
u can find it easily with google
lol
nah
idk if its to do iwth world guard cus it seems like it
people cant use simple cmds inside my rg
until they step out
eg. /shop /ah /kit
no ones there
so wait
-_-
nobody will help you here
go to WorldGuard discord
dat sux
they should?
NO SHIT THEY SHOULD
its their discord
but they didnt
saying
OH must be somthing else
and i said well how when its to do with world guard
????
and he said
u r not even in the wordlguard discord
not my problem
hopefully got banned
^
YEAH CUIS OI GOT BANNED
good
good
your name really suits you
well you are using their program so be polite when asking for help
i did
he was beikng a dick
and said not my problem
and i dont care
so i called him a dick#
sux
was he a dev
they dont have a helper role?
and its the gy in their
literally just don't touch any flags and WG won't prevent any command usage
think the problem exists between the chair and the keyboard here
HAHAH
could someone explain to me what ResultSet#computeIfAbsent does?
idk if it is a matter of me being stupid but everytime i type in extends JavaPlugin it never gives me the option to import pls help
Auto import?
resultset doesn't have a computeIfAbsent method? did you mean map
yea
you pass a function and it will be run if the specified key does not exist in the map
the return value of the function will be the mapping for the key
okie
you should get a bot to automatically take code blocks and upload them as pastes
why the event dont works? https://paste.md-5.net/qoyeletamu.java
like what LP does
ive seen another discord have it and its quite helpful
don't think that event is called for interacting with cake
cake is special in that you don't exactly 'consume' it
Did I do this correctly because im just guessing ```java
data.cooldownMap.computeIfAbsent(res.getString("Cooldown"), a -> {
try {
return res.getLong("Time");
} catch (SQLException throwables) {
throwables.printStackTrace();
}
return res.getLong("Time");
});
I have an abstract class implementing listener, but any EventHandler method other than one with a public signature wont execute in said class. This only happens in the abstract superclass class, any EventHandler method in a subclass still fires no matter the signature. The abstract class registers itself in its constructor. I specifically want a private eventhandler in the superclass, why does it not work?
Pretty sure it has to be a declared method
that second return is pointless if an exception is thrown becuase it will just rethrow it and it will be uncaught but it looks fine to me
Also EventHander annot isn’t annotated with Inherited
so just return null?
So it won’t be inherited
yes, and it wont add it to the map
well if an exception is thrown then you cant exactly put it in the map
so it only works if it is visible to the subclass?
the first return will add whatever res.getLong(time) returns to the map under the key res.getString(cooldown)
Yes declared that is
Because it scans methods using class.getDeclaredMethods
by declared you mean declared vs abstract?
aw I think it broke
nevermind i figured out what you mean... but then why does a public signature still work even when not declared in subclass?
?
the eventhandlers in the abstract class only work if theyre public
even if declared only in superclass
Implicit declaration I guess
LMBishop can you help me with this every time multiple cooldowns are added all of them get removed from the user except for one
Oo damn that’s hot
Anyways EventHandler isn’t inheritable still
Is this how you would do it if you had a class in the map? ```java
playerMap.computeIfAbsent(UUID.fromString(res.getString("UUID")), (Function<? super UUID, ? extends PlayerData>) new PlayerData(iPlayer.getUuid()));
Hi, does anyone knows the actual applied speed/force on collision bounce back ?
how i can check if player is eating a cake?
something like
compute(uuid, key -> {
// some logic involving key
return new class();
});
oh ok so same like before
Why is this happening ```java
{dailyKit=1628300231700}
[01:37:16 INFO]: {dailyKit=1628300231700, pvpKit=1628300231143}
java
if (res.next()) {
playerMap.put(iPlayer.getUuid(), new PlayerData(iPlayer.getUuid()));
do {
playerMap.computeIfAbsent(UUID.fromString(res.getString("UUID")), key -> new PlayerData(iPlayer.getUuid()));
PlayerData data = playerMap.get(iPlayer.getUuid());
data.cooldownMap.put(res.getString("Cooldown"), res.getLong("Time"));
System.out.println(data.cooldownMap);
} while (res.next());
}else {
playerMap.put(iPlayer.getUuid(), new PlayerData(iPlayer.getUuid()));
}
Hey! I'm not really looking for help but was told earlier that this was an alright place to ask (I know it's not the active time right now, but I fell asleep earlier haha. I've now committed all my most recent projects to GitHub to make them easier to share).
I'm looking for criticism and feedback on my code. These projects aren't really made for others to use as they're designed for the network I'm working on myself so keep that in mind when looking, though I'm aware I need to add some configs for them anyways and I don't plan on keeping everything as hard-coded as they are right now, I just plan on doing that later.
While I'm proud of these recent projects because I've challenged myself by using libraries I've never used before (BungeeCord, JDBC, JDA which I've got very comfortable with them very quickly so I think it's safe to say it's not my Java knowledge holding me back anymore), I know my coding style isn't preferable and there's still lots I need to improve on so any feedback is fully appreciated (even on my usage of GitHub as I'm still not fully comfortable with GitHub yet). I'm very interested in keeping code performant/optimal but also easy to read. Thanks so much in advance! https://github.com/StockBlockMC
Also please feel free to let me know if there's a better place to ask.
what is the issue lol
well none of that code has anything to do with removing cooldowns
oh I know
This is what I do to calculate the time left ```java
public boolean isOnCooldown(IPlayer iPlayer, String cooldown, int ms) {
return getTime(iPlayer, cooldown) + ms - System.currentTimeMillis() > 0;
}
that can be simplified by just checking if the left side is bigger than the right
that doesn't really matter currently I just wanna get the issue fixed
Or at least can anyone describe the behavior? In vanilla, when entities go through, the other side gets loaded for 300 gt---3x3 entity-processing, a ring around that that's lazy, and a ring around that of border chunks.
well nothing you've sent so far points to a potential issue
I highly doubt this is the issue ```java
public long getTime(IPlayer iPlayer, String cooldown) {
PlayerData data = playerMap.get(iPlayer.getUuid());
if (data.cooldownMap.get(cooldown) == null) {
return 0;
}
return data.cooldownMap.get(cooldown);
}
``jav
if (!loadPlayerData.isOnCooldown(iPlayer, "pvpKit", 20000)) {
Kits.pvpKit(player);
player.sendMessage(ChatUtil.color("&6You have received kit PvP."));
playerData.addCooldown("pvpKit", System.currentTimeMillis());
loadPlayerData.saveAsync(iPlayer);
} else {
long i = loadPlayerData.getTime(iPlayer, "pvpKit") + 20000 - System.currentTimeMillis();
player.sendMessage(ChatColor.RED + "You can't use that kit again for another: " + ChatColor.GOLD + LoadPlayerData.convertTime(TimeUnit.MILLISECONDS.toSeconds(i) * 1000));
}
If you want to see what's actually happening better than my explanation you could join the server and test it yourself
what does add cooldown do
adds it to the map
public void addCooldown(String cooldown, Long time) {
cooldownMap.put(cooldown, time);
}
yo I feel very retarded this has happened to me multiple times I forgot to add the jar into the server
so i suppose it is not broken then?
yeah its not broken
lol
what
Because uh, cross compatibility with fabric and spigot dont wanna make two plugins
so i just made my own eventbus
what's that
Since i cant use spigots
The thing that makes events move around
publish/subscribe
pubsub system
easier terms, i created the EventHandler
i made it look like spigots but that is my own code
@EventHandler is defined by me
you've reimplemened the event system
Yeah i kinda need too but yes
oh
Since i wanna make it work on fabric i just decided to reimplement events myself as a platform agnostic system
I was confused lmao
Why should you use databases in your plugin
why not just store them on your harddrive...
i dont understand
why are databases good
easy backups
faster then IO
more secure if you do it right
can also use the same db on any machine
ahh I see, so its like cloud storage?
basically
but it heavily relies on bandwidth?
not if its local
^
wat?
even then I remotley use a db and my speeds are still faster then IO
if you host the DB locally, it removes the internet issues
public Location blockLocation;
public void run() {
switch (blockLocation.getBlock().getType()) {
case IRON_ORE:
blockLocation.getWorld().dropItemNaturally(blockLocation, new ItemStack(Material.IRON_INGOT, 1));
}
}``` I need to find out if IRON_ORE is equal to block location then spawn an item
but how come databases are faster
IO is slow
as rack has said
shit
5 times
lmao
databases is like
not a new type of technology that stores data like ssd right?
wait IO is the default java system for writing files?
IO = file storage
and databases the improved version of default ajva data storage system?
IO is a file?
io is input/output
it goes to a file
and what does databases go to
IO also includes networking
files?
but most commonly refers to files
i dont quite understand how databases can be faster than physical memory like ssd
RAM is temp memory and ssd and hdd are perm memory is what I heard
and DBs is faster than ssd and hdds
mhm
