#help-development
1 messages · Page 1669 of 1
k
how are you today geol
hi is there a way to take a string and do like ItemStack.matchItemStack or something
like with Material
dude
you mean .equals?
new ItemStack(Material.matchMaterial(urmaterial)); if i understood u correctly
but if u want to clone an itemstack just do .clone()
.clone() works for all objects iirc
no it doesn’t
it has to implement Cloneable
Um.... I'll just make an extra string in my config to know the durability I guess.... just wanted to know if its possible without
do you mean serialise?
it is cloneable
just use clone() worst case is that it will copy the item uuid
new ItemStack(itemstack) works too
It’s actually possible to call clone() on every object however it’s by default protected (from Object) and throws an exception unless overridden.
It's safe to use on itemstacks however?
^^^
i think you are talking about saving itemstacks to file?
?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.
don't bother
Not ItemStacks at least
huh?
I have a config file with keys = ItemStack and Value = cooldown time of the item
i told him that, and he told me to frick off lol
they’ll just block u
lmao wat
Itemstacks are items though?
this is floofsy
and would be cool to directly take the key and get the itemStack with Material + durability
when you use them in minecraft they do have a uniqueid?
yeah im pretty sure it does have a unique id
Thing is, player1 has the value of null which essentially means you cannot call any method on that variable.
otherwise all items would stack
wdym
i mean you can serialise it to keep enchantments and stuff and all data
but when they have unique ids (like different player heads) they can not stack
No that’s not how it works
Well you could consider an ItemStack instances memory address as a unique id Ig
that means every class instance has a unique id?? LUL
But no it’s just minecraft Container implementation that ensures they don’t stack unless wanted, kinda why they’re called ItemStack
can someone pls help
No thank you
yes however it’s rarely taken advantage of because of reasons
sure
no one asked you
your var is null
"can someone pls help" "no one asked you"
why
this is killing me
because it is
you're not apart of someone or anyone
2Hex just ignore him if you’re not willing to help
look
quit helping
because you haven’t assigned it a value
i have tho
its like trying to write a difficult essay
no
retrooper please, shut the hell up.
without knowing english properly
I helped him, he tells people rudely to not help, then asks for help again
this is annoying
even more annoying than me
this man speaks facts
no, you're still more annoying
Don’t have to go around being a dick back to him then, it’s simple, you could block him and not care
kidding ily 2hex
how can you write and understand the essay you are writing without understanding the english language
life would be so much easier for you if you learned java in peace first
take your time
i realized this after 1 month of suffering
so no one's gonna help because yall are too toxic to?
so better realize it now
wtf
can ya read?
we will help
who said that lmao
not talking to you olije, you're ok
thing is, if you notice everyone is giving you the same answer.
why don't you accept that answer
^
^
people don't want to help people that don't even know java
you're asking a community of developers
no you're giving me a very short explination on why it's not working
not how to fix it, what to do with it, or a better explination
no youre mad that thr answer youre getting isnt one that you like
you will know why its not working if you know java
but it is the only answer
It's not working because you're getting a player that returns null
how to fix: learn java
ok if you're toxic, please fuck off
and once you learn java, you won't have to ask many questions in here anymore
and won't constantly need help for small problems
I see
mute me lmao idc anymore
ok everyone here is toxic
so we're helping you in the long run
if you show us more code it will be easier
no one is toxic, we are telling you to learn java.
LMFAO
olije i spent a lot of time on this, i don't want it to be stolen (make fun, go ahead)
"I like my code nto stolen"
IM SO FUCKIGN DONE
WHO THE FUCK WILL STEAL YOUR SPAGHETTI?
we don't have time to steal your hello world plugin my friend
you can decompile any plugin
we are busy with our own lives
....
fair enough
bro
and who cares if its stolen
?kick @grim ice disrespectful
Done. That felt good.
lol
lmao
ok if your name is prouddesk / 2hexx / retrooper please block me
Can we all just be civilized here
lmfao
don't bother asking if you don't accept help
doubt that's gonna happen on this spesific discord server
Buenny Help Chat
i can try but i'm easily triggered
bad
spigotmc is a very patient community
"patient"
I mean yeah sorry for screaming
We can't properly help without seeing actual code. For all we know the error is completely different than what little you do show
i gave everything related to the problem
While you'd think it's enough, it's not.
In the given context it should be correct, however for all we know something could be changed where it shouldn't be or called in the wrong place or whatever
he is afraid of people stealing his code
he wont show it
im pretty sure no one will steal t
no one wants to
any plugin can be decompiled..
^
exepct i'm not sharing this with anyone but close friends
Honestly, if they're releasing it publicly, if it's interesting enough the code will be stolen anyways. If it's for a public server, the feature can just be replicated relatively easily
and thing is no one will steal it
any plugin can be decompiled + not being toxic, but anyone with knowledge about java can do what you are trying to do because you don't have a lot of knowledge.
that was my point, but you delivered it better
That is true, even more so since it's just a gamerules plugin tbh.
It's pretty easy to re-create most likely
there is always someone who can make your work 3x better, so caring if someone steals it is dumb
and most people here can
no offense
if you want that, you'll need to share more code
Meh, bad code sometimes is worth it (see intelliJ decompiler)
^
^
Well, we can, but we would do it wrongly
someone's being nice and being helpful in a thread so no thanks
poor guy
@lean gull they were talking behind your back yesterday, including oli :P
"nice" isn't the best way to describe that
oh no!
just informed you 
who cares even
no one tbh
but i find it pathetic to talk behind people's back, and it' forbidden in my religion either way 
😀
are you talking about when someone said you and buenni are bad at coding
or somethingg
not that specific one
but it was in an offensive way
oh
I don't mind that if you're trying to help someone progress, but if it's in an offensive way like it was, then you're pathetic
Guys just stop
sure, but it's just simple manners, isn't it?
Do it elsewhere
they sure did lmao, they joined our thread and now they're bullying me there
k they left it
?kick @grim ice last kick, stop being such a dick
Done. That felt good.
but u didn't even join to see if it's true
I can read without joining
oh ok
True i guess
hi
how do I connect the vault economy?
I did everything as it is written on the vault page and I have an error
How can I make a rejoin system like in Hypixel for Bungee?
what rejoin system do they have?
If you leave the server while you are in a bw game, and you join the server back you will be automatically teleported to that server
What error?
sec
import net.milkbowl.vault.economy.Economy;
public class EconomyManager {
public static Economy eco = null;
public static void setupEconomy() {
RegisteredServiceProvider<Economy> rsp = Bukkit.getServicesManager().getRegistration(Economy.class);
if (rsp != null) eco = rsp.getProvider();
}
}
@Override
public void onEnable() {
instance = this;
File config = new File(getDataFolder() + File.separator + "config.yml");
if (!config.exists()) {
getConfig().options().copyDefaults(true);
saveDefaultConfig();
EconomyManager.setupEconomy();
That means that or rsp or eco is null
how can this be fixed?
What is the package name you are coding under?
package experiencebuble;
Ok, I can't recogzine this line: at experiencebuble.GUI.onInventoryClick(GUI.java:96) ~[?:?] from the error
what's wrong with that?
And you better name your packages like me.<name>.<plugin>
double s = EconomyManager.eco.getBalance(p);
if(s > 100.0) {
p.sendMessage("бабок нема");
return;
Refers to org.bukkit.event.EventException: null
I think as mentioned eco is null
Are you able for a screen share?
@EventHandler
public void onInventoryClick(InventoryClickEvent e) {
p = (Player) e.getWhoClicked();
c = e.getClickedInventory();
Inventory i = e.getInventory();
if (!i.equals(GUI.i))
return;
if (c == null)
return;
if (c.equals(i)) {
e.setCancelled(true);
if (i.equals(c) && e.getSlot() == 10) {
if (e.getCurrentItem().getType() == Material.BARRIER)
return;
int exp = p.getTotalExperience();
if (exp < 1395) {
p.sendMessage("§c§lasdasd");
sound();
return;
}
double s = EconomyManager.eco.getBalance(p);
if(s > 100.0) {
p.sendMessage("no money");
return;
}
p.sendMessage("ф");
}
}
}
?paste pls
That is even better
Ok and the reference to setupEconomy() is in your main?
Ok let me look
I have collected your code, is this correct? https://paste.md-5.net/hakumeliva.java
yes
Ok please do the following:
public static void setupEconomy() {
RegisteredServiceProvider<Economy> rsp = Bukkit.getServicesManager().getRegistration(Economy.class);
if (rsp != null) eco = rsp.getProvider();
}
Change it to
public static void setupEconomy() {
RegisteredServiceProvider<Economy> rsp = Bukkit.getServicesManager().getRegistration(Economy.class);
System.out.println(rsp);
if (rsp != null)
{
eco = rsp.getProvider();
System.out.println(eco);
}
}
Run it, and show the console output
do you even have a economy providing plugin?
in addition to vault you need a plugin like essentials to provide the economy
Ok, but I want to know the full console output
Yes that is exactly
Vault only manages it
he stands
Plugins (6): Essentials, ExperienceBuble, ItemJoin, PlaceholderAPI, ProtocolLib, Vault
Ok very good
But still waiting for the console output
Can you send me the log since you have applied my debug code?
I want to know what it has printed
Also startup pls
Ok, but the most important part for me now is the part where your plugin got enabled
What is the plugin name? Experiencebottle?
yes
Ok it did not print anything
Then I am going to change the code of your main a little bit, and need to know the output
vault - 1.7.3
How is the code looking in your EconomyManager?
https://paste.md-5.net/awesigowut.java The code sided to the left side is applied
Make sure it looks like this, apply the code of your main, reboot and show the startup
.
Ok look message above
everything works fine, but an error appears after these lines:
double s = EconomyManager.eco.getBalance(p);
if(s > 100.0) {
p.sendMessage("бабок нема");
return;
}
Yes, I am currently finding out what it causes, and the way back to this is your startup (where the process begins)
Because in your startup you are setting the field eco
how should i design my project?
design?
like how should i start a project
how can this be fixed?
You can create a package me.name.plugin
lol
Let me help him quickly
okay
The create a class <Plugin> and extends JavaPlugin
If you did so create a new package commands and listeners
I need to leave now, I'll be on the phone, ok?
Ok
Ok then I think you have to ask someone else, I am not very familar with this
Any further, I will try you to explain it so you can fix it
Okay
The problem is on a line where you are referencing the static field eco in EconomyManager. This field is null as shown in the error. You have to find out why it is null. In onEnable you are setting the field with a method in EconomyManager (setupEconomy()).
The following things could be wrong: (We simply don't know what of there is the problem)
if (!config.exists())(onEnable) turns out to befalseand does not get calledif (rsp != null)(setupEconomy()) turns also out to befalseand does not get called (ifrspisnulljust throw an error)eco = rsp.getProvider();(setupEconomy()) could returnnulland you are not checking that
How to check:
You can always try printing conditions with System.out.println(Charset)
For example: System.out.println(rsp != null) (either true or false) or System.out.println(rsp) (null or <ClassName>)
So got in small problem making enchant plugin and trying to make pick axe to brake sphear shapes
@quaint mantle clear?
What is the problem?
but can't make it to work with proper radius numbers
Ok so if you level up the radius is not correct?
calculating proper sphear xd
Use the javadocs, getCause is not the name of the method
Ok good
like if you go for whole number 1 2 3
I can 't use them like proper modifier
I need to play with decimals
Pls dont suppress deprecations. If something is deprecated then there is a better way already implemented.
I will show code it is stupid I know
Circles are very difficult
but best I could come with some tutorial
Since spigot hat all the vector rotations implemented, circles have been quite simple. Ill write an example,
thanks
I'm not home
Ok just save it if you are and tell me if you find the cause or not
You can always ping
But if I'm not online, I am sleeping
that is code which I got
xd
Haha
If you can do that, would be nice
I will continue my work now, helped already over 40 minutes 😄
go kick it 🙂
@EventHandler
public void onJoin(final PlayerJoinEvent event) {
this.drawSimpleXZCircle(event.getPlayer().getLocation(), 0.1, 10, Material.STONE);
}
private void drawSimpleXZCircle(Location middle, final double deltaPhi, final double length, final Material material) {
middle = middle.getBlock().getLocation().add(0.5, 0.5, 0.5);
final Vector cursor = new Vector(length, 0, 0);
for (int i = 0; i < (2 * Math.PI) / deltaPhi; i++) {
middle.clone().add(cursor).getBlock().setType(material);
cursor.rotateAroundY(deltaPhi);
}
}
This is a super simple approach and has some flaws.
- Calculating deltaPhi can be tricky. If you jsut chose something small then
you will hit blocks multiple times. - Its hard to fine tune it with double lengths.
ok thanks I will give it a shot
Ive experiemented a bit with an integer bound approach:
@EventHandler
public void onJoin(final PlayerJoinEvent event) {
this.circleXZ(event.getPlayer().getLocation(), Material.STONE, 12);
}
public void circleXZ(final Location loc, final Material mat, final int radius) {
final int cx = loc.getBlockX();
final int cy = loc.getBlockY();
final int cz = loc.getBlockZ();
final World world = loc.getWorld();
final int rSquared = radius * radius;
for (int x = cx - radius; x <= cx + radius; x++) {
for (int z = cz - radius; z <= cz + radius; z++) {
if ((cx - x) * (cx - x) + (cz - z) * (cz - z) <= rSquared) {
world.getBlockAt(x, cy, z).setType(mat);
}
}
}
}
I think a dimension was lost along the way in this conversation
Oh did he want spheres?
Maybe there is an environment agnostic voxel library for shapes.
I mean this can be change to sphear easy with one more loop
So Im trying to make my Custom enchant to work in the enchanter but it doesn't seem to want to put the name of the enchant
You can't display the name there
you can't make it work there, however you can listen for enchanting item event
and check for the exp lost
depending on that add a chance for the item to get ur enchant
u might want to add some extra checks if ur enchant conflicts with other enchants though
Here's a youtube video that will guide you:
https://www.youtube.com/watch?v=EVDUIivW7MQ
In this episode, I show you how to make custom enchantments in Spigot 1.14. There are a lot of different steps involved, so you need to pay attention closely. I demonstrate how to make two separate enchants, the glow enchant and the hemorrhage enchant.You will find no other resource that can help you do this, so a lot of hard work was put into ...
it might be long but it's useful,
Custom enchantments can only occur as secondary enchantments.
or use hypixel skyblock way, make your own custom enchanting table
HotSwapping
what is hot swapping
it lets you change minor code without building your plugin
and directly switches the classes out
while running
How do i kill a player after entity dismount after 30 seconds?
any help would be appreciated
?scheduling
okay thanks but how do i detect player dismount and kill him?
EntityDamageEvent?
no, you are applying damage, no Event
okay thanks i found a code on googling it
@EventHandler
public void onDismount(EntityDismountEvent e) {
Player p = (Player) e.getEntity();
Entity pig = e.getDismounted();
if (p instanceof Player);
{
if (pig.getCustomName().equalsIgnoreCase("Piggy"));{
Player n = p.getPlayer();
n.setHealth(0);}
}
}
and i made some changes
player.getPlayer() ? what does that?
All i know is that it is same thing i want to achieve and sorry i am a beginner.
sorry for that
oh
Anyone know the name of the partial that silverfish make when they burrow into a block?
it’s probably just a generic one
yeah ik, but I am looking for the particle name
wait
wdym generic?
just like one that gets used for many things
why not just p.setHealth 🤔
it’s probably the same as the digging
why do u need a Player n
okay i will try
Do you know what the name of this generic one is?
ok thanks anyway
@junior geyser is that the same effect as when they spawn?
Do i need to call this event in command class?
I think so
i dont this this is actually usefull but eh
Ill try POOF, Thanks
does anyone knows a plugin to make players invisible for each other but only one player can see them all?
I think you need to use nms for that
but not 100% sure
and idk how to do that with nms either
sorry I don't know excatly what nms is? can you explain that?
sry
net.minecraft.server
👀
he wants to make the player on visible to certain players tho
i'm not really into programming of plugins, so i probaly don't will be able to code a plugin by myself
he needs to use packets
which is possible with that
acctually?
void hidePlayer(@NotNull Plugin var1, @NotNull Player var2);
u can scecify the player
declaration: package: org.bukkit.entity, interface: Player
As long as you dont use an ancient version.
yea
my maths go really brr
🧢
wrote it down smh
are you using an api for this?
no thats minecraft server code
Cause I dont got a POOF
thats why i said its probably useless
Thats not the sppigot api?
I am using the 1.17 api, I dont think its changed
hi
how can I make that when tnt is placed it will be powered instantly
I have that code:
BlockPlaceEvent
Check if placed block is TNT
Cancel event
Spawn PrimedTNT entity instead
I'd actually not cancel the event, I'd run a timer 1 tick delay to test if the block was placed, then spawn TNT entity and destroy the block
What do you mean "if the block was placed"
leave all the inventory management upto the event, an other plugins could cancel the block place
Ah i see.
how can I summon PrimedTNT?
public void onPlaceEvent(BlockPlaceEvent e, Block placedblock) {
Material mat = e.getBlockPlaced().getType();
if(mat == Material.TNT) {
Block block = (Block) e.getBlockPlaced().getState().getBlock();
block.getLocation();
//stuff
}
}```
Get the World of the block and look for the spawn() method int there.
ok thank you
something like this?
@EventHandler
public void onPlaceEvent(BlockPlaceEvent e, Block placedblock) {
Material mat = e.getBlockPlaced().getType();
if(mat == Material.TNT) {
Block block = (Block) e.getBlockPlaced().getState().getBlock();
//stuff
e.setCancelled(true);
e.getPlayer().getWorld().spawnEntity(block.getLocation(), EntityType.PRIMED_TNT);
}
}
}```
remove the Block
zeah I removed it
YEEEEES FINALLYY
forgot
now make that into an api
and this like is useless too Block block = (Block) e.getBlockPlaced().getState().getBlock();
ye
lol
no it isn't I did block.getLocation when I spawned an PRIMED_TNT entity
Yes and thats pointless
why?
^
even got it working so it doesnt say 0 days for example
Material mat = e.getBlockPlaced().getType();
if(mat == Material.TNT) {
//stuff
e.setCancelled(true);
e.getPlayer().getWorld().spawnEntity(e.getBlockPlaced().getLocation(), EntityType.PRIMED_TNT);
}
}```
will this now work?
yes, if you register the event
oofc I registered it
also
if you mean that:
getServer().getPluginManager().registerEvents(new DetectTNT(), this);
cleaner code is always better
Hey, i want to show the level under the Player name but if i try that, there is a "0"
public static void updateLevel(Player p) {
NitUser user = new NitUser(p.getUniqueId().toString());
WizardBuildSection section = (WizardBuildSection) user.getSection(new WizardBuildSection(p));
Bukkit.getOnlinePlayers().forEach(all -> {
Scoreboard scoreboard = all.getScoreboard();
Objective obj;
if(scoreboard.getObjective("level") == null) {
obj = scoreboard.registerNewObjective("level", "dummy");
} else {
obj = scoreboard.getObjective("level");
}
obj.setDisplaySlot(DisplaySlot.BELOW_NAME);
obj.setDisplayName("§7>> §bLevel§7: §b" + section.getLevel() + "§7 <<");
all.setScoreboard(scoreboard);
});
}
Image Link: https://ibb.co/2g7kzLz
which one is cleaner?
yours
o i see
It's fine all I want this plugin to do is just to make that tnt explodes instantly for our bedwars
if you want it to explode instantly you should spawn an explosion rather than a PrimedTNT
probably BlockFormEvent
Does that actually trigger from it?
Test it and see. I did say probably
Sounds more promising
It doesn't i checked the java docs sadly
it’s what 7smile7 said
is there an event for when a player takes damage?
Check if e.getBlockPlaced() is not null (to be sure)
?jd There is a search box you can use keywords on the javadocs
EntityDamageEvent covers all entities including players
EntityDamageEvent check if entity is player
Is there a way to remove the "score" for the "BELOW_NAME" Display Slot? I dont want any numbers
As far as im aware you can't remove the number thats the whole point of the score
Anyone know how to create worldguard regions what support all versions? I think worldguardwrapper helps but idk how to use it correctly.
Drop all the trash and support newer versions only ^^
anyway I can reference the cooldown object like that?
the 1.8 kids bring money tho 🙂
You cant reference an object before it is created. This looks like a design problem
a n g e r
But there is probably an elegant solution to this problem. Mind sending the ActiveCooldown class?
sure
I could make this function accept an AnctiveCooldown
then pass itself into it
there it is
BiConsumer
so change it into that
Eh...
bruh i watched a video about a plugin who was free that time but now costs 10 dollar
So you want to auto finish the cooldown if a certain condition is met, right?
You could make an anonymous class and overwrite the isDone method or use a Predicate<Integer> inside the class which is called inside the
isDone method or extend your ActiveCooldown with a new class ConditionalActiveCooldwn let me write an example for the latter.
what do you think about the solution I just posted?
public class ConditionalActiveCooldown<T> extends ActiveCooldown {
// But this will lead to a fat constructor
// Maybe make a builder for this
private final Predicate<T> condition;
private final T object;
@Override
public boolean isDone() {
return super.isDone() || condition.test(object);
}
}
Very hacky
I mean it seems useful for other things
so now I can access the other functions inside the ActiveCooldown which is useful
sup... small problem. My config file keeps removing a map each time I reload the server? I'm pretty sure it does save as it is...
Anyone know how to create a basic worldguard cuboid region and set some flags to it? they've made it so complex now.
it only saves when I stop server, delete the config file and restart
anyone know a solution for this? #881521604876697671
why is player.getItemInHand deprecated?
normally there is a deprecation note
Can I still use it?
you need to get the equipment iirc
oh
or just cast it to HumanEntity
and use the methods there
or that cause i’m a dummy
player.getInventory().getItemInMainHand() should be used instead
Dont use deprecated methods. If they are deprecated then there is a better implementation available already
since there are two hands now
If you dont want to edit the ItemData while the server is running you can just remove the saveConfig() in your onDisable()
ok
this is more of a java question but this notation
switch (transitiveBlockType){
case ON_SPAWN -> customBossesConfigFields.setOnSpawnBlockStates(deserializedData);
case ON_DEATH -> customBossesConfigFields.setOnRemoveBlockStates(deserializedData);
}
automatically insert break behavior between case 1 and case 2 or does it propagate downwards?
its just that each time I /reload or in general restart server. If the config file is not deleted. The map will be deleted
it should insert breaks
I'm trying to find whats wrong tho for more info
Or well, there are no breaks
Sysout everything
Hello, I am trying to make a plugin to kill a player when they take any sort of damage even the most small amount of damage. The System.out.println don't even print to console thus leaving me to believe that it isn't even registering the EntityDamageEvent
public class OHKO extends JavaPlugin {
public void onEnable() {
}
public void onDisable() {
}
public void onDamage(EntityDamageEvent event) {
System.out.println("Killed?");
Player p = (Player) event.getEntity();
p.setHealth(0);
System.out.println("§4§lKilled?");
}
}
@EventHandler is missing
WOW, How did I miss that
You also need to implement Listener and register the event handler
Thank you so much
@quiet ice the class extending JavaPlugin doesnt have to implement Listener
im fairly sure yea
no
This is impossible, JavaPlugin extends PluginBase implementing Plugin extending TabExecutor
wait plugin extends TabExecutor?
yes, which is why onCommand can be overriden
because it isn't an event listener at it's heart
guess i am confused with a library then. mine will automatically implement it. my bad
hmm true
hey, has anyone here worked with worldguardwrapper and created regions and added a flag to them before? I can't work out how to do that :/
the tab executor is only extended since the extending java plugin class is the fallback implementation of the commands
thats the entire error?
nothing is rly loading. It fixes when a map I have in config.yml disappears
when the map above is in the config file there's a problem
show code where ur trying to load the map
(all broadcast stuff is just to see wazzup)
it worked when I was using Materials and not itemStack 😢
all done by 7smile7 basically
ur on 1.8?
yep 1.8.8
ah yea
... plz no
so annoying to deal with item durability
is it something to do with 1.8.8
well im not sure because your error only sais an error occurred
thats not alot of information
Well 1thing for sure is that the loading process isnt working
so I'm guessing its cuz of this "loadForm" thing
if durability is a problem it would be logical
then how do I deal with enchanted golden apples?....
Stacktraces are the most important thing in java development - ignoring them is a waste of time
and just split the string
String[] values = configValue.split("\|");
#split(character)
oh I see
don't forget to handle exceptions
but would that rly change the problem I have?
I'm gonna do it cuz its way better then doing substrings
actual fuck? smile is helping with 1.8 cases too now?
dddaaaaaaaaaayum
explains why the code is all final lol
yep
not like that
| is a special regex char, you need to escape it
... and \ is a special java char, you need to escape that too
string.split("\\|")
oh ; looks good 🙂
ffs, discord also requires escaping of backslashes (why even?)
🙃
\lol
will my item have any problems if I'm in 1.8.8 or its fine
thats easy to fix if you know java O.O
hurray
lmao 🙂 key[2] to get second string lets go.
fix ur AIOBE tho
everything fixed
great
❤️ idk how the usage of substrings caused the death of my plugin but ok
not always
well technically yes, but the String#substring(int) method ends at the end of the string

well
Does anyone know of a method to see if a material can be placed in a certain location? e.g. cactus cant be placed next to other objects, snow cant be placed ontop of ice ect? is there a method to test this?
it should also be known that strings are immuteable, so they won't cut the current string instance
most people know that lol
I have done this mistake far too often
I never did
same
your ide should tell you that if you ever do it?
No, it's 100% valid java, so it wont complain
your IDE wont tell you that
Would it be possible to fire the event that tests that?
just if you are doing strange things
really?
Well, it will if you configured it to
Kinda like eclipse can complain about nullabillity, but wont by default
that comes if you dont use the return of a method
This is just java, but is there a way to know what the name of a file you are downloading from a URL is called? some metadata type stuff
it really depends on the underlying protocol
ill give it a look
yeah i guessed it would
can someone explain to me approximately how to make a randomizer that picks a random between certain coordinates? because i don't know how to start it
make a threadlocalrandom
between two locations, in a straight line?
// Create the random object
Random random = new Random();
// Generates a random number from 0 to 100
random.nextInt(100)
no d
ThreadLocalRandom
dont
Don't do that
just do that for x y z variables

?
not always
random is fine
ive never had an issue with it
not in special cases
use ThreadLocalRandom
Random is seeded
understand why before you spout random shit like this
my laptop is so slow intellij can't quite manage to autosuggest classes in useful time 😦
it "sucks" if you keep remaking the random object
press F for my laptop
well everyone i asked said that random isnt very good 
keep the random object stored somewhere and reuse that and you will be fine
ThreadLocalRandom is not seeded (or well it is, but you can't influence it), which may be worse in some cases
since he dont wanna use a special seed he should use ThreadLocalRandom since its more perfomant and doesnt create a Random instance everytime
for example I wanna do it like that a randomizer picks between the coords 200/60/300 and the coords 6276/55/1920 but that doesnt work with random i think
i need to pass a parameter, how can i select one var or if it is null the second var without an if block?
Everyone has a fad now and then who praise some new function. Random is fine when you are single threaded.
And while Random used to have the synchronized modifier everywhere, this is no longer the case in modern java versions, so it doesn't matter that much
you can make it work
but how
pretty easily
okay
just give it a lower value and a higher value
to randomize between
for each individual coord
I see, thanks for the info :D
it does? just create the random object, then do random.nextint(6276-200)+6276 and it will get a random number between 200 and 6272 then do this for xyz coords
You need to answer if you want random coords in a straight line between locations, or in a cuboid?
the superior randomizer is hardcoding a number, obfuscating the code and saying it's random
can't prove it isn't

still requires a modulo, an add operation and an array access at best, not very efficent
For random numbers I usually just make a method i call each time i need one and give it a min and max value...
no i want the randomizer to pick 200 OR 6272
random.nextBoolean() ? 200 : 6272
then randomize a boolean value
damn it I blame my slow internet for being slower than geol there
very good thank you
can you randomize me a gf
lol but ty too
I can pay you in runescape gold
randomize a gf? This is some serious work in today's world
random.nextBoolean() ? false : false
:(
oof
man this room sucks, they never resolve the real issues
No
what
bbl 3d printing a procedurally generated gf
Just ask musk to randomize a gf for you
he asked for a randomizer
just simplify it to false
If you want it to pick from a set of predetermined locations, you could always create a list of Locations and pick a random one from there, just incase you ever want more than 2 random locations
Did he ever answer if he wanted the random location to be along the line between start and end?
he just wanted to pick between two specific locations
why
static
qustion is it ok making pl field static
Utils do not have state nor dependencies
no
So literally 0 or 1, ok
also it should be final
why not if that class will have only one instance
not multiple
interface?
cool kids pick between -1, 0 and 1 because there's always that one thing that breaks the format in a way that you didn't think to accommodate ahead of time
and why make it static
MrAxeTv you shouldn't have any Utils instances floating around
so static method can use it
if you do then you successfully created an anti pattern
ah shit
jesus
I'm at 90% so I must be a really good developer
tbf I also threw the plugin into static, no way I'm going to get it any slower than that when I spend half my time making bukkit runnables
wew i wasnt even using it
I have this too because I inherited some strange code
tbh, static isnt necessarily bad, it just depends how you use it
I enjoy living dangerously
rawr
anyone knows a java tutorial that isn't just the basics
it's called documentation
^
there arnt many tutorials that go past the basics
that's the slowest way isn't it
its the best way to learn
oracle docs and javadocs Ig
well, past the basics it always gets slow
it's the only way to learn past a certain point
especially my livestreams
also look into nio as opposed to io
unfunny!
oh yes 🥵 nio
streams are generally slow, so avoid them if you have an alternative
idk I'm more of a dark souls person
they're not?
they're
ok I think I'm just avoiding working on transitive blocks at this point, I better go back to work
You should read all the 17 chapters of the JLS. Then you have covered the more advanced stuff
they're synchronized so they're not as fast as they could be
PStreams are a thing too
they have to cache a lot of things they pull in lazily and create new objects sometimes
tho I suppose parallel streams are quite the deal
there's one situation where NIO is slower than an alternative tho
accessing files within a .jar
I benchmarked it myself :)
how much slower
gimme a sec
gradle had a benchmark for that I recall
if someone codes java 8h/d in how much time will he get good
yes I want to do that but how can i do that
depends on the dev
GetFileInformationByHandleEx returns ERROR_INVALID_PARAMETER
on FAT file systems, so this breaks stat.
See also https://go-review.googlesource.com/c/go/+/154377/.
if it was me 
more than however long I've been doing it for buddy
Pro/Cons:
- JarFile is faster if you need to do just access but is more restricted.
- FileSystem is closer to actual files but slower to instantiate.
hmm
For me it was 1.5 years
define good though
Started in mid-2019 and I would say that I was a good developer by the end of 2020. That being said I'm still learning a lot of stuff (especially in the JLS side of things)
I dont know a single developer that looks back on their past work and thinks it was good
allowed to code spigot
You can code spigot whenever you want
geol was java your first programming language?
I actually also learned Java for 1.5 years, started back in early 2020.
I've been programming over 40 yeas and I'd say I'm decent.
I learnt java by coding spigot plugins
My first lang was Batch tho.
uh what the fuck
how old are you?..
likely
he is 200 years old
He's retired, that much to say
Elgar boomer 😛
yeps 🙂
I mean he sounded old either way
Its not that unusual to see older guys on the spigot forums tho tbh
old people are always nice
but yeah I think I've learned a lot considering how many years I've spent programming
We are usually too busy shooing kids off our lawns
tbf on the matter of "being good at java", I think it's more granular than just that, you can get really into the specifics of something and get good at that without ever really messing with whole parts of java
my first thing to learn was php but i gave up :P
php sucks
if you told me there are people out there that make a living programming java but have never used reflections I would easily believe that
but ye if I were you id just start coding spigot plugins, its easier to learn to program if your programming something you like
or messing with file saving
You gotta be american right
I try not to use reflection unless necessary, otherwise I use method handle tricks like LambdaMetafactory.
I wouldn't be surprised if using reflections is straight up forbidden in some businesses because that seems like a nightmare to coordinate and maintain
I sure hope it's not banned anywhere, cause reflection is great
who the hell would ban reflection
it allows you to use software which is coded horribly
they can be great from time to time, but I know someone is not removing dead code because of reflections
now y'see my heart is set on a different kind of cursed beauty
ASM 😍
ASM is nice - as long as they don't copy & paste the Java language specification
(AnnotationNode is a perfect example of copy & paste)
nah they're just copy & pasting the Java virtual machine specification
UK here. But I keep odd hours.
but uh ASM is designed primarily for speed, not actually usability lmao
there are businesses that ban access to github by blocking it on their networks, so...
sorry I meant stackoverflow
github too
They do that to maintain clean room. They don;t want you stealing others code, which they would be liable for.
^
I mean yeah but also no
Stealing code can be a serious issue in enterprise world
Elgar, you know you only have around 30 message outside of #help-development , lol
if you find out apple stole your github project to process images when that was not with a license that allowed them to do it, a lot of people would go after them for a lot of money lol
That many?
LOL
smh why am i watching this
FourteenBrush used "wrong format", it was super effective!
huu
Please help in the animated scoreboard the player does not work %player_name%
flyingPlayers better
%player%?
HA
yes
Whenever i use player.connect on bungeecord, the player gets timed out. I don't know what's causing this but it used to work and I didn't change anything.
Does it need PlaceholderAPI as dependency?
including the collection type kinda weird don't you agree
this goes so hard brrr
no
coomer
private Set<UUID> flyingPlayers = new HashSet<>();
I dunno if that can also be final tho
Then write the plugin developer
did it like this
so i have a solution but it gives an console error, this line
this.getBukkitEntity().addPassenger(stand);
where 'this' is an nms entity and 'stand' is a bukkit entity. Gives the error:
java.lang.IllegalStateException: Use x.startRiding(y), not y.addPassenger(x)```
But i can't use startRiding bc converting bukkit to nms isnt a thing so what should i do
lmao
public Butterfly(Location loc) {
super(EntityTypes.f, ((CraftWorld)loc.getWorld()).getHandle());
this.setPosition(loc.getX(), loc.getY(), loc.getZ());
this.setHealth(1);
ArmorStand stand = loc.getWorld().spawn(loc, ArmorStand.class);
stand.setInvisible(false);
stand.setMarker(false);
stand.addEquipmentLock(EquipmentSlot.HAND, ArmorStand.LockType.ADDING_OR_CHANGING);
stand.getEquipment().setItemInMainHand(new ItemStack(Material.FISHING_ROD));
this.getBukkitEntity().addPassenger(stand);
spawnMembers(loc);
}```
can you send pics? 😏
lol
bob ross 😳
bob ross cool af
How to check if a specfic item slot is empty?
== null or type is air
np
but do you know what i can do bc nms cracked
i just wanted to mkae sure that it's null
no
how ridiculously inefficient would it be to implement my own pathfinding instead of using NMS
like I know how, but would there be significant performance overhead to have an entity just set its velocity/facing direction according to a "goal" location
the issue with NMS is of course the need to update it every time the game updates
any suggestions for my fly command? 🙄
what exactly is there to suggest
besides the fact that you could probably trim down some stuff using a map rather than a list or a set
and that you should be doing args.length >= 1 instead of ==
@maiden briar
Yes