#help-development
1 messages · Page 1954 of 1
if i put all that code in the runnable will it fresh it? Cuz im planning to use the scoreboard to get the users coins and stuff
Yes, it will
it's a very bad idea to put all that code in a runnable
Your current code won't refresh because it have been created before the runnable
you want to do this:
Please
1. On join, assign the scoreboard to the player
2. Run a runnable that updates the CONTENTS of the scoreboard
that's it
yeah and im trying to refresh in this case update the scoreboard in a runnable
so im trying to figure that out
yeah well change some values maybe?
Try giving to it invisible potion while it's charged
Yeah just make the creeper invis
im a type something out u tell me if it will work
The aura will still show
Bukkit.getServer().getScheduler().scheduleSyncRepeatingTask
(this, new Runnable() {
public void run() {
score1.setScore(11);
p.setScoreboard(board);
}
}, 0, 120);
What is the slot id of the helmet slot in 1.18.1?
Would that refresh/update it?
yup
p.setScoreboard is TOTALLY useless in that runnable
the player already has this scoreboard
no, that's not needed
you set the scoreboard once, then you can just change the scores
I tried it, but also the aura is invisible
i love how intellij tells you that you can use a lambda expression instead of new runnable 
I think it’s a problem with my client, cause my friend can see it
I have tried googling different things, and two of the results I found (5 and 103) where wrong
ill tell u if it works give me a sec,
I hate how intellij says "this field can be final" when it actually can't lol
o.O
just the idea hurts my brain
I would love to use IntelliJ but my brain hurts when I use it
My goodness is it the light mode?
no it's dark mode
LMAFO, i have similar bug in Eclipse
I’m joking
isnt it bcs of the {
} block?
but that's 100% fine
That's now trick, i just learnt that you can use {} instead of static {} or public Class() {}
well not exactly "instead"
liek
it of course works differently 😄
yea but in most cases i use public class() {}
{ } is if you want to have code that's shared across different constructors
public class MyClass {
public static void main(String[] args) {
new MyClass("asd");
}
static {
System.out.println("Static Init Block");
}
{
System.out.println("Init Block");
}
public MyClass(int a) {
System.out.println("Constructor with int");
}
public MyClass(String a) {
System.out.println("Constructor with String");
}
}
This will print
Static Init Block
Init Block
Constructor with String
I usually use static {}
yeah but that's for something different ofc
e.g. I always use { } to set the instance, of course that woudln't work in static { }
where?
people using static block to init static variables 🙁
yeah lol
well sometimes
you need it
if they dont need it 🙁
then it's stupid, yes lol
I mean
I use it for stuff like this
public class CustomBlockData implements PersistentDataContainer {
private static boolean hasWorldInfoGetMinHeightMethod;
static {
try {
Class.forName("org.bukkit.generator.WorldInfo");
hasWorldInfoGetMinHeightMethod = true;
} catch (final ClassNotFoundException exception) {
hasWorldInfoGetMinHeightMethod = false;
}
}
Using anything you don’t need 🙁
hmm ye then its useful
Why use the API when you could use asm to achieve the same result
watching comic stuff lol
going to forget the stuff i learnt for the test tomorrow
:C
how to fix
You can’t just call getPlayer on an OfflinePlayer
They need to be online for that to work
I want it to show up even though it's not online.
Also doesn’t OfflinePlayer have a getName anyway

Hello, any idea why i can't import this ?
is there easier way to do that?
?main
well you can do it
but it might be null 😄
Have you got the spigot api online?
?bootstrap
Bootstrap Jar
The main spigot-1.18.jar is now a bootstrap jar which contains all libraries. You cannot directly depend on this jar. You should depend on Spigot/Spigot-API/target/spigot-api-1.18-R0.1-SNAPSHOT-shaded.jar, or the entire contents of the bundler directory from your server, or use a dependency manager such as Maven or Gradle to handle this automatically.
Please read the release notes for further information: https://www.spigotmc.org/threads/9-years-of-spigotmc-spigot-bungeecord-1-18-1-18-1-release.534760/#post-4305163
are you using maven?
✨Don’t name your class main✨
Have you got the imports?
yess
yes
doesn't look like it
you manually added the normal spigot.jar
you should instead add spigot-api using maven
first i create the java project and after i add the spigot libs
you must add spigot-api as dependency to your pom.xml
So you are not using maven
Oh okay thanks
Its fine
How can i add spigot-api as dependency please ?
you can also use it without maven if you don’t have it installed
do you actually have a file called pom.xml?
no :C
just add spigot-api.jar like you added spigot.jar
Try hovering the Java Plugin error
If it shows up an import
Press it
they are using the bootstrap .jar, that won't work
So i need to download maven at first ?
Not if you don’t want to make things difficult if you are new
maven makes everything easier
Okay i go to maven
if you want to switch to maven, which 99% of people will recommend, read this: https://blog.jeff-media.com/how-to-create-your-first-minecraft-plugin-using-the-spigot-api-and-maven/
If he is new that are other things to learn.
well they are currently having trouble to add a dependency and that's exactly what maven is for
np
I hate this kind of things that use slashes and backslashes to make parameters
Or whatever they are called
windows? 😄
Yeah but I don’t really code Windows
do you mean stuff like taskkill /F /PID 9
No I mean <dependency><dependency/> or whatever is it
XML
That
why do you hate it lol
Wait until you see HTML :p
it's basically like yaml without having to worry about indents
isnt using maven easier
show your full code
You are not updating any value of this scoreboard, try creating the scoreboard for every tick and you’ll see that works.
Okay so wtf do i do then,
I meant just for debugging
Cuz i got told to not do p.setScoreboard(); for bukkit runnables
also
(getConfig().contains("Stars." + p.getUniqueId() + ".Level"))) {
getConfig().set("Stars." + p.getUniqueId() + ".Level", 0);
getConfig().set("Stars." + p.getUniqueId() + ".LevelColor", "&7");
getConfig().set("Stars." + p.getUniqueId() + ".EXP", 0);
is ugly
make a class for accessing
those stuff
@EventHandler
public void onJoinScoreboard(PlayerJoinEvent e) {
Player player = e.getPlayer();
ScoreboardManager manager = Bukkit.getScoreboardManager();
Scoreboard board = manager.getNewScoreboard();
Objective objective = board.registerNewObjective("test", "dummy", ChatColor.DARK_AQUA + "" + ChatColor.BOLD + "Cyan" + ChatColor.AQUA + "" + ChatColor.BOLD + "Mines");
objective.setDisplaySlot(DisplaySlot.SIDEBAR);
Score score = objective.getScore("Test");
score.setScore(ThreadLocalRandom.current().nextInt());
player.setScoreboard(board);
Bukkit.getServer().getScheduler().scheduleSyncRepeatingTask
(this, new Runnable() {
public void run() {
score.setScore(ThreadLocalRandom.current().nextInt());
}
}, 0, 20);
}
Basically what you are doing is creating a String that contains a variable and setting it to a place in the screen, if you don’t actually update the variable itself, it would not update magically
you can easily update the existing scoreboard score without rejoining or anything
see my video and the code above
(although it's not a good idea to spawn one task per player)
Ugh getnewscoreboard 
I used the code that was sent and just adjusted it and removed everything i didnt need for the test
It's a curse that I will forever mald over
So should i use:
score.setScore(ThreadLocalRandom.current().nextInt());
no
Replace the threadlocalrandom with the value you want
no
okay guys, i really need your help on this:
I need to make trigger a bungee event (event that will trigger on bungee proxy plugin, using bungee api) from a spigot plugin using spigot api, and passing somehow a string as event payload
I don't care how unrelated the event may be from my simple goal of exchanging string data from a plugin to another of two different apis, and btw i'm assuming this is a bad practise and things shouldn't be done this way, but to put it short i don't care, to do things correctly I would have to rewrite my whole plugin so it supports bungeeapi, and i have very few time left (and i don't want to hassle too much as well, as its for a private plugin)
they want to update the objective's name, not the score
Oh
I just wanted to show with my code that rejoining is not needed to update any scoreboard stuff
mmmmmmmmmmmmm
ok ok, wait can i have an example with my existing code?? without using ur integer code addition to mine?
if that makes sense
plugin messaging
so then i get the general idea and then i can stfu and move on with life
The home of Spigot a high performance, no lag customized CraftBukkit Minecraft server API, and BungeeCord, the cloud server proxy.
thank you very much buddy exactly what i wanted
This doesn't need any extra setup of an intermediate server or sth right (besides the bungeecord setup that is already done)
as i read it doesn't seem like so
tysm
it only requires to have at least one player online on the server that sends the "message" to the proxy
you'll want to create a new objective everytime
because you can't change already existing objective's names iirc
I think
not sure, I'll try some stuff
never did any scoreboards before
that sets the "top" name, like the aqua colored thing in my video
im trying to refresh ( update or whatever ) the scoreboard, but apparently bukkit runnables don't work with scoreboards...
Yea they do
that's bullshit
you just don't know the difference between scores, objectives, etc
all you did in your code was to set the score of an already existing objective to 12
I even sent a video that proves that runnables "wor with scoreboards" 😄
Ik then i asked u if u could provide an example using my code and not modifying my code, so then i can understand a bit better
but then you ignored me
^
^
k
mh any idea what is the green under this :
a "typo"
hover with your mouse over it
and read what it says
MY EYES
it's underlined in green because of spelling correctino
👀
No
no
yes haha
well okay this might explain all your light mode problems lol
The sun makes me catch fire
Wait do you use light mode on discord too?
So nothing serious or otherwise?
i can continue ?
lol yes?
you have committed eye murder
you should all see a doctor
Pretty sure you're the outlier here alex
nowhere else are people constantly crying when someone sends screenshots of something white lol
also noone seems to have problems with wikipedia screenshots
somehow people's eyes are only hurt when they see intellij light mode, but not when they see a wikipedia screenshot that's also black on white
Cause if I can fix it without one of those sketchy plugins I would
who told u that
Just because Wikipedia is light mode doesn't make it okay
tbh dark mode on almost all websites looks ugly
?customconfig
thats not for me
GitHub finally made a dark mode and it's so niceeee
ig others but i also cant stand wikipedia white background
it's okay to have wrong opinions
fun fact, I have discord in white mode too
there is
I mean I know it's a preference thing, but dark mode is just straight up easier on the eyes, especially in dark rooms.
wtf
lemme try it
no. I always use a theme for like 3 weeks, then it annoys it and I switch
ew browser discord ver
on mac my intellij and discord always switch themes automatically when it gets darker in the room
ALL not builtin themes always look disgusting
i dont want 999 tabs open
im always having a browser open and discord
why not have them on the same tab if i can
You're not allowed to have opinions if you use Browser Discord btw
ic
Browser Discord is for alt accounts only
how
how what
i cant manage having many tabs open
just use a VM for alt accounts
im too lazy to move my mouse btw so i just alt tab
thats too dumb
why would u have a whole vm just for an alt account what
well it only takes me 30 seconds to create one
Takes me 5 seconds to open a new tab that's already logged into my alt
yeah but what if you have 5 alts
ever heard of chrome profiles
Chrome, Opera, Firefox, Edge, IE 
no, I don't like browser discord
because when you have 50 tabs open, it's hard to find the discord tab you're looking for
for me, I use a browser to browse the internet, and discord to use discord
I mean I'm fairly sure Browser Discord and the application are the exact same thing
chrome groups
Just not as good as the app
i put each related group of tabs in a group in chrome
e.g. ctrl+T doesnt work in browser discord
it does
You can’t still alt tab unless you have multiple windows tho
then how do you open a new tab while being in browser discord?
by clicking ctrl t
i dont get that
can someone test
if this spigot issue
or not
item duplication glitch
player.openInventory(player.getOpenInventory());
it really acts funky
if this is a spigot issue to someone test it
The chances that you've found a duplication exploit in spigot are pretty low
can someone test
you can
i have paperweight-userdev on my side and building via buildtools for me just for this just seems unpractical
if I had to guess its a visual glitch, and either way not a important glitch considering you have to open your own inventory for it, which isnt done natively
Ctrl+K
bruh @mortal hare
lol
i've just tested this feature
it exists in discord browser
out of curiosity
click ctrl k
If doing something weird produces a dupe it's not a bug it's a feature you've introduced
what kind of inventory even is the one you've opened "twice"?
its a playerinventory
you can open playerinventories
if you didnt know
but its usually for player to open other player's inventories
not for his own
yeah sure you can, but normally a player's inventory is actually InventoryType.CRAFTING and not PLAYER
?
if you don't have an inventory open, player.getOpenInventory returns a CraftingInventory
@Default
public static void onSet(Player player, Material material) {
main.setMaterial(material);
player.openInventory(player.getOpenInventory());
}
You used getOpenInventory didn't you
he did
i didnt
why? you asked us to test this code and that's the code that I tested
probably its even craftbukkit bug
but tbh it's not really a bug, more like undefined behaviour because now top and bottom inventory are the same which isn't exactly meant to ever happen
Achievement unlocked!
Find a bug in server software.
Is that how essentials does invsee
probably
I guess, but essentials doesn't let you open your own inv twice
Do something you're not really supposed to do and call it a bug rather than an unsupported feature
I inputted valid method argument, thus it should support that feature
or just throw exception
that's a bug

no
you can also do
How do I leave leave the Title blank? I only want a subtitle..
player.sendTitle("Title", "§fWelcome to §6§l" + config.getString("ServerName"), 1, 2, 1);
new NamespacedKey("ASD","asd"); and it will throw an error although it expects a string
""?
""
or null
ty
if it's @ Nullable
throw new RuntimeException();
then call it a bug
It stops working when I do that.
maybe openInventory should add this add the beginning
public void openInventory(Inventory inventory) {
if(inventory == getInventory()) throw new IllegalArgumentException("Can't open player's own inventory");
Throw an exception with 1% chance 🙂
Wdym stops workinf
player.sendTitle("", "§fWelcome to §6§l" + config.getString("ServerName"), 1, 2, 1);
if that doesnt work add a space
player.sendTitle(" ", "§fWelcome to §6§l" + config.getString("ServerName"), 1, 2, 1);
it probably uses raw slots or converted slots
to set dragging, which could result dragging with an offset
I will try it again
that would explain why items end up in the helmet equipment slot
yes, dragging always uses raw slots
because you can drag between two inventories
Can you help me please, i'am starting in dev so it's my first pl
Where can i find my error
click on the uppermost thing on the left
"HelloNiriaa [package]"
then you see the full error
in this screenshot
the top left entry
the red exclamation mark with "HelloNiriaa [package]"
ahhhhhhhhhhhhhh
ugh
?paste
?paste that pls
sorry
dont worry, noone died
paste your pom.xml
old jdk
erm
this should work
you set your jdk version to 6
Uh stop following said guide what the fuck
why did you do that?
white paper ?
ur jdk is 1,8 but in the maven compiler its set to 6
White paper?
it's from my guide, they manually added the source and target 6 part
i don't know the english world for "guide paper"
my guide is fine 😛
so how can i fix that please guys
replace the 6 with 8 in lines 48 and 49
<source>1.8</source> <target>1.8</target>
yes
thanks i try!
I still wonder why you had that in your pom
damn i see u everywhere
my guide doesn't have any target or source specified https://blog.jeff-media.com/how-to-create-your-first-minecraft-plugin-using-the-spigot-api-and-maven/
nice job tho
well except for properties -> java.version
thx 😄
You're website is as white as your IDE's
white sites matter
Someone knows if papi has a discord? Im about to rant.
oh I want to watch that
helpch
it isnt as bad as intellij light theme
at least that's what they linked on their spigot page
it looks like a java swing application tho
It's also in the main github readme
where's the promised rant?
Why doesnt Action.RIGHT_CLICK_BLOCK work with a Disk?
are you actually clicking a block?
it does
seems like you're clicking air
Yess it work fine with other items.
Only the disk doesnt work
it works fine
@EventHandler
public void onInteract(PlayerInteractEvent event) {
if(event.getAction() == Action.RIGHT_CLICK_BLOCK) {
event.getPlayer().sendMessage("Right Click Block");
}
}
/reload
what even is that? some 1.16 pre version?
I'm not gonna restart the server to test a simple interact event
?paste
Any idea why i have this : https://paste.md-5.net/uzewozecan.bash
that has nothing to do with music discs?
"Caused by: java.lang.ArrayIndexOutOfBoundsException: Index 0 out of bounds for length 0"
you try to access the first element of an empty array
ur trying to access first element of an empty array
i saw that i'am asking here because it's a discord where we can ask questions
thanks
what is a left click?
no
click to the right
I meant to ask "what's a left click" because I didnt do any left clicks
so I was asking to what you were referring to
obviously, right click works fine with music discs
Wat
I actually wrote "right click" at first, mb lol
anyway as said, right-click works fine on music discs
What is wrong? 🥲
Then maybe get them first 
the itemmeta isn't equal to the meta you are comparing to
I still wonder
thanks guys
why you added jdk 6 to your pom.xml

CAn spigot latest version keep comments on saving ?
I heard some people it can
is there some special method to save
I can't figure out how to get a Chest from inventory holder, any ideas?
you have an inventoryholder right?
if it's a chest, you can cast it to (Chest)
Yeah, it's from InventoryClickEvent
event#getInventory()#getHolder()
Chest chest = (Chest) inventoryHolder;
that hasn't been working
okkk is it maybe a double chest?
let me test
Chest and DoubleChest are two different things
ah, I see, that might be a problem but I'll fix that
if your holder is a doublechest, you must cast it to doublechest, then you can do getLeftSide and getRightSide and get each chest by casting either getLeftSide or getRightSide
because
if you have a double chest and use it's PDC, you are fucked if one breaks only one part of the chest
the doublechest itself can't have PDC
everytime someone places a chest it assigns their UUID in the PDC
hi, how can i make it so that when a player tries to place a block, this block is not placed on the ground but it is removed from the inventory? (im using BlockPlaceEvent)
would that make it so both sides have their UUID?
- Cancel BlockPlaceEvent
- set the amount of event.getItemInHand to amount-1
yeah sure
np
@EventHandler
public void onPlace(BlockPlaceEvent event) {
event.setCancelled(true);
event.getItemInHand().setAmount(event.getItemInHand().getAmount()-1);
}
@shadow oriole
what do you actually want to do? prevent players from opening others chest?
log when someone tinkers with a chest that isn't their own
if so you should also check on placing chests to prevent players connecting their chest with an already placed foreign chest
tyy 🙏
ur welcome
thanks
You don’t need to place it on the side of the other chest
did not work, it does not let the player place the block, but the block goes back to the inventory
How to get player name form UUID whether they are online or not
You probably need to delay the setAmount by one tick
Doesn’t OfflinePlayer have a getName
Bukkit#getOfflinePlayer(uuid)#getName() or something like that
Then yeah getOfflinePlayer with the uuid
sad moment
Sure, if you do it yourself
Ok
Stop calling get player
We already told you this
You cannot have a Player instance for a player that isn’t online
You have to use OfflinePlayer
can you exemplify? i tried like this ```kt
e.isCancelled = true
Timer().schedule(timerTask {
e.itemInHand.amount = e.itemInHand.amount -1;
}, 1)
it
?scheduling
just one
i already tried, the item is removed but comes back at the same time, as if isCancelled is conflicting with this
I assume casting a doublechest#getLeftSide() to Chest works
nothing yet, is something wrong? ```kt
e.isCancelled = true
Thread.sleep(100);
e.itemInHand.amount = e.itemInHand.amount -1;
You can just use runTask for a 1 tick delay
Please don’t use thread.sleep
¯_(ツ)_/¯
I mean sometimes one letter variable names are fine
You probably don’t want anything else than i for a fori loop
What
i and j
No that’s not how it works
A variable’s name should be proportional to the scope it’s contained in, is the general convention
nested for loops just choose the next character that looks like i and hope you remember it
I go i > j > k
i, j, k are also conventions
wait actually?
Anyhow no one uses index because it’s utterly redundant
Heh...
I mean that’s what abstraction is for like we got interfaces and stuff
same thing ```kt
e.isCancelled = true
Bukkit.getScheduler().runTaskLater(PluginMain(), {
e.itemInHand.amount = e.itemInHand.amount -1;
}, 1)
Well, set the itemInHand rather than the amount property
Since itemInHand just returns an ItemStack copy
Probably
But like, they’re essentially context objects regardless
and what is to instantiate? the file where the events are is an object
this way? ```kt
e.itemInHand.setAmount(e.getItemInHand().getAmount() - 1);
What event are you using
BlockPlaceEvent
Fully hmm, I still don’t know if you can directly manipulate the ItemStack (as if that’d have any impact post event procedure)
So instead, mutate the players itemstack directly using the setter/property assignment
List<String> comments = pl.getConfig().getComments("?path?");
Always returns blank list.
I tried config.yml for path, tried Configuration Section, but I can't get comments.
They are inside config file
How does your config.yml look (the contents)
With its eyes
Hilarious 
Thank you
i tried to remove the item directly from the inventory, using player.inventory.removeItem, but no success too
In the event callback or scheduled after?
Yuck, believe spigot has no api to get top level comments
I assume an empty path doesn’t work
callback
Maybe try getComments(“Hotbar”)
is that right?
Maybe wanna try to schedule it after
Still no
e.itemInHand.let {
Bukkit.getScheduler().runTask(plugin,{
e.player.inventory.removeItem(it);
});
}
perhaps?
Idr if let can be used that way
What in the name of Kotlin hell is that
what is this plugin? 🤔
Your plugin instance
main class?
The one that derives JavaPlugin
Oh yeah btw
You need to register the listener and annotate it with @EventHandler
And if you use kotlin you could create an inline function
iirc that’s what they’re called
@ivory sleet MainPluginClass.getPlugin(MainPluginClass.class) gets the plugin instance without needing to pass anything right?
already have it, the event is being emit
but that part does not work
assuming MainPluginClass extends JavaPlugin
Myes, tho you could use JavaPlugin.getPlugin(MainPluginClass.class) as it’s a bit shorter in this case
Ye
Ok cool just making sure, ive always passed the instance
I prefer passing the instance but yeah
Like can you send the class you got right now?
?paste
the file where is the event?
Myeah, the more the better
The heck does let even do
I see
Fully well, may I just ask, why you use durability
They have different name spaces nowadays
Also make sure you’re recompiling when trying things out
Happens to a lot of times someone just happens to use an odd compilation procedure in combination with shitty plugman
Maybe they are on 1.8

because i want to remove a specific clay block color
Right but that hasn’t used metadata since 1.13
Actually metadata hasn’t even existed since 1.13
yes, im using 1.8
Oh then I don’t know
There are a lot of bugs in 1.8
So might be one of them you’ve just encountered
if I modify a chest PDC do I have to set something about the chest to its new PDC? Using the same exact key to get a value from before from the chest PDC is returning null despite a String being put in that key it when the chest was placed. I've even printed the owner's name from UUID grabbed from the PDC with the same exact key when they placed it, so I'm not sure why it's returning null the second time I grab it
you'll have to update the state
Well after you write to the chests pdc you grabbed from the block state
you call BlockState#update
I see setdata and settype but not state
no that method exists on the block state you use to get the PDC
oh. gotcha
while this is exactly what I wanted to do, it has one side effect - ball doesn't go behind the player when too high up (to define "too high up": y+1 or 2), it just bounces off and continues going forward even though it wasn't hit in the air, it was just raised
@ivory sleet a question, this removeItem was to remove the item even in the creative?
it is not working even without setCancelled
still getting null from the PDC
I want the cube to bounce off the player if its too high up to "raise" (right click), not just continue going forward
chest.getBlock().getState().update();
What
final Block chestBlock = ....
final Chest chestBlockState = (Chest) chestBlock.getState();
chestBlockState.getPDC().......
chestBlockState.update();
That chestBlockState is a snapshot of the block state in the world at the time you call getState
chest.update(); then
you modify that snapshots PDC
only if you call update on that specific snapshot you modified will the PDC changes be written
yes
if chest is the instance you grabbed the PDC from
public static void setChestOwner(Chest chest, UUID uuid) throws IOException {
PersistentDataContainer chestPDC = chest.getPersistentDataContainer();
String encodedOwner = UuidCoder.encodeToBase64(uuid);
chestPDC.set(chestOwnerKey, PersistentDataType.STRING, encodedOwner);
chest.update();
}``` yeah this is what the method looks like
so it's just chest#update(); then
Yes looks good
is it just me that hates that UuidCoder is lowercase for the UUID
I mean, using base64 to encode a uuid is also rip
lol
the PDC offers a byte array you can piggyback to store uuid
iirc the javadocs for PersistentDataType actually contain a functional data type of uuids
dead ass?
Yes
my ass is very much alive
declaration: package: org.bukkit.persistence, interface: PersistentDataType
haha it works now thank you
nevermind I'm a spoon, apparently if I want this I need to return the length earlier
🥄
nope.. I even tried with the Player#getVelocity, still the same story, I'm so confused right now
i love how it worked for one hit and then after that it was the same
🧽
when TNT is ignited, is BlockIgniteEvent not called?
I've registered BlockIgniteEvent correctly and made the listener but it's not doing anything
which one is better? gradle or maven?
you could argue for either, the job at hand has an impact, your preference, etc
wtf
What is your point
is that even good or bad
It’s nothing
well you confirmed it then, imma head out appreciate it
the one you're more familiar with
How to get gray dye material 1.8
ok
Does anyone know how the new yaml comment saving feature added in 1.18.1 works? I thought that it would no longer remove comments if I called #saveConfig(). Apparently this is not the case. .-. I really don't want to call #setComments() every single time I need to save the config. Is there not a way for this functionality to be automatically applied to existing files?
Nevermind, turns out being 36 versions behind the latest release was enough to miss the change that added comment support.
how do i make it so console can only send a certain command?
meaning no players can but console
Check if the sender is ConsoleCommandSender iirc
tysm
block ignite event isn't called when tnt is ignited
When you are in a 6 row chest do the inventory slots shift in numbers?
That depends on a few factors. Whether or not you're using raw slots or relative slots, and which inventory you're calling methods on
would it use a lot of my resources if i had a block state change every tick?
or would it be more efficient grouping muitiple changes into one, and changing them every 20 ticks?
eg BlockFormEvent, just stuffing changes into an arraylist and modifying it every second
or does it not matter
and erk, how would i change a large area of blocks
i see small, minor noticeable lag when using a for loop when setting the blocks and it just bothers me :}
a question guys, 1.16 yaw is in degrees right?
pretty sure its in degrees in all the versions
Hello guys, I'm using packets to appear a block in the world, but the block that appears when it breaks does not drop any items and the sound of breaking is stone, but the block is dirt, could anyone help me? I'm using this code:
WrappedBlockData loke = WrappedBlockData.createData(targetBlock.getType());
pacote.getBlockData().write(0, loke);```
I checked javadocs, but cant seem to understand why getRawSlot() is an unresolved refernece
i wanna check the number of slot that was clicked??
how can id othis
also how can i get the player of InventoryClickEvent
e.viewers?
how do i use #
event.getWhoClicked, please learn java
im learning right now
do your own research if you're learning
How do i check the slot that was clicked
and get its number
because getRawSlot() doesnt work
I'm not gonna spoonfeed you anymore sorry
but google.com
you are funny
i am already looking on google, actually..
I been looking at this
but getSlot does not work.
wow look who knows what he's doing calling me kid
How old are you?
lol bro I'm not gonna waste my time on you, no one gonna spoonfeed you and learn java
well good news I am here now 🙂
huh
in regards to your prior interaction lmao
anyways # is used in place of . sometimes because of urls etc
for future reference
I got a question
ty
(!(joinqt.toBoolean())).toString()
This flips the boolean and converts it to string right?
so it would be false -> "true"
not sure if you could do it one go but if it lets you, that is what that would do
and ! means not or false. So how it reads is if joinqt is not true toString()
I was just clarifying it, glad it works for you though 🙂
Technically, it is, if the negation of joinqt is true
Im confused
What dont you get
its a variable.
Not what i meant
It's kotlin i guess
wait
why is it a string
what
it had to be
what are u converting to string, the if statement?
no
can u send the whole line
The home of Spigot a high performance, no lag customized CraftBukkit Minecraft server API, and BungeeCord, the cloud server proxy.
thats not how yml works btw
i guess but u forgot a : in front of setitng
is there a way to get an offline player in BungeeCord or do I have to do it manually using Mojang API?
BungeeCord doesnt know about player data. Its just a proxy that handles a connection.
ok ty
I was wandering if anyone could make a plugin so that u can change the colour/name of a block mined
also can u make it compatible with fortune
?services
If you wish to request or offer development/art/building/administration services, please do so at https://www.spigotmc.org/forums/services-recruitment-v2.54/
y not?
If you wish to request or offer development/art/building/administration services, please do so at https://www.spigotmc.org/forums/services-recruitment-v2.54/
still having this issue, does someone know how I can change this?
no idea what you mean. can you show a video and show your current code?
so i have
@EventHandler
public void onMove(final PlayerMoveEvent event) {
final UUID playerID = event.getPlayer().getUniqueId();
final Deque<Location> locations = this.lastLocations.computeIfAbsent(playerID, key -> new ArrayDeque<>());
if (locations.size() == 2) locations.poll();
locations.add(event.getTo());
}
public Vector getLastMoveVector(final UUID playerID) {
final Deque<Location> locations = this.lastLocations.get(playerID);
if (locations == null) return null;
final Location last = locations.poll();
final Location secondLast = locations.poll();
if (last == null || secondLast == null) return null;
final Vector vector = last.toVector().subtract(secondLast.toVector());
vector.setY(vector.getY() / 2);
locations.add(last);
locations.add(secondLast);
return vector;
}
to get vector of the player, then I use length() from that vector to setVelocity to my cube (slime)
it works great but the only issue is that when you are moving the cube forward and since I also have PlayerInteractEntityEvent#onRightClick() method I can give the cube additional Y which raises the cube in the air, the problem is that no matter how much you raise it the cube continues going forward instead of for example hitting the head of a player when falling down and staying behind
this is a problem because when another player kicks the cube, no matter how high the player that's in front will just block it even though its ex 5 blocks above him, no need to hit it or anything
how do i make intellij make everything final by default
I'm using it in EntityDamageByEntityEvent to calculate power += this.getLastMoveVector(player.getUniqueId()).length() * 2 + 0.4; kicking power
(default kicking power being power = 0.4)
it won't do that on its own
It's used again in my scheduler#runTaskTimer task to calculate new cube velocity ```java
double power = this.getLastMoveVector(player.getUniqueId()).length() / 3 + oldV.length() / 6;
newV.add(player.getLocation().getDirection().setY(0).normalize().multiply(power));
you can go to code inspection settings and tell it to warn you when you didnt declare something final that could be final
and then run the quick fixes over it
oh ok
ill just do it myself then
how many people are going to cry now? 🥲
I know
I assume it doesnt since a bot isnt an addon to something
although I actually don't understand the reasoning for plugins neither
i read in some thread that since
a plugin is just an addon to the main software which is bukkit
so it cant have a class called Main, only Bukkit can
yeah makes sense but also, a plugin also has it's own kinda thing of a main class
public static void main() is basically onLoad() and onEnable()
I understand that "Main" is a fucked up name if your plugin has an API
because people have to do stuff like
Main chestSort = (Main) Bukkit.getPlugin("ChestSort");
well yeah but onLoad and onEnable are just event listeners connected to a bus which is the actual main in bukkit, no?
of course that would be very weird, but if it's just an internal name, I don't really understand why everyone gets so upset about it
they are no listeners, just two normal methods that the plugin manager decides to call
ic
but yeah "Main" is not exactly a nice name for a plugin main class but still ,nothing to cry about imho
btw what are the benefits of making a variable final
does it increase performance
it probably doesnt?
not really
you can't accidently change it
if it's final you'll always know it still has the same value as the actual parameter given
if it's a local variable
and for fields, well
same assignment, not value
yeah I was thinking of primitives and strings
whats the difference
you can make a Location final
but you can still do myFinalLocation.add(0,0.5,0)
so it's the same location but it has changed nonetheless
yeah
hmm how about, when to use Weak and Soft references, and are they worth using to boost performance
You use a weak ref when you are unsure if anyone else is going to keep a reference to any of your objects.
I don't really know
but
yaaay my pull request made it into bukkit
I wonder why md_5 always declines pull requests, yet still somehow merges them 😄
what did you change ?
declaration: package: org.bukkit, enum: Particle
the javadocs now contain the datatype for all particles that take special data
e.g. "Uses BlockData as DataType" lol
so basically nothing except some javadocs comments lmao
but it was really annoying that this was missing
uh nice
but no wonder thats nothing he needs to check again...
or maybe just test if the classes are ok
show full log
is the error message spigot's or custom? (sorry if im stupid)
custom
show your code
lol my plugin is doing well
then the problem is 100% in code
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
you should make it premium 10$
convert it to skript
dont know.... but isnt dis bannable on spigot ?
lets hope not
public static Economy getEconomy() {
return econ;
}
private boolean setupEconomy() {
if (getServer().getPluginManager().getPlugin("Vault") == null) {
return false;
}
RegisteredServiceProvider<Economy> rsp = getServer().getServicesManager().getRegistration(Economy.class);
if (rsp == null) {
return false;
}
econ = rsp.getProvider();
return econ != null;
}
public void isecon() {
if (!setupEconomy()) {
log.severe(String.format("[%s] - Disabled due to no Vault dependency found!", getDescription().getName()));
getServer().getPluginManager().disablePlugin(this);
return;
}
}
contains calls containsKey on the internal hashmapmap while get calls get(key) on the internal hashmap
so is containsKey faster than get
idk
probably (NOT SURE)
contains is likely faster as it doesn;t actually fetch any value
yeah with filter you go through all elements contains uses the internal hashmap making it O(1)
wait im stupid
hashset doesnt have get
It’s actually O(n)
containsKey in a hashmap is O(1) right
Ω(1) but O(n)
which of those if statements returns false?
wtf is difference?
Best vs worst case
oh ok
if (!setupEconomy()) {
log.severe(String.format("[%s] - Disabled due to no Vault dependency found!", getDescription().getName()));
getServer().getPluginManager().disablePlugin(this);
return;
}
yeah worst case if there are n collisions its O(n)
if (!setupEconomy()) {
log.severe(String.format("[%s] - Disabled due to no Vault dependency found!", getDescription().getName()));
getServer().getPluginManager().disablePlugin(this);
return;
}
that is the fail message
so plugin cant see vault
I was asking which one of the if statements in your setupEconomy() method returns false
Does anyone know whether I can read two yaml files into SnakeYaml? I want to first read the default config, then read the "user-changed" config
private boolean setupEconomy() {
if (getServer().getPluginManager().getPlugin("Vault") == null) {
return false;
}
RegisteredServiceProvider<Economy> rsp = getServer().getServicesManager().getRegistration(Economy.class);
if (rsp == null) {
return false;
}
econ = rsp.getProvider();
return econ != null;
}
TheTemplatePlugin
he's probably asking which if statement actually failed, try adding System.out.println statements before each return false and see which if actually ends the method
yes... you return false up to three times there
and I still wonder - which one of those is returning false?
the first one?
the escond one?
the third one?
add some debug output to find out
nothing dont print anything
is there a different way to do it in 1.18 because it worked in 1.17
maybe vault did not load becasue of an error or smth
did you added statement before first if?
would help to see your log
okay I recorded it from the old plugin and the new one:
old https://i.imgur.com/udNSW2j.mp4
new https://i.imgur.com/MFwSDvq.mp4
old method for power was to update a HashMap with the player's uuid and sqrt of PlayerMoveEvent event.getFrom() - event.getTo()
obviously, you didn't add any print statements
