#general
1 messages ยท Page 205 of 1
fun
Why does java have a >>>????
Like, I get << and >>, shifts
But >>>?
a: unsigned right shift operator
well
ok . _.
Zero-fill right shift
try plugin, this
I mean you can't declared unsigned variables in java... yet it has that
Also dont make events in your main class
That looks good to me honestly
He isn't
ffs im blind
??
Register the event in the main class
ok
onenable
what
You're calling registerEvent, the one you're looking for is registerEvents with an S
registerEvent takes a completely different set of parameters
Just register it in your main class
too
i cant
hold on let me make a vid
DON'T GIVE UP
getServer().getPluginManager().registerEvents(new ClassName(), this);
YES YOU CAN
ffff
getServer().getPluginManager().registerEvents(new JoinListener(), this);
Copy and paste that into your onEnable
ok
Tell me if it works
If you have numlock off, the zero key on your keyboard is also most likely insert
why would i need to put this getServer().getPluginManager().registerEvents(new JoinListener(), this);
i dont have a num pad
Because its registering the event
wouldnt new JoinListener(this); work
well it gave this error
java: constructor JoinListener in class me.muhammad.listners.join.JoinListener cannot be applied to given types;
required: me.muhammad.listners.Main
found: no arguments
reason: actual and formal argument lists differ in length
Is there a red line
yes
oof
Take the event register out of your join listener class
cant change it now
Ditch that
y tho
Take what I gave you out of the onEnable
no errors
Honestly, ever since I got tired of forgetting to register my listeners, I made myself a little helper library/framework with a SelfRegisteringListener implements Listener class that registers itself on construction lmao
I never have to register a listener myself ever again
Take what I gave you out of the onEnable
@gilded nova i did
Good. But for future reference, getServer().getPluginManager().registerEvents(new JoinListener(), this); is all you need to register the listener instead of this chunk. However you can do it any way you like, it doesn't matter. The way you did it can result in a cleaner main class, but the way I did it just makes it simpler lol
Show me the plugin.yml
if you use the mc development plugin for intellij, it automatically creates it for you ๐
how can i get it
ctrl+alt+s
for settings
and install it in the plugins tab
And when you create a new project, just choose spigot plugin or whatever you want to make
pog
dangggg
will i still have to give it the jar file though
Caused by: java.lang.UnsupportedClassVersionError: me/muhammad/listners/Main has been compiled by a more recent version of the Java Runtime (class file version 58.0), this version of the Java Runtime only recognizes class file versions up to 52.0
bruh
did you forget to change the project sdk
Project Settings
yes i did
Project
oop
fefo you didnt need to do taht
You might need to set it in the module (in the modules section) as well tho
You need to set join message
e.setJoinMessage I believe
i didnt make leave message
in the event
instead of broadcast message
ikkkkkkkkk
cool
i did
It's probably in your config
Accidentally put a & in there
without a letter or number
Do you have a & in your name?
Are you sure you did &a and not just &
yes
lets see
maybe ur right
theres an &a
but it still shows the &
and no color
Can you send me the config
`firstJoin_message: '&a<player> &6has joined the server for the first time!'
join_message: '&a<player> &7has joined the server'`
u want the event
sure
i did
`@EventHandler
public void onJoin(PlayerJoinEvent e){
Player p = e.getPlayer();
if (!p.hasPlayedBefore()){
e.setJoinMessage(Utils.chat(plugin.getConfig().getString("firstJoin_message").replace("<player>", p.getDisplayName())));
} else{
e.setJoinMessage(Utils.chat(plugin.getConfig().getString("join_message").replace("<player>", p.getDisplayName())));`
oof
fortmatting
public void onJoin(PlayerJoinEvent e){
Player p = e.getPlayer();
if (!p.hasPlayedBefore()){
e.setJoinMessage(Utils.chat(plugin.getConfig().getString("firstJoin_message").replace("<player>", p.getDisplayName())));
} else{
e.setJoinMessage(Utils.chat(plugin.getConfig().getString("join_message").replace("<player>", p.getDisplayName())));```
should be working hahahaha
Make sure you restart the server with the new jar
i jjust /reload
theres only 2 plugins
And if you changed the config, make sure you delete that too
restart
the fucking server
Heres the process: compile > stop server > replace jar / delete directory > put in new jar > start server
k
i didnt change it
yeah
or the plugin
server
f
Why did the top one work correctly?
it didnt
it missed the first letter
and yup
the config was wrong
it said only &
You have to delete the config file if you make changes to the config
I told you so lol
we dont talk about those
ok now my name isnt cutoff
perfect
time to code a leave message
Because it would've been doing &d
@EventHandler
public void onQuit(PlayerQuitEvent e){
Player p = e.getPlayer();
if (!(p.hasPermission(plugin.getConfig().getString("silent_leave_permission")) {
e.setQuitMessage(Utils.chat(plugin.getConfig().getString("Quit_message").replace("<player>", p.getDisplayName())));
} else {
e.setQuitMessage("");
}
}
done
I made it fancier
leave.silent?
If they have that permission, they'll have no quit message
That's only if they have the permission lol
dont do it for me
like admins
still
Here
@EventHandler
public void onQuit(PlayerQuitEvent e){
Player p = e.getPlayer();
if (!(p.hasPermission(plugin.getConfig().getString("silent_leave_permission")) {
e.setQuitMessage(Utils.chat(plugin.getConfig().getString("Quit_message").replace("<player>", p.getDisplayName())));
else if (p.getName().equals("Hayawii") {
e.setQuitMessage(Utils.chat("&dthe guy that needs to learn basic java before diving into spigot API (" + p.getName() + ") just quit!"));
}
} else {
e.setQuitMessage("");
}
}
bruh
๐
intellij?
just open a new one and say new window
yes
yeah what tim said
Instead of this window
when you go to open a project it will ask to use the current window or a new window
i usually have like 3 open lol
Same but it cooks my slow pc
ah
Didnt you do this like twice already?
why 2
Damn boy 560ti
and no vga
How do you run minesweeper
i dont
only the 3080 will
release it already nvidia
i had a 2080
but sold it early so i can get the most money
i got that zalman case
lots of fans
but two of the fans are absolute garbo
and make bearing noise
erased
they are the blue colored fans
Literally the shittest thing hahaha
any 50+ dollar air cooler is better
not a 120mm aio
my pump can only be heard when all the fans are unplugged
hard drive is louder
lmao
at 4000rpm
WOAH
27c
how
i have a 3600 @4.3ghz 1.3v
and it idles at 40-50
what plugin should i make
death messages
yeah
bruh
where would i put the config.yml
in resources
Papa is that you
is this all i need for a death messages plugin?
nope
guess noti
oh
im small brained

ez
all the potential plugins i can make
now you're thinking
and i dont have to pay any one anything
You dont have to pay if you get leaked premium plugins ๐
shhh
and decompile
No its against TOS
if your already getting the premium plugin for free why would it matter
Well if you're already getting it for free, it's already against the TOS
exactly
Don't do it man. The devs put hard work into their plugins (most of the time)
hi if anyone knows a block inspection mod for sponge pls let me know!!
I'm almost certain devs that have open sourced projects are friendlier than ones with premium plugins because 9 times out of 10 they feel like they are superior lol
friendlier?
Yeah
hi can someone help me with perms? bc i dont know how to set any
oh oops lol
how do i become a @verified
i'll go to general 2
ah
The verified dudes are good good devs
except for the bad ones like me
The verified dudes usually make and maintain massive community projects
they are typically well-known ones involved with popular projects
technically im invlolved
yes
Makes join event listener = verified
Like bungeecord?
yes
The home of Spigot a high performance, no lag customized CraftBukkit Minecraft server API, and BungeeCord, the cloud server proxy.
Its similar
I've never used it
how would i change the death message to different deaths?
Use some sort of randomizer code lol
o i think i know
https://dzone.com/articles/random-number-generation-in-java#:~:text=You can use the java,)%2C%20or%20nextLong().
I just assumed thats what you meant
OH
Youll have to check if they are under water first
no
nvm
DamageCause cause = e.getEntity().getLastDamageCause().getCause();
if(cause == DamageCause.DROWNING){
//set death message
}```
That was on spigot forums
pog
What why would use a random number generator instead of just using Random Tim
Owait your article seems to be about that and I just misread
Soz
i would need to make another event right?
dang
DamageCause cause = e.getEntity().getLastDamageCause().getCause();
if(cause == DamageCause.DROWNING){
//drowing death message
} else {
//death message for normal death
}```
Ignore the last one
i wouldnt need an else
why not just multiple ifs for each damage type
like by player or cactus or lava
or something
i can put it all in the config
im so bored ๐
Same
someone have a restart script? We are using mc host a root server so when the root server restarts the mc server is not restarting so i dont find a guide for stupid peoples like me with step for step thats root server is restart after they start instant the mc server
which discord is that?
Spigot
how do I make it so diamonds don't drop from diamond_ore?
you monster
setDropItems(false);?
event.getBlock().setType(Material.AIR); would this work?
Nope, that would replace the block with air, but the items will still probably drop
setDropItems(false);?
and yes, that would work
alright thank you
public void giveItems(Player player) {
ItemStack item = new ItemStack(Material.DOUBLE_PLANT, 1);
ItemMeta meta = item.getItemMeta();
meta.setDisplayName(ChatColor.YELLOW + "" + ChatColor.BOLD + "" + ChatColor.UNDERLINE + "Miner Shard");
ArrayList<String> lore = new ArrayList<String>();
lore.add(ChatColor.WHITE + "");
lore.add(ChatColor.WHITE + "This is a Miner Shard Used To Craft");
lore.add(ChatColor.WHITE + "Pieces Of The Miner Armor");
meta.setLore(lore);
meta.addItemFlags(ItemFlag.HIDE_ATTRIBUTES);
item.setItemMeta(meta);
player.getInventory().addItem(item);
}
}
This is my current code, no errors, just want to know how I can implement a % chance of the player receiving the drop
how much math you know?
you can use the Math.random() module and calculate chance
i think
why not math.(50) or something similar?
wot
it's a way to get rando numbs
if (Math.random() >= 0.1) {
event.setDropItems(false);
}
how is that scary lol
10% chance of getting the items
up to you tbh
how the heck am i supposed to put this in an if statement
if(cause == DamageCause.DROWNING){
//drowing death message
} else {
//death message for normal death
}```
if you want to reuse the code for something else, you should make it into a new method
ok
or, depending on how much it is called or if just at runtime, use something like
private final Random randomGen = new Random
//then, later:
if (randomGen.nextInt(boundary) == 1) {
//do things
}
you can use any math there
nextInt will make a number within that bound
including 0 but not including the number the bound is
i think java if (Math.random() >= 0.1) { event.setDropItems(false);
is better for what im using
only problem is...
one day ill be able to decipher this gibberish
up to you! one looks shorter, but if you're gonna have that called often, you'll probably want to make it earlier
and also
sharing a single line is not going to get very far
^
^
^
package me.FlameDuder.DuderItems;
import java.util.ArrayList;
import org.bukkit.Material;
import org.bukkit.entity.Player;
import org.bukkit.event.Listener;
import org.bukkit.inventory.ItemFlag;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.ItemMeta;
import net.md_5.bungee.api.ChatColor;
public class DuderItems implements Listener {
public void giveItems(Player player) {
ItemStack item = new ItemStack(Material.DOUBLE_PLANT, 1);
ItemMeta meta = item.getItemMeta();
meta.setDisplayName(ChatColor.YELLOW + "" + ChatColor.BOLD + "" + ChatColor.UNDERLINE + "Miner Shard");
ArrayList<String> lore = new ArrayList<String>();
lore.add(ChatColor.WHITE + "");
lore.add(ChatColor.WHITE + "This is a Miner Shard Used To Craft");
lore.add(ChatColor.WHITE + "Pieces Of The Miner Armor");
meta.setLore(lore);
meta.addItemFlags(ItemFlag.HIDE_ATTRIBUTES);
item.setItemMeta(meta);
if (Math.random() >= 0.1) {
event.setDropItems(false);
player.getInventory().addItem(item);
}
}
bad lizard
@rigid widget now?
bad lizard!
Hey TheShinyLizard! Please don't tag helpful/staff members directly.
i should switch now?
put the event thing in your event listener instead
๐
IntelliJ will help not only with saving your poor eyeballs from that light curse
but also explains errors and points them out
well you haven't defined the event anywhere have you
I think they call that when the event happens, from another class
dunno why that class is implementing listener though
๐คท why not just make one plugin
because not everyone needs to become the next essentials
exactly
if(cause == DamageCause.DROWNING){
//drowing death message
} else {
//death message for normal death
}```
how do i use this
like that
what is "DamageCause"
That's a thing
Likely information regarding a cause of damage
means how the player died?
e in that example is for an event
you don't assign variables in an if
cause is exactly what you put in the if, and it is an (instance?) of DamageCause
follow the code snippet you posted?
"death"
"event"
package me.FlameDuder.DuderItems;
import java.util.ArrayList;
import org.bukkit.Material;
import org.bukkit.entity.Player;
import org.bukkit.event.Listener;
import org.bukkit.inventory.ItemFlag;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.ItemMeta;
import net.md_5.bungee.api.ChatColor;
public class DuderItems implements Listener {
if (Math.random() >= 0.1)
event.setDropItems(false);
public void giveItems(Player player) {
ItemStack item = new ItemStack(Material.DOUBLE_PLANT, 1);
ItemMeta meta = item.getItemMeta();
meta.setDisplayName(ChatColor.YELLOW + "" + ChatColor.BOLD + "" + ChatColor.UNDERLINE + "Miner Shard");
ArrayList<String> lore = new ArrayList<String>();
lore.add(ChatColor.WHITE + "");
lore.add(ChatColor.WHITE + "This is a Miner Shard Used To Craft");
lore.add(ChatColor.WHITE + "Pieces Of The Miner Armor");
meta.setLore(lore);
meta.addItemFlags(ItemFlag.HIDE_ATTRIBUTES);
item.setItemMeta(meta);
player.getInventory().addItem(item);
}
}```
now what did I do wrong?
that if needs to be inside a method
why are you using a d for an event ๐ฉ
why the orgasm emoji lol
that's... weary
stop putting your whole method into another method
like... tired of this bs
i stil dont understand
like... why tf
that's the orgasm emoji, like, it's the popular definition
ill fite u
@EventHandler
public void onPlayerDeath(PlayerDeathEvent event) {
// Your things
EntityDamageEvent.DamageCause cause = event.getEntity().getLastDamageCause().getCause();
if(cause == EntityDamageEvent.DamageCause.DROWNING) {
event.setDeathMessage("XXX drank too much water");
}
}
since you didn't want to follow the code snippet telling you how to use it
By the way
๐ฉ
so i did it right?
yes
larry no
๐ฉ
the snippet you were sending was correct
;-;
well kinda, except you didn't actually do anything when the damage cause was drowning
i want to make a custom message for each damage type
I suggest you make that private static Main plugin non-static instead
can someone re-explain the math.random stuff? im still not quite picking it up
You'll learn over time that static should be used exclusively and not sparingly
@clever swan I can, but only my way
go for it
ok
// the following makes a new Random called randomGen (it's what we can use later in a variety of ways)
private final Random randomGen = new Random();
//then, later:
//the following gets that Random, and uses the nextInt method, which generates a nearly perfectly random number within the boundary you give it and 0
// it will include 0, but not the actual boundary number
// you can use things like the nextBoolean method to make a random true/false, or you can use if .nextInt(2) == 1 and it's practically the same thing.
// the following gives a 1 in 10 chance (0-9) that it'll be a 1 that returns.
if (randomGen.nextInt(10) == 1) {
//do things
}
@clever swan
new Random();?
yeahyeah
new random is probably easier to understand tbf
where it says
Easier to understand sure, less useful
someone explain new Random() or send a link
private final Random randomGen = new Random should be private final Random randomGen = new Random();
he just explained it?
i know im trying to edit
i know ๐
he just explained it?
oh
okay, now go read the code block above
it is time to try and absorb information
I thought y'all were trying to tell them to generate a new random every time instead of making one
like what they had before
ew no
// the following makes a new Random called randomGen (it's what we can use later in a variety of ways) EDITED FOR FEFO CAUSE I SUCK
// !!!!!
private final Random randomGen = new Random();
//then, later:
//the following gets that Random, and uses the nextInt method, which generates a nearly perfectly random number within the boundary you give it and 0
// it will include 0, but not the actual boundary number
// you can use things like the nextBoolean method to make a random true/false, or you can use if .nextInt(2) == 1 and it's practically the same thing.
// the following gives a 1 in 10 chance (0-9) that it'll be a 1 that returns.
if (randomGen.nextInt(10) == 1) {
//do things
}
There
happy
๐ฉ
thank you
I'm sensing some passive aggressiveness towards Fefo towards the end of that first comment
I could just be seeing things tho 
happy
very much indeeed
indeeeeeed
I actually understand this
orgasms galore
hey nice
LMAO
welcome to learning how to code
At least I can finally explain something to someone properly in java - that was my first time too
continuous strokes until finally, it stops for 5 minutes
first time buddiees!
it was very epic
๐ฉ
seriously tho
(okay fefo, now it's fun to do this, cause it bugs u)
do you hate me now ๐ฉ
and im assuming the 10 represents 10%?
nope it'll make a number
between 0 and 9
so it's 1/10?
it just generates a random number from 0-9 and you're checking if it's 1 so it'll end up being a 1 in 10 chance
in reality I could also do:
if (randomGen.nextInt(10) == 7) {
//do things
}
and it would be the exact same thing
cause math
or:
if (randomGen.nextBoolean && randomGen.nextBoolean && randomGen.nextBoolean) {
//do things
}
would be a one in 8 chance 
can u see why? That's your mickety mousety clubhousety task for today!
what the bloody hell is this
larry doing java
sounds fucky
you what real fun math is
how would that be a one in 8 chance ๐ค
2 * 2 * 2
the first one is .5, the second cuts that to .25 (1/4) and the third cuts that in half too (1/8)
all three have to be true
ah i was doing different math in my head
if (randomGen.nextBoolean || (randomGen.nextBoolean && randomGen.nextBoolean)) {
//do things
}
actually should have done <= but w/e
Now that's fun math
how many attempts did it take to get that to behave just for the picture? lmao
just once
you what real fun math is
Riemann-Zeta function for minecraft rng
lol
yes

(randomGen.nextInt(97) == 1)
Is this a 3% chance?
1/97
1/97
not really luck, it's just probability lol
ok ty
thank you
well, luck as in the probability played out exactly as intended
could also use nextDouble and compare <= 0.03
yep
if (randomGen.nextBoolean || (randomGen.nextBoolean && randomGen.nextBoolean)) {
//do things
}
does ENTITY_ATTACK include players?
ok
is it 1/6
hey i gettimg some kind of problem can someone help me?
kicked whilst connecting to survival: you have to join through the proxy
join through the bungeecord server
its my server im join through bungee but i having this
maybe i did some config mistake
do you have your survival server listening on 25565 instead of bungeecord maybe?
idk
check
where i check it im configuring first time
look in your survival server's server.properties
if(event.getEntity().getKiller() != null) {
event.setDeathMessage(Utils.chat((plugin.getConfig().getString("player_message").replace("<player>", killer.getDisplayName().replace(">player<", p.getDisplayName())))));
}```
why doesnt this work?
What does ide say
it works
but not waht i want it to say
killer_message: '&1D&ca&3m&an &e>player< was just killed by &4&l<player>'
this is what i want it to say
Are you sure you're not just sending that message to the dead person only and just testing with the dead person
Strings don't appear out of nowhere you wrote that
Ok that seems intended
no listen
i wrote this
but it didnt say that
config also says that
OOHHHH
nvm
i found the issue
Yep...
Yep
idk if that would work
you're missing a ) before your second replace
so it says this player was killed by this player
rip
plugin.getConfig().getString("player_message").replace("<player>", killer.getDisplayName()).replace(">player<", p.getDisplayName()))));
tis the issue I just warned you about
you're missing a ) before your second replace request
so you're trying to change a placeholder on the player's display name rather than your actual target
so, two things
oh ic
- The line of code I posted fixed it
- Count the number of replace calls you make
if (randomGen.nextBoolean || (randomGen.nextBoolean && randomGen.nextBoolean)) {
//do things
}
anyone got the chances for this yet
@rigid widget I just read it but it's basically just a teeny tiny bit over 50%
62.5 if I'm not mistaken
that is how you have it configured after all
You had a long run today
ya
@gilded nova why
Cause I said so
Smfh
hes not wrong
the very first Boolean takes 50% straight away
12 percent isn't a tiny bit
So that's 50% of chances it's true
Yea
Just from the very beginning
tomorrow ill learn guis
Then the other 50% is split into two 50% (so that makes it 25% for each one), and since both have to be true for it -> .5 * .5 = .25, but it's on the other 50% so we cut it in half making it 12.5
- the other 50
62.5
I tend to mix between 0% - 100% and .0 to 1.0 lol
But.. it's an OR
That's why it adds
All of them can be true as well
No cause once the first is true it stops
There's a 1/8 chances of that happening
Well yeah but I mean, if all of them were generated before being evaluated
Ye
Ye
Had to learn truth tables, Boolean algebra and whatnot in hs
Truth tables suck
why do those sound awful
Same thing but with ones and zeroes instead of premises lol
Mapping conditions with weird symbols is awful
B(insert three horizontal lines vertically stacked)A so C?
Answer: Because you can
It's all dumb
Them you start sticking arrows
Horizontal arrows
Reversed horizontal arrows
Vertical arrows
Meh honestly probably just ranting cause I had a dumb prof who made things dumb
Oh, screw off with the arrows ๐ฉ
Oh god the emoji XD
orgasm
No
I'm p happy with what I learned about all that in hs since I did electronics and I really enjoyed it
someone with access to the server emojis needs to just re-add that one with it classified as orgasm just to mess with Larry even more
No please ty
Lmfao
It is WEARY
see
It's the orgasm emoji
as in FED UP WITH FEFO'S SHIT
thats called an ahegao
i really need a block inspect/chest inspect/item inspect plugin
๐ฉ
woah Larry chill
where i can see the history of an item etc
๐
@storm berry coreprotect or prism
is it for sponge?
ahh sponge
Not sure that's quite appropriate for this server @deft thistle mind deleting it so I don't have to :)
lol
or not
Bye Larry ๐ฉ
a face is not 18+
Bye fefo ๐ฉ
oh god
a face can easily be 18+ when it is suggestive
And yeah @deft thistle it totally can be, simply see things like Instagram which will remove images of anything clearly depicting sexual acts
Nick's right on
||Are you alright mate||
let's just not test it shall we
||Are you alright mate||
@gilded nova ||no||
Fix yourself
how do you re spoil a spoiler
leave and come back into the chat
Lmao
thanks
||Muhammad is the type to message random girls on instagram saying "hey darling"||
Facebook then
Do people still use Facebook? . _.
i dont msg random girls either
Everyone uses facebook yeah
Everyone I know is on it lol
i use facebook lol
very
only way for me to keep up with friends and family back home
NZ ๐คฎ
Messenger
eh, they have their uses
na
That I won't deny
twitter is better
i use insta if i'm feeling like a thot
Careful... that garage door behind you might warp when you photoshop that ass of yours to look bigger
lmao
Lol
i use twitter
You're weird
some people are toxic
Like you?
no
Like you?
@gilded nova when have i been toxic
twitter is weird
good
god i hate snapchat
Facebook & Snap are the go to's
my streaks keep getting erased
and i then get them back
only for them to go again
Well stop messaging random girls saying "hey darling"
> god i hate snapchat
He'll be listening to your prayers
๐ค
i dont msg girls
i dont
You do
Yeah
You don't message girls cause you're respectful.
LMFAO
๐ณ๏ธโ๐
So then I guess you upset Allah
such a silly belief
nope
literally
100% accurate
im not homophobic i just dont support lgbt
oh shet