#help-development
1 messages · Page 178 of 1
yeah I figured it out im just waiting for you to hate on me

😮
my exact reaction to that
if at first it doesn't work threaten people until it works
Anyone know how to make this work better without that black box on top of the zero
if (args.length >= 3) {
List<String> returnnull = newArrayList();
returnnull.add("");
return returnnull;
}
might just return Collections.emptyList()
as long as you dont need it to be mutable
aw thanks
idk who they were talking to lul
but yes, magma guy very cool pfp
yeah that's a handsome young man for sure
did you have to change your forums username to get that
hmm
all best things in life come from bullying
https://paste.md-5.net/ebitejazeb.java
So the chat ingame is giving me a error but the console is clean so I cannot find the problom.
what error
idk
chat ingame is giving me a error
If I have an Attribute which is Attribute.GENERIC_MAX_HEALTH, how would I convert its name to Max Health, or for Speed, Attack Strength, etc?
do I just hard code that?
there's not that many attributes anyhow
generic is annoying, I'd parse it out
mind you attribute math isn't that straightforward
wdym
the modifiers for attributes are whacky
Say I have a method that creates an object how long will that object be in memory for?
For as long as it is referenced
example
public Object makeObject() {
return new Object();
}
// MAIN METHOD
Object myObject = makeObject();
// Do stuff
// Here is the end of the main method, myObject will be freed up
So if setCursor is deprecated in inventory click event now, how am I supposed to change the stack on the cursor?
Ok cool ty
so i wouldn't have problems with it filling up memory?
as long as you don't keep references to it
Nah
Great question
Use deprecated methods
Ok got it ty
Spigot 101
That doesn't sound ideal
Espicially because the cursor doesn't actually update
Use deprecated methods
This is spigot we talking about remember
It nulls the stack on the cursor, but clicking on any other slot updates it back to what it used to be
i am trying to make an explosion of transition particles, but they don't appear to be directional. how would i make them move?
i'm not 100% on this one but I think if your particle speed is 0 then the x y z becomes the vector for the particle
particle constructors are a nightmare
ikr
like why are some particles directional and some not? there should be a system where you can just implement a vector or something
and it works on every particle
pretty sure it's deeply tied to how minecraft implements it in the first place
there's several different standalone systems for coloring particles too
didnt work
might be impossible to do then
ik but i just dont see why they didnt make it with vectors or something in the first place
btw another thing i am trying to find out is how to check if the velocity is going to make something hit a wall or not
how would i approach that
the particle?
ie. an arrow: create an invisible arrow only on the server and add that velocity to it, if it hits then good, otherwise it wont't
or you can go the hard route like I did and simulate projectile physics
but how would i separate that from the game so that it doesnt affect things like mobs?
I guess simulate it
Hey guys so i just got into making plugins for 1.19 and I tried getting the spigot file for 1.19 and when i put it in eclipse it doesn't import the JavaPlugin libaray, does anyone have a link or correct spigot file for 1.19
doesnt that defeat the purpose of using an arrow?
couldnt i just get the first block along the velocity?
dont use the file for the api
use maven or gradle to import it
how
?maven
The home of Spigot a high performance, no lag customized CraftBukkit Minecraft server API, and BungeeCord, the cloud server proxy.
I mean no? a velocity is just a direction and intensity
you'd be excluding an arrow's dropoff and stuff
vector of the velocity
yes
im in a situation where the velocity is unchanging
the velocity physically cannot change
weird
i tried player.getLocation().add(vec).getBlock().getType().isSolid() but it doesnt work most of the time
Vector vel = ...;
Vector pos = ...;
for(int i = 0; i < max; i++) {
pos.add(vel);
// test pos
}
you might want to
Vector vel = ...;
Vector pos = ...;
for(int i = 0; i < max; i++) {
Vector old = pos.clone();
pos.add(vel);
// Iterate between "old" and "pos" and check each block
}
You might want to do 2nd in case the velocity is really high (>1 b/s)
the max velocity is 10
for the thing im doing
it only can set the vector if the player is within 10 blocks of the target
not in the times ive used it
hm?
most of the time it throws something like 1 block
THEN IT'S NOT CONSTANT
If you are applying this to a player it is not a constant velocity
that wasnt a related example
this is what currently happens
(ignore the particle stuff)
works like 50/50
omg obs is garbage never actually captures the audio
whatever
oh yeah also ignore my "generation plugin"
what's the current code
https://paste.md-5.net/uhemazozoh.java (inside of the runnable that constantly applies the vector)
try using entity
right after it is just entity.setVelocity(vec) if you wanted to know
right now it's only at the player's location
where
you might want to check the entity location
oh
if(player.getLocation().add(vec).getBlock().getType().isSolid()) {
I want to see it work now though
Wait how did you make the item countdown animation?
player#setCooldown
its for materials
Thank you
sucks with custom items though bc it makes a cooldown for everything that is of the same material as the item you want to have cooldown
Yeah. That's just the way Minecraft does it though. It's item type based
Can't put a cooldown on a specific stack
I can't understand of all the constructors in the AttributeModifiers class
I just need to add more some armor points to an itemstack
does somebody know how to nether world is called? i forgot
world_nether usually
Can always change though if a world is generated with, say, Multiverse
and the end?
An other short question,
I have an inventory, i inventory.add the items (from the start, to fill it up) and use inventory.setitem to fill the last item slot with instructions.
But the items i added with i.add don't show in the inventory.
Can't they be used together?
Is there way how to delay block breaking?
I just want to set custom drop after in onBlockDropEvent
Block break event cancel then uncancel after a delay? Prob sum like that
Otherwise just clear the drops and spawn an item entity
I need to get current drop and multiple that only in some case. So I cannot get drop from block in BlockBreakEvent. Thats the problem
I think unless something's changed most people cancel the event than delete the block manually than drop their item
Ye, I can do that. But I need to get current drop from block and then multiple that. I can´t get what is drop in BlockBreakeEvent
Im gona try cancel event and uncancel after delay
Hmmm not sure but this thread may be useful to you
Is not breaking that block
nevermind, I was using a material that was not support for an inventory item it seems.
Didn't raise any error
probably my most useless blog post ever, but every now and then, these questions arrive so... why not explain it once?
https://blog.jeff-media.com/javas-init-blocks/
Sadly that told me, I need made my own drop system xD Nice. I canceld the event and than after delay I use event.getBlock().breakNaturally(); but, in this case event
onBlockDrop is not called. I need onBlockDrop event to get current drop from block.
what are you trying to achieve?
if you want to get the drops of a block, you'll have a very bad time
otherwise my D2I plugin wouldnt be selling that well
Exactly what he's doing xD
I see
do actually know "what block break triggered what drops", you will want to keep some kind of "tracking system"
Im trying to achvie, multiple drop from block in some case.
e.g. "block X was broken now, let's check out what drops spawn in a similar location in the next... let's say, 20 ticks"
20 ticks might not even be enough for certain things, it's really very complicated
e.g. a huge "end tree" thing (i forgot the name) might need way more than 20 ticks
that is not possible unless you create your whole own logic
oh shit.. that will be pain... nwm, I will just let player brake the block and freeze him for some time, than BlockBrakeEvent will be called. xD This sound easier than your solutions.
Sounds like an awful solution
Sadly 😦 Why I cant get drops from block in BlockBrakeEvent thats stupid 😦
just a quick showcase on how D2I works
my or from mfnalex?
the DropOwnerManager keeps track of "who did something that MIGHT cause item spawns" (e.g. interact witha b lock or entity) and where was this? and those entries get removed after a certain amount of ticks, depending on what happened
i havent seen your solution yet but I'm pretty sure that you cannot get anything better than what I'm doing in D2I right now
I guess there should be some ezy way to doit... Looks like there is no way xD So I will just stop make BlockBrakeEvent cancel and let player brake a block to make BlockDropItemEvent be executed
there is none
I just try cancle evnent and uncancel after time. Result was not breaked block. So thats not a way
new BukkitRunnable() {
public void run() {
event.getBlock().breakNaturally();
frozenPlayer.remove(player);
cancel();
}
}.runTaskLater(Main.getPlugin(Main.class), 3*20);
}```
I have this
and what is that supposed to do?
Delay the block braking. I cancel the event and after 60 ticks I brake block naturally
But I need BlockDropItemEvent to be called, but there is not.
are you sure?
That's for dispensers and stuff prob
breakNaturally() definitely calls a BlockBreakEvent
I thought that it would also call the BlockDropItemEvent after BlockBreakEvent ran
unless you cancelled that, ofc
ughm wait
I need this BlockDropItemEvent not BlockBrakeEvent
I meant Block#breakBlock, NOT Block#breakNaturally
I know
you have to keep track of that yourself
you will have to listen to ALL block breaking events, then keep those blocks in a list or set or any other collection
then listen to the BlockDropItemEvent too, and check whether your list contains it
since this stuff always happens in the same tick, you can link it via location
thats sound like painful solution, fml
it is painful
Thus the state of life
there really is no other way
What do you guys use for databases in your plugins? I was considering trying to use SpringBoot and make use of DI too but it's such a pain in the ass to setup inside a spigot plugin and was probably a terrible idea anyway. Any lightweight frameworks to look at?
what MC version?
I use the PDC for everything where it's possible
I don't see any reason to use mysql / mongodb / similar unless you wanna store huge amounts of data
wdym "how to get nms"?
do you use maven?
btw. I kinda solved that think. I just dont delay block brake. I just freez player for that time. Is enough for me. I just did like this frozenPlayer.add(player); new BukkitRunnable() { public void run() { frozenPlayer.remove(player); cancel(); } }.runTaskLater(Main.getPlugin(Main.class), 3*20);
Ah nice yeah I totally forgot that was a thing, thanks
np
oh okay. well I can only tell you how to do it in maven: https://blog.jeff-media.com/nms-use-mojang-mappings-for-your-spigot-plugins/
no idea how it works in gradle, probably sth way more complicated lol
i think theres a mod for it
does anyone know how hypixel did their random dungeon generator
judging that none of work for hypixel (iirc) i dont think anyone will
how technically competent are you
i was just wondering if anyone knew an algorithm
not exactly hypixels just any random dungeon algorithm
look into maze generation algorithms
alright
once you have a shape of a maze you can scale it up and use larger cell sizes
i just dont want big rooms to bleed in eachother
replacing cells with prebuilt structures
like overlap and destroy
or completely block off a path entirely
just calculate the bounds and ensure it doesnt
if all rooms are the same size or a multiple of the same size, it will be easy
yeah you could
would a treemap be the best way to sort doubles and get the "owner" aka player?
but entrances/exits would have to be in the same spot
is there only one double associated with the player?
Someone have docs of PacketPlayInSteerVehicle for 1.19.2
is there a way to sort the value instead of the key in a treemap
I mean a guide how to use it, because it is completely diffrent with 1.12.2 and i now need a 1.19.2 one
if you want support for nms, use moj mappings
or would i have to switch them
switching them wouldnt work
you could just use a stream on a regular map
if its just for players it wont be inefficient
I mean, under mojang mappings its called ServerboundPlayerInputPacket
and has ```java
private final float xxa;
private final float zza;
private final boolean isJumping;
private final boolean isShiftKeyDown;
these fields
Oowh thanks i will take a look at that! :D
how would i do this?
either a VAlueComparator or entryset stream
Map<UUID, Double> sorted = testing.entrySet().stream().sorted(Comparator.comparingDouble());```?
plus some other things
something like that idk
i'll test this
Map<UUID, Double> sorted = testing.entrySet().stream().sorted(Map.Entry.comparingByValue()).collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue, (value1, value2) -> value1, LinkedHashMap::new));``` may work
awesome it works
how would i reverse this?
i got this but there's an error and i'm not 100% sure what to put there then
Map<UUID, Double> sorted = testing.entrySet().stream().sorted(Collections.reverseOrder().thenComparingDouble(Map.Entry::getValue)).collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue, (value1, value2) -> value1, LinkedHashMap::new));```
?paste
that's the line no need
its for something im about to post
Error
https://paste.md-5.net/yuwohuvepo.sql
KingdomsConfig.java
https://paste.md-5.net/vabofuwije.cpp
Kingdoms.java
https://paste.md-5.net/rigonaruke.java
Guide to dependency injection: https://www.spigotmc.org/wiki/using-dependency-injection/
is it possible to do this.kc = new KingdomsConfig(); or does it have to have KingdomsConfig(this);?
https://paste.md-5.net/jabekiqepu.java
The code is not doing anything.
For my clearchat command
"Does not working" is a useless statement. Please describe what exactly is not working, what you expect it to do, and what actually happens. If you get any console errors, also ?paste the entire stacktrace.
is your command registered?
I dont want my console to receive the spam
ik
That as well
^
what would i put there?
instead of Map.Entry::getValue
Is Hetzner Cloud just their name for VPSs?
Why does it say chat cleared by ethangarey 4 times?
[19:58:42 INFO]: Chat cleared by EthanGarey2
[19:58:42 INFO]: Chat cleared by EthanGarey2
[19:58:42 INFO]: Chat cleared by EthanGarey2
[19:58:42 INFO]: Chat cleared by EthanGarey2
So its something that I can ssh into?
okay thanks. I was a little confused why their prices are so low, but I see that they aren’t dedicated. still probably worth a try though.
like this?
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.
its because you are looping every player then sending the message to console
put that after the loop
^
or just broadcast it after
instead of getting the console instance
this works perfectly fine
fax
You don't need to instanceof check the Player so you can call getName(), because CommandSender has getName() anyways
bro look at this code
ooo
🙂
Looks fine to me
looks cringe
is console sender a catagory of broadcast message?
Can just avoid the instanceof entirely because sender.getName() works fine in both cases
this looks normal
yes
now
alr ill remove the 2nd line
just do this
String executor = sender instanceof Player ? ((Player) sender).getName() : "Console";
ez
remove consoleSender sendmessage
add this @wary topaz
bro what
then replace player.getName() to executor
What I would honestly do is save your users some bandwidth. Instead of sending a player 100 chat packets, you can send one chat packet with 100 newlines.
String message = "\n".repeat(100) + "Chat was cleared by " + sender.getName();
Bukkit.getPlayers().forEach(player -> player.sendMessage(message));```
Your whole command just becomes that. That's it. You can optionally send a message to console as well
choco
Unless newlines have changed in modern Minecraft but I believe they still work
I have no clue what your goal is with that map
Reverse what? Reversing something before you sort is a little redundant, no? Because it gets sorted after anyways?
okay i was doing Map.Entry.comparingByValue()
but i need to reverse it before comparing by the value
aka this Collections.reverseOrder().thenComparingDouble(Map.Entry::getValue)
but
wtf is this
a scam?
this works perfectly fine
but i need to reverse it
so the highest number is first
public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
String message = "\n".repeat(100) + "Chat was cleared by " + sender instanceof Player player? player.getName() : "Console";
Bukkit.getOnlinePlayers().forEach(p -> p.sendMessage(message));
}```
No idea what that is. Anything that asks for money up front is a scam
🤔 Hetzer is well trusted, I just think its dumb.
well hetzner is kinda famous tho
bro
I don’t want to give them $20 upfront…
public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
String message = "Chat was cleared by " + sender instanceof Player player? player.getName() : "Console";
Bukkit.getOnlinePlayers().forEach(p -> {
IntStream.range(0, 32).forEach(p.sendMessage(" "));
p.sendMessage(message);
});
}```
the \n didnt work
^
A little ugly, Fire, but
Map<UUID, Double> sorted = testing.entrySet().stream()
.sorted(Comparator.<Map.Entry<UUID, Double>>comparingDouble(Map.Entry::getValue).reversed())
.collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue, (value1, value2) -> value1, LinkedHashMap::new));```
Will they refund the $20?
Things may have changed in modern versions then
new version @wary topaz
It used to work way back in the day ;p
Inconvertible types; cannot cast 'java.lang.String' to 'org.bukkit.entity.Player'
Spoonfeed a newbie for a day and they'll come back with more questions. Teach them to find their own answers and you'll both be better off: you won't get stuck answering the easy questions and they'll be much more productive than before.
ty!
@fluid river
bet
where
oh i see
add ()
String message = "Chat was cleared by " + (sender instanceof Player player? player.getName() : "Console");
sender.getName() returns "Console" for the console command sender
The ternary is redundant
is that ternary even needed? doesn't sender#getName() return "Console" assuming it's from the console
'forEach(java.util.function.IntConsumer)' in 'java.util.stream.IntStream' cannot be applied to '(void)'
i juast asked
I guess if you really care then yeah, you can ternary it I guess lol
IntStream.range(0, 32).forEach(i -> p.sendMessage(" "));
tho the cringest solution
bet ty\
just shorter than for
yeah ikr
.
The final solution, any suggestions before I close up?
i guess that's the shortest thing possible
gaymode kotlin
doesn't work
we tested
who knows
also my console is not giving me errors when I get a error in chat (ingame), anyone know a reason why?
sounds kinda common here
ye
idk
check if you didn't disable debug mode with flag
and if it's enabled in spigot.yml
okie
since when errors are components with HoverEvent tho
it is a spigot thing 
maybe paper doesn't want to print errors anymore
obviously it is
debug is disabled
final var clearingComponent = Component.text().append(Collections.nCopies(32, Component.newline())).build();
Bukkit.getOnlinePlayers().forEach(p -> p.sendMessage(clearingComponent));
works as expected
Maybe choco knows

enable
it wasn't hoverable before
i'm sure
just a line of text
and the actual error was in console
Ma errors are back!
@eternal night
tysm
ez
i guess you talked to EthanGarey...
+optimize
okay ginga and
yes
+optimize
my hands finally came to changing code formatting in eclipse
one line if ❤️
How do I run some sync code once some async code has been executed?
scheduler
doesn't answer my question
yes it does
?scheduling
There
ty
CompleteableFuture
Thread#join
[20:59:26 INFO]: [STDOUT] [org.spigotmc.RestartCommand] Startup script './start.bat' does not exist! Stopping server.
[20:59:26 INFO]: Stopping server
...
ok
"./start.bat" isn't a file name
idk what to say it says it there
It is ;-;
yes!
so to start your server you run ././start.bat xD
exactly ./start.bat isn't the file naem
wdym?
there's a setItemStack method try that
Is there a way every time my plugin loads in it changes the config to add a 1 to the version?
yes, but why?
Whats the method?
getConfig().set("version", getConfig().getInt("vesion") +1);
teh plugin version is in the plugin.yml. a config version is just a value, increment it easily
ty 😉
he probably wants to know how many bad configs he need
to make something above shit level
🙂
🙂
:))))
guys Metro 2003 books is 10 times better than the game
the only sad thing is main character uses his weapon like 4 times
suggest reading
2034 cringe
2035 scary
How can I get the version and not set it?
basically do that when work on my test server
To display in console
getConfig().getInt("vesion")
getConfig().set("version", getConfig().getInt("vesion") +1);
ty
?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.
?jd-s
Spoonfeed a newbie for a day and they'll come back with more questions. Teach them to find their own answers and you'll both be better off: you won't get stuck answering the easy questions and they'll be much more productive than before.
) in wrong place
this is what my config looks like
config or plugin.yml?
config
odd config
why do you need author and version in config
thats info for the plugin.yml
you can do in plugin.yml
and then in main class
Oh I can?
plugin.yml is specifically for all that info
ill do that after this 🙂
delete line 2
package names are all lower case
line 3 IS your version
you change it in your pom
How do I change it automatically?
Your pom.xml shoudl be set to filter resources, It replaces the ${...} entries
ooo
So how can I access the pom for main?
what?
How can I get a integer like ver, to give me the project (plugin)'s version
the version is in pom.xml
you update your pom.xml version when you want to increment it
If you want it to auto increment you will need to use a CI system like Jenkins.
I don;t know of a maven way to do it
Looks like you can but it will be WAY beyond you. You need to learn Maven workflow and the Maven releases plugin
was trying to find the link
Any idea why this only gives me Pig Spawners:
public static ItemStack CreateSpawner(EntityType type) {
ItemStack item = new ItemStack(Material.SPAWNER);
BlockStateMeta meta = (BlockStateMeta) item.getItemMeta();
((CreatureSpawner) meta.getBlockState()).setSpawnedType(type);
item.setItemMeta(meta);
return item;
}
Lot of the old threads were talking about old essentials things, but apparently EssentialsX fixes that? Please ping on reply, as I'm going to bed for the day, thanks for suggestions.
?jd-s
u probably need to store getBlockState to a local var, call setSpawnedType on that, and then call meta.setBlockState
bukkit api loves working with copies of objects instead of the original (and probably some product of how craftbukkit hooks into mc)
a blessing and (sometimes) a headache at the same time
is it expensive to perform getConfig() in a Runnable run()?
the runnable class is scheduled as a sync repeating task
if yoru config is going to change so often that you need to check it every tick of a runnable you should not be using the config
config will not change at all per server instance, but I am running this runnable per tick and using getConfig() to retrieve values to use inside run()
how about that?
reading the config is not expensive though
when instantiating the runnable class and scheduling it, pass the config values as variables for the scope of the entire class to use inside run?
or keep it the way it is
i have seen it done with github actions
Github actions are very useful
How do I get the object "HeartRecipe"?
config#getConfigurationSection("path")
ConfigurationSection section = config.getConfigurationSection("HeartRecipe")
awful to write, gotta practice it
thanks
How do I get an itemstack of a player's head?
https://hub.spigotmc.org/javadocs/spigot/org/bukkit/block/Skull.html#setOwnerProfile(org.bukkit.profile.PlayerProfile) by using this
declaration: package: org.bukkit.block, interface: Skull
I don't understand
well do you know how to create a normal itemstack?
yes
well you use ItemMeta there
you can cast that to SkullMeta
i actually sent you the wrong link
declaration: package: org.bukkit.inventory.meta, interface: SkullMeta
this is the correct one
Hi all! I can not understand why the action bar is not displayed in the onJoin event(all code below)
package stam.stamina;
import org.bukkit.GameMode;
import org.bukkit.configuration.file.FileConfiguration;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.entity.EntityToggleSwimEvent;
import org.bukkit.event.player.PlayerJoinEvent;
import org.bukkit.event.player.PlayerToggleFlightEvent;
import org.bukkit.event.player.PlayerToggleSprintEvent;
import org.bukkit.plugin.java.JavaPlugin;
public class Stamina extends JavaPlugin implements Listener {
public static Stamina plugin;
FileConfiguration config = this.getConfig();
int stam;
int wasterun = config.getInt("waste-of-stamina-run");
int wasteswim = config.getInt("waste-of-stamina-swim");
int wastefly = config.getInt("waste-of-stamina-fly");
int efslow = config.getInt("when-effect-slow");
int regen = config.getInt("regen-of-stamina");
int maxstam = config.getInt("max-stamina");
int sum;
@Override
public void onEnable() {
plugin = this;
this.getConfig().options().copyDefaults(true);
this.saveDefaultConfig();
}
public void EfSlow(Player p){
if (stam <= efslow) {
p.setWalkSpeed(0.1f);
p.setFlySpeed(0.05f);
} else {
p.setWalkSpeed(0.2f);
p.setFlySpeed(0.1f);
}
}
@EventHandler
public void onJoin(PlayerJoinEvent e) {
Player p = (Player) e;
stam = maxstam;
p.sendActionBar("Stamina: " + sum + " / " + maxstam);
}
@EventHandler
public void onRun(PlayerToggleSprintEvent e) {
Player p = (Player) e;
if (p.isSprinting() && !p.getGameMode().equals(GameMode.CREATIVE) && !p.getGameMode().equals(GameMode.SPECTATOR)){
sum = maxstam - wasterun;
}
}
@EventHandler
public void onSwim(EntityToggleSwimEvent e) {
Player p = (Player) e;
if (p.isSwimming() && !p.getGameMode().equals(GameMode.CREATIVE) && !p.getGameMode().equals(GameMode.SPECTATOR)) {
sum = maxstam - wasteswim;
}
}
@EventHandler
public void onFly(PlayerToggleFlightEvent e) {
Player p = (Player) e;
if (p.isFlying() && !p.getGameMode().equals(GameMode.CREATIVE) && !p.getGameMode().equals(GameMode.SPECTATOR)) {
sum = maxstam - wastefly;
}
}
@Override
public void onDisable() {
}
}
is player#sendActionBar even a spigot method i cant find it anywhere on the spigot jds
how do i save the config after server closes?
also on your onFly method the if statement will never pass and player isnt e on the evens, p is e.getPlayer()
save config on disable is your best bet probably
p.spigot().sendMessage(ChatMessageType.ACTION_BAR, new TextComponent(* Message goes here*));
thought it would be that
yes but how do i do it? ive never worked with config
i always used presistant data
config.saveConfig()
oh
does it need to be posted everywhere? If so, then there is an error in the onSwim event
wdym, im pointing out that the line Player p = (Player) e; will never work to do anything to the player. e is the event and not the player if you want to get played from the event it should be Player p = e.getPlayer();
I'm talking about it
oh wait thats an entity toggle swim its probably e.getEntity().getPlayer()
🤷
the if statement wont work either it checks for creative and spectator at the same time
if (p.isSwimming() && !p.getGameMode().equals(GameMode.CREATIVE) &&/*here should be ||*/ !p.getGameMode().equals(GameMode.SPECTATOR)) {
sum = maxstam - wasteswim;
}
== on enums remember
that too
my database lib seems to look more and more like gson with typeadapters lol
lol
where need check instanceof and cast it?
if (e.getEntity() instanceof Player) { Player player = (Player) e.getEntity() }
might aswell learn java
I wrote exactly the same lmao.
pretty much every event is casting event to player
if the event has Player in the name Player p should be Player p = e.getPlayer()
just see if it extends PlayerEvent
then get lost ig
this doesnt look too good
gives me flashbacks to gson and that atleast uses reflections
dont look at my method names tho
dunno what i was doing yesterday
might aswell do this
i was thinking about that
im trying to implement queries as simple as possible
with like connector.pushQuery(Query.insert(Table.PLAYERS, dummyPlayer)) and where DummyPlayer.class is mapped to a context resolver
ill probably start with a builder pattern for creating tables
copilot doing all the work for me smh
still not released
1.19.2
wdym not released?
I am making a plugin for stamina and I need it to be displayed by the actionbar, but it is not displayed
check if your event is regirstered
copilot is great
sometimes
always, has been
this stuff looks cursed tho
when its not giving me shit code
Imagine making an account with shit code to troll copilot
dont make it cry
brr
Sheesh what's this
I am trying to spawn SCULK_CHARGE particles. The console returns an error that these particles need data. Does anyone know how I can create suitable data for the particles?
declaration: package: org.bukkit, interface: World
Yes well with the vibration particles it says what I need, with SculkCharge not :/
Hello everyone again! I have a question is there an event for the player to just stand and is there an event for the player to just walk
theres a PlayerMoveEvent for a player that is moving
and if the player is just standing?
theres no event for that
so what should i do then i just need to know when the player is not moving
and how to type what if the player moves
is it for everything or just for the case if the player is standing?
if the event.getFrom().getX() != event.getTo().getX() you know that the player moved
might want to do that for x and y too
dunno if theres a better way
you dont even need an extra account for that
I'm not gonna give them my actual code tho
as if your code were so special
they dont save it anyways
(if its not public on github)
LMAO
seen that before in my code
well fuck indeed
at the moment I ignore any error and break user experience because just get gud and relog
bruh this will create a new file for each log
for each day
depends
on what date format
youre using
but this is inefficient anyways
just open an input stream
i do further below
this will rewrite the file every time smth is logged
anyways, it just creates a new file if there isnt already one for the day
if you recreate the input strean
and even then only if there is something to log
stream
inefficient for fast logging
basically
it doesnt
but this is slow as fuck anyways just open it at creation
just use a fileoutputstream and append to the already existing file content
How Do i add https://github.com/mcMMO-Dev/mcMMO/blob/master/src/main/java/com/gmail/nossr50/api/ExperienceAPI.java to my project? since it doesn't have a maven repo from what i can see, do I need to import it as a jar?
you would need to read the file and then write it back + the message
right
also id do the IO async
nope. for that, already mentioned, you have the fileoutputstream where you can just append your stuff at the end of the file
it probably does it anyway somewhere, but thats native shit
it is
i could just use a regular logger and give it a handler but who needs that shit
use my logging api yes
nah
website is down, join their discord prob
i would rather use log4shit
Ah thanks ill go check out there
its faster than sysout
idk but its better than it taking miliseconds
because you might log quite often
how can i hide commands from players?
permissions
Cuz you don't load it?
.
Why rzloading qfter saving
Weird
Please dont abuse static
I dont know why people is obssess with static
Oh nothing
that worked
I messed up because he is not using the proper name conversions
Variables are always lower case
If the var contains 2 text like game mode should be named as gameMode
I mean its pretty important to follow then because then people dont understand your code
Im your case it should be named as:
config = new Config(this);
bc it's easy
constants
i have static arraylists
what?
you like memory leaks?
I know there's better ways to do that I'm just lazy
my favorite, actually
what i'm doing wrong?
make a manager object
i just store it in memory
basically a list abstraction
So much effort
Static has reasons to be actively used
Basically methods or fields that belong to the type, not to the instance
anyway to check for the moon state?
Well but then whats the point lol
something like this
for example
ignore my shitty if braces, still working on standardizing that
Then I usually make a getter on the main
and pass my main object around
but ideally you pass your manager objects whenever needed
instead of passing the entire main
do that hold infomation in memory?
Yeah
It's the proper way to do it, each class has its own purpose (data object, managing data, using data, gathering data)
It's like a database, you ask the DBMS system for the data, you mess for it and you push back
Except the DBMS saves to disk, while your system just stores it in memory
why the underscores 
It's not standard naming conventions
what is better?
yeah nothing is loading in iran
thats why im asking here
?
Uh sec
👍
Storage can be RAM, a database, cache etc
The objective of the data manager is to provide a consistent layer of abstraction for handling the raw data
use _ for constants or number values
If you read the disk or managed all the objects in the project, on every class, it'd be hell
maybe even for primitive namings
Java uses lower camel case
So Games -> games
Game_Number -> gameNumber
etc
Constant (static final) -> LIKE_THIS
Classes: LikeThis
fields and methods: likeThis
yes that ^
Just like databases, you either pick singular or plural and stick to it
Underscore should only really be used in enums and constants
Plugin main classes should be named as either ProjectName or ProjectNamePlugin
enums are constants
mhm
saving data is differently better then 1000s of elements in memory XD
Who appends Plugin to their main class name wot
Sure they have their own constructor but they behave like constant objects
It is up to the data manager to handle that
or have a StorageHandler class for that
I do
ZombiesPlugin, UniversityPlugin etc
It helps
I like that Class Idea
Yeah I guess if your project name is boring like that it makes sense
What if University is a data class while UniversityPlugin is my main
Especially if your plugin name is a generic noun appending Plugin avoids confusion
EatAnythingPlugin etc
Still useful to know it's the plugin class
and I have a module system (sub-plugins type deal), which end in Module too
CanvasModule, SchoolModule, SkinModule
it's consistent
I can understand doing it if your plugin name is a generic noun, but tbh at that point your project name kinda sucks and you should be more creative 😛
I'm literally building a minecraft university wtf do you expect
MinecraftUniversity? Idk 
takeABreak();
University is just weird to me for that to be the project name
I guess it's preference then
If I'm writing a fuckin zombies minigame imma call the project Zombies
changeOfFallingAsleepInClass();
ZSurvival?
Zgame
God no
ew
🤣
watch me remember about ZSurvival in 6 years
cursed
true
.
I believe I lack knowledge of the real fundentals of java and system
I learned by doing and watch cheap tutorials
i mean what i do works.. i guess
not sure what resources i need?
^
getAttribute(Attribute.GENERIC_MOVEMENT_SPEED).setBaseValue(3.0D);
Actually I just need to add some armor points to an itemstack
do you mean like this?
yes
Like +4 Armor Defense
of course just needed to figure out what you meant
good afternoon, comrades

Actually it's a bit strange the constructor of the AttributeModifiers class
@fluid river #general
you too
what is in general
So basically it works with AttributeModifiers as far as I gotcha
declaration: package: org.bukkit.inventory.meta, interface: ItemMeta
My question is over the changhing of the attributes
FREE JAVA LESSONS
checkmybio
addAttributeModifier()
removeAttributeModifier()
done
if you learn how to read
That didn't help
you read it
wdym
you can't remove the attribute itself
only modify
That's not my question
ask full question then
Okay Imma change it
So basically I can't change the actual attribute in the multimap
The method takes a multimap as parameter xd

