#help-development
1 messages · Page 2268 of 1
7smile7 here is the code
From what i can see you are trying to create a toplist ranking?
You can do that in one line by using the RANK() function of SQL
Anyways what is not working with your code? This seems fine.
lets assume ranknum is 110 when the each function is finished.
I want to use it after the each function but then it returns to it's original value which is 1.
Is it bad to name interfaces of the same name as the class your trying to acheive absraction in?
cause i get left with this
me.silentprogram.betterspawners.GuiManager
it can confuse you
SELECT RANK() OVER(ORDER BY level DESC) AS rank, *
FROM users
WHERE id="${member.id}";
is there a way to make a second ORDER BY ?
Or if you dont need the whole row you can simply remove the wildcard and get only a "rank" variable
SELECT RANK() OVER(ORDER BY level DESC) AS rank
FROM users
WHERE id="${member.id}";
Uhm. Yes. Let me think...
I have to google that...
maybe I should add AND xp
You mean
OVER(ORDER BY level AND xp DESC)
Not sure if this works...
Give it a try and tell me if it does
wait so that returns the row but with the value rank am I right?
This returns only the rank. It will be a "row" but it wont have any data besides the rank in it.
| rank |
| 23 |
so to use it I need to do rank or row.rank?
Yes
const query = "..."
db.get(query, (err, row) => {
console.log("Rank: " + row.rank)
})
gosh this language is so ugly
x ======= y
db.get(`SELECT RANK() OVER(ORDER BY level DESC) AS rank, * FROM users WHERE id="${member.id}";`, (err, row) => { if (err) { return console.error(err.message); } console.log(row)
it shouldn't be 1
I should be in the 100 place
change DESC to ASC
I think i see the problem.
WHERE id="${member.id}" might cause an ordering over only one row
When using an abstract class or interface you cant use private methods?
nvm
i woulkdnt need to
You can. But abstract methods cant be private.
Yea im noticing that
so I should remove it but then how would I get the rank of this specific user?
Let me think about how to fetch only one user
You use hibernate for a few months and instantly forget how to do sql by hand...
thank you for the help btw
I think we just nest it.
SELECT * FROM (
SELECT RANK() OVER(ORDER BY level DESC, xp DESC) AS rank, * FROM users
) WHERE id="${member.id}"
@lost matrix it works. thank you very much
Look i added xp as well. Tell me if that works
it does not
sadge
Ok nice
How can I accurately get a player's UUID, with PostLoginEvent using bungee's API?
im getting offline mode UUID's which is quite weird
ggs
You probably have IP forwarding disabled
what's the meaning of life
"To crush your enemies, to see them fall at your feet -- to take their horses and goods and hear the lamentation of their women"
i dont, ip-forwarding is set to true on bungeecord. online-mode is set to true on bungeecord.
online-mode is set to false on my spigot backend, and bungeecord is set to true on my spigot backend
Odd then. those protocols are teh only reason you would get different UUIDs
bungee should look like this correct?
and my spigot.yml is here (on my backend)
and my server.properties on my backend
is this correct?
looks fine to me
so then why does this return a different UUID than the one that is linked to my MC account?
The only reference to that happening I can find solved it by reinstalling Bungee. A shame they never found the actual cause.
reinstalling my files and whatnot?
Hey, I'm trying to verify if 2 items are the same but I want to ignore one (or more maybe later) PersistentDataContainer. I tried to verify 2 items where one has a custom PersistentDataContainer with ItemStack#isSimilar but it return false while they are the same aside the PersistentDataContainer. How can I do that?
What do you mean by are the same? Material or? Cause just make a PDC value to encompass all of them
Bit tricky. Clone both and remove the pdc entry.
well this is the current setup, where players.uuid refers to homes.owner
and the player record will always be present and that player can have 0, 1 or multiple homes
Why is your uuid a varchar? What garbage db do you use that doesnt natively support uuid?
Oh yes thank you I will do that
uh does h2 support uuid?
pretty sure
Use it instead of varchar. Varchar is horrible when indexing.
Your homes should also have a uuid which is their primary key. No real reason to use something
as volatile as the name as the primary key.
can i make a plugin that adds more music discs to minecraft but not remove the old ones
Add musics as sound to resources pack and play the custom sounds
well the combination of the player uuid and the name will always be unique so isnt that enough?
It is but this is not a clean relational model. Its pretty hacky.
A home should be able to exist without an owner or name.

How does your memory structure look like?
You should have a home manager that contains a
Map<UUID, Home>
Where the key is the ID of the Home
And something like a HomeOwner containing a
Set<UUID>
Which is a set of uuids the HomeOwner owns.
Thats relational
hehe
Looks reasonable
and im having a KingdomsPlayer class, basically some player wrapper which has a Map<String, Home>
Then why use sql?
This is 100% the structure for mongodb
mongodb ew 😂
well im making a kingdoms plugin and i intended to save everything in a database, like kingdoms, players, homes and stuff
How do I remove the PersistantDataContainer?
You cant remove the container completely. You need to remove the keys you want to ignore.
Or you can attempt to clear the container.
public void clear(PersistentDataContainer container) {
container.getKeys().forEach(container::remove);
}
Thank you very much
That may CME
Lets hope that this doesnt throw a concurrent mod
hehe
What do you mean
Just write if an exception is being thrown. If not then dont worry
Here is the fix just in case
public void clear(PersistentDataContainer container) {
new ArrayList<>(container.getKeys()).forEach(container::remove);
}
Is there a way to reset chunks, with plugins or data packs???
Meh. The problem here is that populating a chunk might look different every generation.
declaration: package: org.bukkit, interface: World
There are some issues with that so keep it in mind
It doesn't, thank you for your help
hmm kinda weird to have two databases for the same plugin no?
yes... why would you do that?
Well... depends actually
cuz you suggested to use mongodb and i guess my other data suits more on sql based language
A split storage can sometimes help extend the throughput
Ok no. You either use sql or no-sql
then lets go for sql
I guess it also depends
Unless its a custom server solution. We use Postgres for objects that have real monetary value and need very strict validations and transaction policies
and mongodb for everything else.
And redis as a cache and other stuff
it wouldnt make it easy to create one user object from multiple tables from different databases
which is kinda what im tryin to achieve rn
well i was talking about two tables; a player table and a homes table. and to create a user objects in memory i need to get stuff from both those tables
Oh
I mean foreign tables or whatever the term is, is quite common
cuz im having a playerdata class rn which stores stuff that needs to be accessible at any moment in time
you have a database of users and a database of homes, in memory
This is where i would scrap the idea of manually writing any sql and just using jpa entities with hibernate.
HomesManager.getHomes(user)
But this is only really viable if you know jpa and all those annotations.
nope
Hibernate 🥲
Otherwise ^
Haven’t heard that one in a while
i was also looking for performance cuz uhh im loading alot of stuff for that user in the prelogin
and doing one query vs multiple hmm idk
Time or space performance?
Doesnt matter. The user doesnt care if the login takes 50ms or 300ms
^
hmm you could be right
If it’s on login user experience doesn’t take some extra millis into consideration
It’s usually once they’re loaded into the game that they don’t want to experience latency etc
Whats the goal to begin with?
Hey, how can I set the instrument variant on the new goat horns ? ^^
rn im trying to load a user using two tables
i guess ill just implement two queries
and combine them
Sure
can i put multiple try with resources for preparedstatements in one that opens the connection? 👀
Use a connection pool and dont worry about your resources.
HikariCP
i am ._.
Huh? And you still need try with resource?
Don’t worry just make sure to configure it properly and it will optimize itself
its better if connections are closed anyway no?
@Cleanup Connection connection = pool.getConnection();
Hate incoming
As opposed to just closing them and re-opening new ones
that @Cleanup closes them too no?
Yess
If it’s from the pool, wouldn’t it just lend the connection back?
Sure but the connection would need to time out first.
Closing it right away is probably better.
Well I’d just be speculating as I have really no clue about hikari’s implementation
(Apart from the fact that it’s an object pool with connections and some properties like time to live etc)
But yeah I’d assume it has a special adapter implementation of Connection to just send the connection back as free to the pool when invoking close() rather than directly closing the connection on invocation.
• just speculations tho 🙂
public void withConnection(Consumer<Connection> consumer) {
try (Connection connection = dataSource.getConnection()) {
consumer.accept(connection);
}
}
public <T> T withConnection(Function<Connection, T> function) {
try (Connection connection = dataSource.getConnection()) {
return function.apply(connection);
}
}
private List<CoolUser> fetchAll(Connection connection) {
String sql = "select * from users";
List<CoolUser> users = new ArrayList<>();
PreparedStatement pst = con.prepareStatement(sql);
ResultSet rs = pst.executeQuery();
CoolUser user;
while (rs.next()) {
// add stuff to list
}
return users;
}
public List<CoolUser> getUserList() {
return withConnection(this::fetchAll);
}
Those are probably cool utility methods
As Shreb implied already: This exception is crystal clear. Your "text" variable is null.
hm
Want a solution?
dont u dare do ?java
XD
Make sure text is not null when you use it
hm
06:05:18 INFO]: Error: null
[06:05:18 WARN]: java.lang.NullPointerException
[06:05:18 WARN]: at me.superischroma.spectaculation.gui.GUI.open(GUI.java:219)
[06:05:18 WARN]: at me.superischroma.spectaculation.command.ItemBrowseCommand.run(ItemBrowseCommand.java:19)
[06:05:18 WARN]: at me.superischroma.spectaculation.command.SCommand$SECommand.execute(SCommand.java:76)
[06:05:18 WARN]: at org.bukkit.command.SimpleCommandMap.dispatch(SimpleCommandMap.java:146)
[06:05:18 WARN]: at org.bukkit.craftbukkit.v1_8_R3.CraftServer.dispatchCommand(CraftServer.java:666)
[06:05:18 WARN]: at org.bukkit.craftbukkit.v1_8_R3.CraftServer.dispatchServerCommand(CraftServer.java:629)
[06:05:18 WARN]: at net.minecraft.server.v1_8_R3.DedicatedServer.aO(DedicatedServer.java:416)
[06:05:18 WARN]: at net.minecraft.server.v1_8_R3.DedicatedServer.B(DedicatedServer.java:379)
[06:05:18 WARN]: at net.minecraft.server.v1_8_R3.MinecraftServer.A(MinecraftServer.java:713)
[06:05:18 WARN]: at net.minecraft.server.v1_8_R3.MinecraftServer.run(MinecraftServer.java:616)
[06:05:18 WARN]: at java.lang.Thread.run(Thread.java:748)
now I get dis
check the caused by part
Yeah you use spigot 1.8
Im out. Ancient version. Full of bugs etc. <insert rant here>
Not to mention a lack of java knowledge
?paste
?paste
!!pasta
%pspspsps
Ducky, think about what you want to say and do it in one message
java.lang.IllegalArgumentException: Crafting recipes must be rectangular
at com.google.common.base.Preconditions.checkArgument(Preconditions.java:145) ~[guava-31.0.1-jre.jar:?]
at org.bukkit.inventory.ShapedRecipe.shape(ShapedRecipe.java:72) ~[paper-api-1.19-R0.1-SNAPSHOT.jar:?]
at deepsmp.deepsmp.Main.onEnable(Main.java:47) ~[DeepSMP-1.0-SNAPSHOT.jar:?]
at org.bukkit.plugin.java.JavaPlugin.setEnabled(JavaPlugin.java:264) ~[paper-api-1.19-R0.1-SNAPSHOT.jar:?]
at org.bukkit.plugin.java.JavaPluginLoader.enablePlugin(JavaPluginLoader.java:370) ~[paper-api-1.19-R0.1-SNAPSHOT.jar:?]
at org.bukkit.plugin.SimplePluginManager.enablePlugin(SimplePluginManager.java:536) ~[paper-api-1.19-R0.1-SNAPSHOT.jar:?]
at org.bukkit.craftbukkit.v1_19_R1.CraftServer.enablePlugin(CraftServer.java:563) ~[paper-1.19.jar:git-Paper-58]
at org.bukkit.craftbukkit.v1_19_R1.CraftServer.enablePlugins(CraftServer.java:477) ~[paper-1.19.jar:git-Paper-58]
at net.minecraft.server.MinecraftServer.loadWorld0(MinecraftServer.java:633) ~[paper-1.19.jar:git-Paper-58]
at net.minecraft.server.MinecraftServer.loadLevel(MinecraftServer.java:419) ~[paper-1.19.jar:git-Paper-58]
at net.minecraft.server.dedicated.DedicatedServer.initServer(DedicatedServer.java:306) ~[paper-1.19.jar:git-Paper-58]
at net.minecraft.server.MinecraftServer.runServer(MinecraftServer.java:1121) ~[paper-1.19.jar:git-Paper-58]
at net.minecraft.server.MinecraftServer.lambda$spin$0(MinecraftServer.java:302) ~[paper-1.19.jar:git-Paper-58]
at java.lang.Thread.run(Thread.java:833) ~[?:?]java.lang.IllegalArgumentException: Crafting recipes must be rectangular
at com.google.common.base.Preconditions.checkArgument(Preconditions.java:145) ~[guava-31.0.1-jre.jar:?]
at org.bukkit.inventory.ShapedRecipe.shape(ShapedRecipe.java:72) ~[paper-api-1.19-R0.1-SNAPSHOT
Paste your errors sigh.
at least its 1.19
Show your recipe code
it is 1.19
.
WTF
ANOTHER REGTUNGULAR
BRUH
recipe.shape("AN ","NS"," S ");
Not rectengular
is there by any chance a consumer function that has a throws declaration or do i need to make it myself?
Callable
Or wait no
That might be a supplier
Uh might have to make one for yourself
but i could create custom item discs and give them custom ids to play different songs that way i dont remove the old ones?
how to check if player reproduce entities?
PlayerInteractEntityEvent to check if he feeds, EntityMakeLoveEvent to check when it breeds
You would have to create and manage any custom items. A Jukebox will not know your disc from a default one. you would have to handle all music playing and jukebox interaction
reproduction is caused indirectly by players not directly
Yes. But you need quite a bit of tinkering for that.
ive made a custom item before which is just a potato but a different texture but doesn't over right the actual potato
Do the same + Use the pdc and a bunch of logic to make the boxes play your custom music.
what databas should i use for my plugin
sqlite, MariaDB, Postgres, MongoDB, Redis, H2
All viable depending on what you are doing
uh can you even play sounds that arent in the vanilla game smile?
Its usually used as a fallback solution if the user does not have hos own sql database installed.
Sure, with a resourcepack
something something World#playCustomSound()
ah ok
what would you suggest i use?
A few questions before you jump into that:
- Do you have a lot of experience on working with Files?
- Does your plugin really need a Database? -> With reason pls
- What kind of data do you want to store?
hmm is there a sussy way to install sounds as mp3 in the server and play it
As .ogg yes.
urgh i hate that file format
for some reason it takes ten times as long to get processed
oh so is it not reliable enough? why isn't there already plugins like that
- not really?
- yes because im making a currency system where each user would have a certain amt of coins
- user_id and coins
thx
cant you make a single file UUID -> coins
Yes what Morbius said
just because your storing data doesn't necessarily mean you need to use a database
No need for any database, unless you are making adjustments to offline players
morbius is kind of like jesus to some ppl
how would i do that?
look up PDC
Bit weird that you made an account just to appreciate your love for that movie... but whatever you fancy...
?pdc store the players coins on the player object
btw this
you can just make a namespace named 'value' and tack it onto the player
keep in mind that this data gets send to the player as part of their nbt
as such if you stuff too much into it you essentially bookban them
You need a resourcepack for that.
oh even for .ogg?
Yes. Else how would the client get that file?
i thought there was a way to play it directly with some lib like music bots
Minecraft has no streaming functionality
yea maybe we could big brain mixin some of that into minecraft
I always think of Ace combat
No big brain needed. A simple mod will do.
true , but that wouldn't work for spigot servers
I once tinkered with proximity chat where the client would have to open a website in order to move on the server.
Then i added a heartbeat and cross-referenced the ip so the user needed to keep the website open.
Over this you could also play sounds and do server announcements etc.
Made a plugin that steamed audio from twitch, YouTube, and a lot of other sources into a website and discord bot that users could hear
is it working now pulse? unsure what the state of dev is
Just make a mod to do it 
how do i do a lambda as a consumer of a set again?
?
A lambda that consumes a set...
You mean forEach?
its just like
.accept( set -> {...});
set<BlockFace>
More info. What are you trying to do?
i think you have mis understood what a consumer is
Maybe he wants to pass a consumer to a forEach or something. Lets see what hes trying to do.
im still trying to prevent block state changes on mushrooms
speaking of consumers, imma get lunch
ollie.work().whenComplete(ollie::lunch)
if(shroom(event.getBlock().getType()) && shroom(event.getBlockAgainst().getType())){
new BukkitRunnable(){@Override public void run(){
MultipleFacing MF = (MultipleFacing) event.getBlock().getBlockData();
MF.getAllowedFaces().forEach(element -> MF.setFace(element, true));
}}.runTaskLater(instance,20);
}
long delay for testing only
mf lmao
i dont like this shroom method
it should be called something like isMushroomBlock or something
If it returns a boolean then it should be prepended with "is"
i will shroom you 💀
or "has"
but that seems fine no? i cant see anything syntactically wrong
havent checked it yet tho
time to wait an hour for 1.19 to launch
my game not the server
I dont think the BlockPlaceEvent is what you want to check...
im also cancelling block physics update but that does NOT cack
damn lag
does not catch all the tile state changes
it only works for the block that wasnt placed just now for some weird reason
hence this mess
i found the problem
class org.bukkit.craftbukkit.v1_19_R1.block.data.CraftBlockData cannot be cast to class org.bukkit.block.data.MultipleFacing
now what
check instance
Main branch works. I am doing development on a separate branch for some other stuff but yeah
instanceof fixes everything
true
ok cool 
can i somehow print out the exact class something is
Should you not be using java if (Tag.MUSHROOM_GROW_BLOCK.isTagged(event.getBlock().getType())) for mushrooms?
I've never played with Mushrooms so no idea
anyways printing out the class of an object?
.getClass()
hey is it possible to use regex to replace all numbers to the same number but with a color code? ANSI
not too sure on how to get the actual number from the regex
should i not be using replaceAll
isnt that just all instances
replaceall is such a poorly named method
replaceRegex
oy wait a moment
MultipleFacing is a subinterface of BlockData and mushroom blocks definitively have those multiple directional values
why cant i cast the block data of a mushroom block to multiple facing then
idfk
All Known Subinterfaces:
Fence, Fire, GlassPane, GlowLichen, SculkVein, Tripwire ```I don;t see mushrooms in there
aight
it said the result is ignored
i forgot thats what it meant
Lol
then do quick fixes
lmao
@SuppressWarnings("all")
that code looks very inefficiet
fr
that was me until i knew @SupressWarnings("ConstantConditions") was a thing 🥺
Result of 'String.replace()' is ignored
in my head i just like
THATs A THING
ok
i downloaded an intellij plugin
for that stupid warning
oh
best way to annoy those kids
[07:56:42 INFO]: Error: null
[07:56:42 WARN]: java.lang.NullPointerException
[07:56:42 WARN]: at java.util.regex.Matcher.getTextLength(Matcher.java:1283)
[07:56:42 WARN]: at java.util.regex.Matcher.reset(Matcher.java:309)
[07:56:42 WARN]: at java.util.regex.Matcher.<init>(Matcher.java:229)
[07:56:42 WARN]: at java.util.regex.Pattern.matcher(Pattern.java:1093)
[07:56:42 WARN]: at me.superischroma.spectaculation.util.SUtil.splitByWordAndLength(SUtil.java:179)
[07:56:42 WARN]: at me.superischroma.spectaculation.item.ItemLore.asBukkitLore(ItemLore.java:119)
[07:56:42 WARN]: at me.superischroma.spectaculation.item.SItem.<init>(SItem.java:55)
[07:56:42 WARN]: at me.superischroma.spectaculation.item.SItem.of(SItem.java:488)
[07:56:42 WARN]: at me.superischroma.spectaculation.item.SItem.of(SItem.java:499)
[07:56:42 WARN]: at me.superischroma.spectaculation.gui.ItemBrowserGUI.<init>(ItemBrowserGUI.java:109)
[07:56:42 WARN]: at me.superischroma.spectaculation.gui.ItemBrowserGUI.<init>(ItemBrowserGUI.java:136)
[07:56:42 WARN]: at me.superischroma.spectaculation.command.ItemBrowseCommand.run(ItemBrowseCommand.java:19)
[07:56:42 WARN]: at me.superischroma.spectaculation.command.SCommand$SECommand.execute(SCommand.java:76)
tf
?paste
paste code whats null
me.superischroma.spectaculation.util.SUtil.splitByWordAndLength(SUtil.java:179)
whats line 179
in?
i completely suck at regex, so could someone help me on how i would highlight this manually without hardcoding the colors? some replace regex would help. Basically the hard part for me is 'pink but if theres a pipe then cyan'
alr wait
lmao
ive currently hardcoded it
wat dat
hot
and my brain is slowly melting
okay anyways please i need spoonfeed
:):)):):)
regex is pain
String[] romans = new String[] { "I", "IV", "V", "IX", "X", "XL", "L",
"XC", "C", "CD", "D", "CM", "M" };
int[] ints = new int[] { 1, 4, 5, 9, 10, 40, 50, 90, 100, 400, 500,
900, 1000 };
for (int i = ints.length - 1; i >= 0; i--)```
🥄 
the roman part is 179
here you go
well that isnt causing an exception just show the whole method
why does everything i look up tell me that mushroom block data can be cast to FacingMultiple
😔
textcomponent is a basecomponent
cryinh
so just pass it in
deaths:
1:
- "/effect give #player# minecraft:speed 2 2 true"
2:
- "/give #player# minecraft:diamond 9"
i have this list
:'(
but the amount of numbers assigned in there
is random
how do i get the numbers
getintegerlist("deaths").length?
loop over config.getSection("deaths").getKeys(false) iirc
config
can i somehow run a method the instant an event is finished?
Mushrooms seem very odd in teh javadoc since the Mushroom class was deprecated
eg https://hub.spigotmc.org/javadocs/spigot/org/bukkit/Material.html#BROWN_MUSHROOM_BLOCK says its BlockData: MultipleFacingHowever https://hub.spigotmc.org/javadocs/spigot/org/bukkit/block/data/MultipleFacing.html has no reference to it
eh for some reason i can cast it i just cant tell it foreach
now im wondering how quickly after an event has finished i can call a method after it
rn im using a one second delayed runnable but maybe theres a better solution
you are simply trying to prevent placed mushroom blocks affecting their neighbors?
yes but as said
that already happens when i cancel blockphysicsupdate for those blocks
the issue is
placed blocks update themselves without calling blockphysicsupdate
hence this mess up there
MultipleFacing MF = (MultipleFacing) event.getBlock().getBlockData();
MF.setFace(BlockFace.UP,true);
MF.setFace(BlockFace.DOWN,true);
MF.setFace(BlockFace.SOUTH,true);
MF.setFace(BlockFace.NORTH,true);
MF.setFace(BlockFace.EAST,true);
MF.setFace(BlockFace.WEST,true);
event.getBlock().setBlockData(MF);```
does it cast fine?
yea
odd
but if i fire this before the event there might be issues
actually
lmc
huh
nevermind ig
progress!
lmao
oh well im stupid
well a for loop works too
id use a componentbuilder for the hoverable text stuff
player1 and text1 text2 ... are terrible variable names
I think you know that but dont remove the annotation. Keep the map encapsulated.
In most teams TODOs or FIXMEs are strictly forbidden because very often it will never get touched again after it works
I mean you can do "normal" forEach on a Map
my eyes have died a couple of times and so did my brain
Yes show us those lines
Bukkit.getOnlinePlayers().forEach(player1 -> player1.spigot().sendMessage(text,text1,text2,text3,toHoverableText(item),text4));
This garbage. Show us the rest
Just use a component builder and append them
7smile7 i wont lie
the way you text makes me think you're in a murderous mood
i dont exactly know what it is
it just makes me think you feel like committing several federal crimes
Maybe i should decorate my messages with more emotes 
yes
is there a javadocs with spigot api + bungee packages?
because https://hub.spigotmc.org/javadocs/bukkit/ does not have the bungee packages
package index
Bungee has a seperate javadoc
?jd
hi back guys I just wanna ask you if you understand what is wrong in my code plz for tempban, it doesn't work with months and years but the rest is okay
long time = 0;
int duration = Integer.parseInt(args[1]);
switch (args[2]){
case "s":
time = duration * 1000;
break;
case "m":
time = duration * 1000 * 60;
break;
case "h":
time = duration * 1000 * 60 * 60;
break;
case "d":
time = duration * 1000 * 60 * 60 * 24;
break;
case "w":
time = duration * 1000 * 60 * 60 * 24 * 7;
break;
case "mo":
time = duration * 1000 * 60 * 60 * 24 * 7 * 5;
break;
case "y":
time = duration * 1000 * 60 * 60 * 24 * 7 * 5 * 12;
break;
default:
sender.sendMessage(new TextComponent("§e/tempban §6[Joueur] [Temps] [Unité] [Raison]"));
}```
I'm bad with maths xD
?paste
Also java has time and date api you can use
Correct
should i use for loops or the bukkit scheduler
i read something about threads somewhere
They do different things
Well, I mean 7x5 = 35 days, when a month is 30
and 7x5x12 = 420 days a year
apart from that I cant see any issues
the for loop dispatches like 3-4 commands
you can set a delay instead of making a loop
Ah you mean async vs in-thread?
oh weird because even I ban 35 days it unban player directly
In that case, do it on the main thread - few commands can be handled async anyways
mate i have no clue
Did you offset things by the current time
What are you even doing
So it's not 35 days agter 1970
Line 67. Reader defConfigStream = new InputStreamReader(this.instance.getResource(this.fileName), StandardCharsets.UTF_8);
the ''getResource'' is being null why if filename not null?
@quiet ice i have a for loop that dispatches 4 commands
what is instance?
yes it works with the others after it's the same code
do i keep the for loop or use a runnable
Why would you need to do it async though?
JavaPlugin
Is the command that expensive?
its just an effect command
Just use the java date api it will make things easier
is it fine with teh for loop
and does the file exist within the jar?
why not apply the effect with api? 
because config
depends, but usually yes
mainConfig = new ConfigurationManager(this, "config.yml");
mainConfig.load();
themeConfig = new ConfigurationManager(this, "themes-config.yml");
themeConfig.load();
playerConfig = new ConfigurationManager(this, "players-config.yml");
playerConfig.load();```
?
That does not help at all
we need the compiled jar - after that everything would be explainable
this is inside from the jar
not it is not - this is the IDE view
and from looking at it the resources are not in the resources folder
ah well then
They aren't using maven or gradle ;/
not now
its eclipse i reckon
it is
intellij ide is so lag
get good pc idk jk
give me $ then i buy
@minor garnet what is the constructor of your ConfigManager class?
Just use paint IDE /s
it makes me this xD
paint?
Yes paint
You can just parse an input like 2w2d6h30m (2 Weeks, 2 Days, 6 Hours and 30 Minutes)
By using
public Duration parseDuration(String input) {
return Duration.parse("PT" + input);
}
Are you sure that it does not work?
why i getting null exception when i start xd?
You might have exported it wrongly
since when did java get good tf
okay thx !
Java 7 API
that was 7?!
wdym
I believe you might have left the left things unchecked
?
The older java date api isn't that bad either
geol and his love for eclipse...
And it has existed since Java 1.0
Depending on where you clicked for exporting you might not have exported it correctly at first
hence why you shouldn't use that window
Just try exporting it again and see if it works now
can you colour warden screams?
Also you don't need .project or .classpath in the jar
If it doesn't then yeah ... I might need to take a look at the entire stuff
ik
So why are you including them?
easier
?
when I export, I always press the enter key several times so I don't have to deselect it all the time to be faster for test plugin
I personally move the resource files in the src folder
dont work too
Then give me the project or compiled jar and I'll take a look at what might have gone wrong
because this is a bit strange
?jd-s unless
@minor garnet there is no config.yml file
One moment
@EventHandler
public void onChat(AsyncPlayerChatEvent event) {
Player player = event.getPlayer();
ItemStack handItem = player.getInventory().getItemInMainHand();
BaseComponent[] components = new ComponentBuilder()
.append(new ComponentBuilder("The player ").color(ChatColor.WHITE).create())
.append(new ComponentBuilder(player.getName()).color(ChatColor.GREEN).create())
.append(new ComponentBuilder(" has ").color(ChatColor.WHITE).create())
.append(toHoverableText(handItem))
.append(new ComponentBuilder(" in his hand.").retain(ComponentBuilder.FormatRetention.NONE).color(ChatColor.WHITE).create())
.create();
Bukkit.spigot().broadcast(components);
}
do yk how to set the spawn chance of a chicken from throwing an egg
Not sure. Isnt there a setting in the spigot.yml for this? Id have to check. Never tinkered with this.
in the server files
ye dont think its there
You cna control it in code https://hub.spigotmc.org/javadocs/spigot/org/bukkit/event/player/PlayerEggThrowEvent.html
https://hub.spigotmc.org/javadocs/bukkit/org/bukkit/event/player/PlayerEggThrowEvent.html
boolean isHatching()
void setHatching(boolean hatching)
You can change the rate manually with this event
declaration: package: org.bukkit.event.player, class: PlayerEggThrowEvent
yteaaa got it thanks
do I send the entire SUtil?
[09:18:30 INFO]: Error: null
[09:18:30 WARN]: java.lang.NullPointerException
[09:18:30 WARN]: at java.util.regex.Matcher.getTextLength(Matcher.java:1283)
[09:18:30 WARN]: at java.util.regex.Matcher.reset(Matcher.java:309)
[09:18:30 WARN]: at java.util.regex.Matcher.<init>(Matcher.java:229)
[09:18:30 WARN]: at java.util.regex.Pattern.matcher(Pattern.java:1093)
[09:18:30 WARN]: at me.superischroma.spectaculation.util.SUtil.splitByWordAndLength(SUtil.java:180)
[09:18:30 WARN]: at me.superischroma.spectaculation.item.ItemLore.asBukkitLore(ItemLore.java:119)
[09:18:30 WARN]: at me.superischroma.spectaculation.item.SItem.<init>(SItem.java:55)
[09:18:30 WARN]: at me.superischroma.spectaculation.item.SItem.of(SItem.java:488)
[09:18:30 WARN]: at me.superischroma.spectaculation.item.SItem.of(SItem.java:499)
[09:18:30 WARN]: at me.superischroma.spectaculation.gui.ItemBrowserGUI.<init>(ItemBrowserGUI.java:109)
[09:18:30 WARN]: at me.superischroma.spectaculation.gui.ItemBrowserGUI.<init>(ItemBrowserGUI.java:136)
[09:18:30 WARN]: at me.superischroma.spectaculation.command.ItemBrowseCommand.run(ItemBrowseCommand.java:19)
[09:18:30 WARN]: at me.superischroma.spectaculation.command.SCommand$SECommand.execute(SCommand.java:76)
guys
anyone help
pelase
?paste
your matcher is null I think
I got 3 different errors 3 different times
wdym
wait
does getWorld(UUID/String) return null if the world isnt loaded, but is listed in getWorlds() ?
an unloaded world will not be listed in getWorlds()
I got this once
this once
huh, i wonder why mine is saying null then but is in getWorlds()
and the error now
nvm, i was using the wrong index in command arguments....
if its in getWorlds() its loaded. It may have no chunks loaded, but the world is
yo cool plugin
maybe i should go back to bed bc in the 5 minutes it took me to write the command class ive made like 4 mistakes already
fucked up getting the world, messed up the tab completion..
Is there any event for player holding down LMB?
?jd-s for myself
no
?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.
😎
is there code to tell the client to not cull textures touching a specific block?
is it part of the texture files or hard coded then?
bc if its a texture thing i can just add that to a resource pack
No clue, I'm only guessing
Is there a way to get all @undone axle commands like ?notworking please ?
?help
selfrole Add or remove a selfrole from yourself.
cleanup Base command for deleting messages.
embedset Commands for toggling embeds on or off.
info Shows info about CafeBabe.
licenseinfo Get info about Red's licenses.
mydata Commands which interact with the data CafeBabe has about...
set Commands for changing CafeBabe's settings.
uptime Shows CafeBabe's uptime.
findcog Find which cog a command comes from.
names Show previous names and nicknames of a member.
userinfo Show information about a member.
listcases List cases for the specified member.
reason Specify a reason for a modlog case.
permissions Command permission management tools.
?help
selfrole Add or remove a selfrole from yourself.
cleanup Base command for deleting messages.
embedset Commands for toggling embeds on or off.
info Shows info about CafeBabe.
licenseinfo Get info about Red's licenses.
mydata Commands which interact with the data CafeBabe has about...
set Commands for changing CafeBabe's settings.
uptime Shows CafeBabe's uptime.
findcog Find which cog a command comes from.
names Show previous names and nicknames of a member.
userinfo Show information about a member.
listcases List cases for the specified member.
reason Specify a reason for a modlog case.
permissions Command permission management tools.
😮
xd
I have been up for: 25 days, 15 hours, 48 minutes, 24 seconds (since <t:1655244445:f>)
?kick
Syntax: ?kick <member> [reason]
Examples:
?kick 428675506947227648 wanted to be kicked.
This will kick the user with ID 428675506947227648 from the server.?kick @Twentysix wanted to be kicked.
This will kick Twentysix from the server.
If a reason is specified, it will be the reason that shows up
in the audit log.
Works as per usual
I know
What's the command for guys just saying "i have a problem, please help" without explaining what it is ?
?xy
Asking about your attempted solution rather than your actual problem
Oh ty, didn't know this
?ask
If you have a question, please just ask it. Don't look for staff or topic experts. Don't ask to ask or ask if people are awake or available. Just ask the question to the channel straight out, and wait patiently for a reply. Make sure you use the right channel regarding the topic of your question. Create a thread in case the channel is already in use!
?info
md_5#0001
This bot is an instance of Red, an open source Discord bot created by Twentysix and improved by many.
Red is backed by a passionate community who contributes and creates content for everyone to enjoy. Join us today and help us improve!
(c) Cog Creators
well w/e
does entity#setTarget make the entity angry towards the target (resulting in the entity damaging the target?)
Why are my particles shooting randomly to every direction?
Vector direction = p.getEyeLocation().getDirection();
double velocity = 2.5;
w.spawnParticle(Particle.FLAME, rightHand.getX(), rightHand.getY(), rightHand.getZ(), 5, (float) direction.getX(), (float) direction.getY(), (float) direction.getZ(),velocity , null);
set teh speed value
reduce the speed, its too high
velocity = 1
0 = don;t move from where they spawn
well I want them to move forward and create sort of a cloud
are they moving from spawning or are they spawning in random locations around?
looks like they be random spawning
therefore I need to redo my calculator for RightHand location
can someone help me with this item amount code. like i wanna know exactly what to add to this part. like i want to code how to check if something is a number and if not i want to send a error
speed controls how fast they move/how far they move
then set your offsets to 0
offsets are the random distance from center they can spawn
int amount = Integer.parseInt(args[1]); Material item = Material.getMaterial(args[0].toUpperCase()); if (item != null) { Inventory inv = ((Player) sender).getInventory(); inv.addItem(new ItemStack(item, amount)); player.sendMessage(prefix + "§a+ §6" + item + "§9 " + amount); } else { player.sendMessage(prefix + "§cThis is either not a minecraft item or you wrote it wrong!"); player.playSound(player.getLocation(), Sound.BLOCK_ANVIL_LAND, 0.5F, 2); }this is the code
works fine now
I just want to shoot them forward to where player is looking and create sort of cloud out of them
Surround the parseInt with a try catch
if i do return config.getInt("path_that_doesnt_exist") will it return 0 or null?
int can't be null
therefore 0
epic
if (NumberUtils.isParsable(args[0])) {```
where would i put it? if thats not a stupid question
currently its saying like isparsable is not a thing
if (NumberUtils.isParsable(args[0])) {
int amount = NumberUtils.toInt(args[0]);
// code here
}```Apache commons lib
oh
you might have to include it as a dev dependency as it will be present at runtime but your ide doesnt know that
i am coding with paperspigot mc thingy
I do Spigot only
Given that you are parsing the int either way, it makes more sense to try-catch it
Also, paperspigot is dead
PaperMC is the real deal
i did Paper or something
(If you say that you are using paperspigot you are implying that you are using an ancient version (1.8 or earlier iirc) of paper, which lowers the chances of getting help even more)
then i am using papermc
whatever, paper should not remove any dependencies included in spigot
i think they update some, but thats about as much yea
i use maven
Not for long hwoever
Planned Removal of commons-lang
As foreshadowed with the 1.18 release, commons-lang has now been removed from the API. Plugins will not yet be broken as it is still included with the server, however it will eventually be removed in a future release. Please consider switching to Google Guava (which is a supported bundled API) or using your own copy of the much more recent commons-lang3.
I guess you could guava it. but currently Spigot includes Apache Commons Lang 3
Or actually you cannot use it anymore if you are binding against 1.19
i am trying to figure out how to install apache
apache what?
i thought i heard someone say something with apache
commons-lang?
Apache is an organisation that holds a lot of projects ranging from the well known apache webserver to maven
try {
int parsed = Integer.parseInt(string);
// Normal flow - (valid number)
} catch (NumberFormatException e) {
// Complain about invalid number, etc.
}
would be another (albeit a bit more convoluted) way of doing that
And well someone is going to post that annoying image if you need to parse a lot of numbers
would it help if i just share the entire code or? else i might just take a break cause i feel like i am not understanding something very easy
?paste to share anything
Int? parsed = input.toIntOrNull()
😄
There is a lot of cursed stuff in the paste code lol
One of the first things being casting to Player directly
ok first off...
- This is a registered CommandExecutor. You don't need to check what command was entered.
- add the permission to use the command on the plugin.yml and you no longer need to check permissions in code.
I wanna take a hatchet and split this code up into many many smaller methods.
also you shoudl be using import org.apache.commons.lang3.math.NumberUtils;If you are using Lang3 from the Maven link I gave you
(you would need to add it as a library in the plugin.yml eventually however)
It’s provided I’m pretty sure
yeah, though subject for removal
I think that commons lang will be removed, not commons lang 3
cleaner way of parsing args```java
switch (args.length) {
case 0 -> { /* code here */ }
case 1 -> { /* code here */ }
case 2 -> { /* code here */ }
default -> { /* code here for anythign not covered */ }
}```
The home of Spigot a high performance, no lag customized CraftBukkit Minecraft server API, and BungeeCord, the cloud server proxy.
Commons Lang 3 is fine
Commons Lang is subject to removal
yep seems like that
btw i really appreciate you guys helping me while i have such a brain storm
A bit strange that it isn't exposed via the spigot-api
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
doesn't spigot use guava now
API is not shaded
Guava was always there
Hey, I'm old too!
How old
I need access to the 1.19 client jar but it refuses to generate
versions/1.19 folder
very
old enough I can nearly draw a pension
Lmao
I feel like Spigot discord is filled with 12 year old kids and also boomers
No in between
very true
Seems about right
You can also do something cursed like this:
private final Map<Integer, BiFunction<CommandSender, String[], Boolean>> handlers = new HashMap<>() {{
this.put(0, YourCommand.this::handleNoArg);
this.put(1, YourCommand.this::handleOneArg);
this.put(2, YourCommand.this::handleTwoArg);
}};
private boolean fallback(CommandSender sender, String[] args) {
}
private boolean handleNoArg(CommandSender sender, String[] args) {
}
private boolean handleOneArg(CommandSender sender, String[] args) {
}
private boolean handleTwoArg(CommandSender sender, String[] args) {
}
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
return handlers.getOrDefault(args.length, this::fallback).apply(sender, args);
}
lol
^ ?
Does anyone know when the gson provided by the server was updated to 2.8.2?
between 1.17.1 and 1.18
Map<Integer, BiFunction<CommandSender, String[], Boolean>> i want to vomit... so many types
(unless there is a mismatch between api and server)
Pft, BiFunction<CommandSender, String[], Boolean> is much cleaner than BiPredicate<CommandSender, String[]>
thank you
Except a Function returns a boolean wrapper, whereas a predicate returns the primitive
Also also, Map.of(). Doing that {{}} trick is a horrible hack
Or at the bare minimum, use a map builder. There are a couple provided in Guava and Apache Commons
The {{}} hack creates an anonymous type of HashMap which isn't ideal. You're bound to get yourself into trouble doing that
I wish articles and tutorials would stop showing that method
ImmutableMap.Builder is a good one (aslong as you dont need to modify the map)
If you are using legacy versions 💀
yep
thx
Iterator<Map.Entry<K, RemoveQuery<K>>> hehe :)
i love Java
wtf
and that people is why I rarely use annotations
This is why I hate command libs that have annotation spam
empire minecraft? 
(except for NotNull/NonNull, Nullable, Contract, etc.)
spring
still used so much
like 50 char long class names
spring weird
I’m fine with it
Spring has a reason to use annotations tho cause it’s huge anyways
I don’t like seeing annotation spam in command libraries because it’s just a plugin
Yea thats true
i love the acf wiki, it just told me look at this and figure it out ._.
anyone know how i can retrieve command aliases from config? (bungeecord plugin)
doing this doesnt work and i dont really know how else i can do it
Quarkus > MicroNaut > Spring
Super must be first method
config.getStringList ig
how would I go on about making a plugin where randomly throughout the time a message in chat appears displaying a random equation and the first player's chat that is correct wins ?
Doesn’t match super constructor
Just use streams to convert it into an array
So guys, i need to add all elements of X array to Y array (Y array is empty, basically making Y a clone of X)
so i m gonna use this
for(int i = 0; i < x.length; i++) y[i] = x[i]
😌
Or that I guess lol
For that i would recommend the crunch library from @waxen plinth
But this sounds like a small plugin. Should be really easy.
System#arraycopy
lol
also, why x++
oh yea
We aren't doing C here
it just tells me to wrap it in a string.valueof
uh well what does it expect from parameter
btw does anyone know any open source spigot library/util stuff that look forward to contributions?
String... ig then
Yea
my lib
Pls
send link 🔫
I have one that could use some contributors
I wouldn't call it a small one lol. I thought someone'd give me guide how to do that (not spoonfeed me)
send link 🔫 x2
Vault to some degree
too complex for me xd
its expecting a string thats why
Vault 2.0 is going to be a thing, and it's best to engage in that now
this as well is a bit complex for me
std::copy(std::begin(arr1), std::end(arr1), std::back_inserter(arr2));
Beuhhhh
holy sheesh C++ is so secksy
It's a command processing library that has a mostly-finished core but needs a lot of other stuff to be ready
u dont have any issues?
No cause I'm solo lol
https://github.com/Redempt/Ordinate/issues
more empty than my "girls that like me" list
I want to convert all the super long constants into a JSON file
I have https://github.com/Geolykt/Presence/blob/main/src/main/java/de/geolykt/presence/common/util/RegionatedIntIntToObjectMap.java this thing that would need better testing before I spin it off to a seperate library, but I guess that is too advanced for you too
Speaking of which you heard about DeluxeChat correct?
(though I would need to have some solution that doesn't have terribly shit iteration time)
That's because my code has no issues, it is flawless
The only flaw is that there isn't enough of it
There is a upcoming DeluxeChat 2.0 called ChatChat which is open source and made from HelpChat
sigma dev is what they call him
ok this is fun i might add to this
what is this?
A rewrite of DeluxeChat (which was premium and closed source) which is OS
And also by hc
i did some testing and this works
super("hub", "slashhub.use", new String[]{"1", "2"});```
but i cant do this
```java
super("hub", "slashhub.use", new String[]{String.valueOf(config.getStringList("CommandAliases"))});```
probably becuase you're converting a list to a single string, and then making an array out of that single string
String.valueOf(List<String>) makes sense that you cant do that
if i try to put it in without string.valueof it gives me an error
i'd rather take a string list as parameter instead of an array in this case tbh
Why would you use string valueOf here
are you even trying to understand what you're writing
Doesn’t make sense
i have absolutely no idea what im doing
well smth else: are jdbc resultsets and statements closed when the connection they share is closed?
ill do some more digging
depends on the impl says stackoverflow
Well yes
They are basically invalid at that point
but they can still lead to memory leaks?
Idr exactly how the implementation was but it’s always smart to use auto closables with try-with-resources
But if I’d guess, once you close the connection that should also stop resource consumption of statements and result sets etc
nevermind im a complete idiot
i need to convert it from a list to an array
developer moment
or you write constructors that accepts both
bungee api
With crunch i would simply create a class like this:
public class SolvableExpression {
@Getter
private final String readable;
private final double epsilon;
private final double result;
public SolvableExpression(String input, double epsilon) {
this.readable = input;
this.epsilon = epsilon;
CompiledExpression expression = Crunch.compileExpression(input);
this.result = expression.evaluate();
}
public boolean isResult(String input) {
return (input.equals("true") ? OptionalDouble.of(1.0) : input.equals("false") ? OptionalDouble.of(0.0) : safeParse(input))
.stream()
.mapToObj(out -> Math.abs(out - result) < epsilon)
.findAny()
.orElse(false);
}
private OptionalDouble safeParse(String input) {
try {
return OptionalDouble.of(Double.parseDouble(input));
} catch (NumberFormatException exception) {
return OptionalDouble.empty();
}
}
}
And then get a bunch of expressions from a config file and randomly cycle through them.
Then listen for the chat event and check if the input solves the currently active SolvableExpression.
Any idea how to create particle cloud?
so I can make something like this?
aren't there fire particles u cud prob combine cloud and fire particle to make fancy thing
Does it have to be a cone or do you just want a random cloud?
random cloud
but cone will do if its easier
You can give fire particles a direction
ye ikr but there would be gaps between them
Or you just spawn them with a random xyz offset
Yes of course there would be gaps...
my current setup is lines of fire going from location of my hand
Just add a random offset
w.spawnParticle(Particle.FLAME, rightHand.getX(), rightHand.getY(), rightHand.getZ(), 0, direction.getX(), direction.getY(), direction.getZ(),velocity , null);
Ok so this is the directed approach. In order to form a cone you would have to add random angles to your direction.
would Random with bounds do?
XD using random without bounds would be wild.
i would start at 20°
And show us how you doing this. Because i dont think spigot has good methods to achieve this
what if I would do for loop going to 10 and it would up X,Y,Z by X + Math.PI*i ?
but that would go up to 31 degrees..
imma try this and then go try that Random method
for(int i = 0;i==20;i++){
double x = direction.getX() + Math.PI*i;
double y = direction.getY() + Math.PI*i;
double z = direction.getZ() + Math.PI*i;
w.spawnParticle(Particle.FLAME, rightHand.getX(), rightHand.getY(), rightHand.getZ(), 0, x, y, z, velocity, null);
}
Well... This is some randomly assembled math. Did you just throw PI in there and hoped it would turn out trigenometric somehow?
ye :DD
good philosophy
if you throw pi at it, there is a slight chance it may look circular
creates sort of cone but in sky
imma try adding those random values to direction
You need to generate random angles in 2 dimensions (pitch & yaw) but with your forward vector as origin.
Random random = new Random();
double x = random.nextDouble(20) + direction.getX();
double y = random.nextDouble(20) + direction.getY();
double z = random.nextDouble(20) + direction.getZ();
w.spawnParticle(Particle.FLAME, rightHand.getX(), rightHand.getY(), rightHand.getZ(), 0, x, y, z, velocity, null);
no particles in sight
ooh so just setting pitch/yaw
This draws a circle on the floor, just change it to vertical and expand out in a direction.```java
private void drawCircle(Location loc, float radius) {
for (float r = 0.1f; r < radius; r += 0.1f) {
for (double t = 0; t < radius * 25; t += 0.5) {
float x = r * (float) Math.sin(t);
float z = r * (float) Math.cos(t);
loc.getWorld().spawnParticle(Particle.REDSTONE,
loc.clone().add(x, 0.5, z), 1,
new Particle.DustOptions(Color.PURPLE, 1));
}
}
}```
thx
public void randomAngleOffset(Vector vector, double limit) {
ThreadLocalRandom random = ThreadLocalRandom.current();
vector.rotateAroundX(random.nextDouble(-limit, limit));
vector.rotateAroundY(random.nextDouble(-limit, limit));
vector.rotateAroundZ(random.nextDouble(-limit, limit));
}
Try this one. Might work. Might be fked.
not sure if I followed it correctly but this does nothing:
for(int i = 0;i==20;i++){
Vector dir = direction.clone();
UtilManager.randomAngleOffset(dir,20);
double x = dir.getX();
double y = dir.getY();
double z = dir.getZ();
w.spawnParticle(Particle.FLAME, rightHand.getX(), rightHand.getY(), rightHand.getZ(), 0, x, y, z, velocity, null);
}
?ask
If you have a question, please just ask it. Don't look for staff or topic experts. Don't ask to ask or ask if people are awake or available. Just ask the question to the channel straight out, and wait patiently for a reply. Make sure you use the right channel regarding the topic of your question. Create a thread in case the channel is already in use!
is there any packet sent to the server when the client clicks in the "done" button of a book?
I'd assume there is as there is https://hub.spigotmc.org/javadocs/spigot/org/bukkit/event/player/PlayerEditBookEvent.html
Hello ! I have question about #getName of Inventory in 1.19. It's disappeared ?
Hi! I have a little question... How I create a custom TabList in Spigot 1.12.2?
inventories dont have names. You can get the name via the InventoryView.
PS: Dont detect custom inventories by name. Bad practice.
i believe using .equals is the proper practice ^
Ok :x How can i get custom inventries with good practice ?
By sending packets. Take a look at the protocol on wiki.vg
right, thx ^^
Put them in a data structure. Inventory implements both equals and hashCode.
Ok ok thx
and how to send pkgs?
If you are fixed on 1.12.2 and are never going to update: Just use nms
If you want multi version support: Use ProtocolLib
i still cannot find out a way to make it so i can give a error message if a item amount isn't a number
could anyone add the part of the code to make it like that and maybe ill find out why it works. i am usually good at that
I need context for that... an item amount is always a number
yeah so like for example if i put a letter instead of a number
depends
we gave you at least two ways to detect if its a number
it gives me like a server error but i want to do a custom error and not a malfuction
then catch the error?
int number = 1;
try {
number = Integer.parseInt(args[0]);
}catch(NumberFormationException e){
// ignore
}```
You've legti been spoonfed like 2 times already lmfao
try-catch is a powerfull tool
In the scheduleSyncRepeatingTask arg2 and arg3 what are for?
okay that might help me
ignore me essentially copy pasting what someone put earlier lmfao
(JavaPlugin, Runnable, InitialDelay, RepeatedDelay)
Is there any project idea links do you have?
10ms for start and repeat per 50ms?
Read javadocs