#help-development
1 messages · Page 746 of 1
what do u need an array for
oh my bad
techincally I don't need an array but I have everything else (like saving) already set up to use an array
so i thought it would be easy to just load one
If you are on an old version int[]::new won’t work
int::new (in intellij) causes
Required type:
IntFunction
<java.lang.Object[]>
Provided:
<method reference>
reason: no instance(s) of type variable(s) T exist so that T[] conforms to int[]
You’d need new int[0]
Cannot resolve method 'toArray(int[])'
Blah it’s probably wrapper annoyance
ok ill try it
Try .stream().mapToInt(Integer::intValue).toArray()
how can i check an offline players permisson
cause when i checked on the spigot forum it said hasPermisson should work
but it doesnt
i have 8 database tables in this plugin already might at this point just add another one
thx though
Hey. It seems that after 1.20.2 something has changed with GameProfile? I'm receiving Profile name must not be null error now when trying to create custom skull from base64 value.
Oh geez
Use the api plz
?customhead
?heads
Dangit
Spigot 1.18.1 added the new PlayerProfiles class, which finally allows us to use custom heads without needing any reflection! You can obtain them as normal items, or actually place them down into the world. I’ll show you how both works: Creating a new PlayerProfile First, we gotta create a new PlayerProfile object. To do so,...
This is not a Spigot-related question but I think somebody could help me. I'm quite new to webdev and I want to create this fixed footer, but the problem that I have is that the content gets under the footer. I want to set the margin-top of the footer to be equal to its height, because the height should depend on the content of the footer, but that does not seem possible?
<div class="content">
Lorem placeholder
</div>
<div class="flex ch-footer bg-black w-full fixed bottom-0">
<span class="text-white">ABC</span>
</div>
Just add margin-bottom to the content
margin-top on fixed footer wouldn't do anything
Oh that makes more sense yeah, but wouldn't it still need to depend on the height of the footer? Because if I set a concrete margin-bottom to content and the footer happens to become really large, it'll break again
If you're using fixed footer, most likely it will be cases when content hides behind it. Either don't use fixed, or use JS to calc footer height and apply margin to content automaticly
I'll probably do the calculated solution, thx 🙂
is there a way to fetch the name of a player from uuid with bungeecord?
yeah but they removed it
ok yeah that work thanks
Is there a pre-made system (like chatstream) to create a menu in the chat with buttons? I just want to display a list of file names with forward and back buttons to scroll through the list…
Can you play a specific cave sound to players?
yea but it only includes cave_ambiance
the specific ambiance seems randomly selected
Hi, do you know how we display a message in the chat with an image on the left and the text on the right of the image, I see that often but I can't find anything on the internet (it's a bit mmorpg style)
I cant modify Advancements right?
this is spigot
how can I check if the player's inventory is open "naturally" or through a command?
You can't
dem
There's no InventoryOpenEvent fired for the players inventory
i mean when he open some menu or open chest inventory
Ah
Generally custom menus have a null inventory holder
Or a custom one if they are abusing the holder system
Generally <<-
hmm, that's a risky plan
but
i not have choice
or create whiteList and add name
Inventory
it would be great if you could get the owner of the inventory
but how i undestand i not can do this
That's basically what the holder is
i mean check type
I mean you technically can implement a custom inventory holder for your plugin
be assured tho, all of spigot maintainer team will look at you in disgust and sadness
lol
Hence this :p
sometimes you gotta do terrible things
(or just throw the inv instance in a map/set)
(or the view)
i think i just use inventoryName for whiteList
Why? I implement all my custom guis with one custom gui holder that parses a click to the corresponding onGUIClick sub class
Because getHolder is slow
because you may not implement API types
And it was never meant for this
getHolder is meh if you take the snapshot
I saw it on a spigot forum post and it seemed simple
Well, thing is, on spigot getHolder yields a snapshot of the holder
😔
if you call it on a chest with a shit load of items, all of them are cloned into the snapshot
which can be a lot for a lot of players clicking
ok fair point
bro not do this pls
We really need to clarify that you shouldn't make custom holders via the api
I mean, this becomes a lot faster with getHolder(false) on paper but like
you can literally just keep a reference to the inventory somewhere
You wanna upstream that?
not my patch
why getHolder slow
^
wouldn#t fix this either
you should still not implement it
¯_(ツ)_/¯
Yeah we should APIStatus.Internal it or something
I wonder if there is a somewhat sensible way to implement PersistentDataHolder on Inventories
I am using paper but what do you mean with refecerence somewhere? Right now I jsut have one handler for all guis and thats super simple is there a way I can achieve it like a custom Inventory class?
Why is it not documented on the API that it copies it?
yea this will be cool
Fully doable just kinda weird
Since it implies some kind of persitance, but inventories aren't persistent
Well
you could implement it somewhat on inventories I guess
Entity inventories could go into the entity NBT
So how do you guys do it? Do you check the name of the inventory or what?
block entity ones into the block entity
wait inventory has hashCode)))
and well, createInventory ones are persistent until the object is removed
which is the same for all PDHs
Time for just a DataHolder class
sponge time
It's like PersistantDataHolder just without the persistant
sounds like my brain
yay maps
What is the view again? If I have a different Inv for each Team for example its 4 different views?
The bukkit logger does not log fine, finer and finest. Is there a way to turn this on?
View is created when Player#openInventory is run
For example in some custom inventories I create new ones on certain clicks and reopen...but then I would need views per player or what?
What about a custom inventory type? Or is that also bad xD
what's the difference in bukkit command api between label and command name?
Command name is always the base name
this is in terms of events
but what about inside Command class
there's setLabel()
well i use hashCode in inventory for maps
Might work
that would just change the label passed id guess
from what i understand .getLabel() can either return fallback command name (plugin:commandname) or just plain (commandname) if there were no conflicts
basically getLabel() returns the command name which was registered properly
either commandname or plugin:commandname if there were conflicts
god i love paperweight
you just open source code straight from ide and look at it
but what is the point of this variable lol
why cant you just do return true at the back
presumably it was set a while ago
and the set was removed
that is usually how you end up getting these things 😂
lynx seems like the kind of person to know a lot of java related pickup lines
I have 0 game
just becauseyou dont have anyone doesnt mean you dont know java related pickup lines
yes, but it can still detect it as a player inventory type
in inventoryclickevent, thus why it exists
you cant open player inventory but you can manipulate it
should detect it afaik
how would the server would know in that case where items are in the player inventory are if client doesnt send any packets related to clicking the player inventory
what will be if i creative this inventoryType and add holder
i can monipulate with armor player?
create
you cant create player inventory
it would probably default to chest one
too bad bukkit api doesnt have compile time some kind of constraint of not building code for these types of situations
bukkit api is very old, thus some inconsistencies exist
nah, craftbukkit is updated daily
that's not bad
overall design of an api is outdated
i would love for a large scale api rewrite but it would be way too much work to retain compat for everything
but if someone would replace something in bukkit api, there would be screaming monsters like: FIX YOUR PLUGIN, DO NOT WERK ON 1.20, 1 STAR YOU'RE THE WORST
bukkit api is basically in windows situation
cant update properly due to backwards compatibility
What's up with entities?
he probably mentioned entities because of pathfinding
imo the worst parts of the bukkit api are command api and configuration api
although configuration api did got some fresh coat of paint recently (by finally allowing comments on yaml configuration files to exist)
What's wrong with the spawning system
If only that was being worked on
:p
Not our fault that outdated api is... outdated
I know some ppl that complain about complexity regarding contributing :c
You can always do a feature request
Myea
Hello I would like to use MongoDB in my plugin and I have already read the forum post about it but unfortunately it still does not work https://www.spigotmc.org/wiki/using-mongodb/
I use Maven
<dependency>
<groupId>org.mongodb</groupId>
<artifactId>mongodb-driver-sync</artifactId>
<version>4.11.0</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.mongodb</groupId>
<artifactId>mongodb-driver-core</artifactId>
<version>4.11.0</version>
<scope>compile</scope>
</dependency>
Connection
private void Connection(){
MongoClient mongoClient = MongoClients.create("mongodb://user:passwort@147.189.175.136:27017/?authMechanism=DEFAULT&authSource=db");
MongoDatabase database = mongoClient.getDatabase("playtime");
MongoCollection<Document> col = database.getCollection("data");
System.out.print(col.countDocuments());
}
Error
https://pastebin.com/vcwHv7gj
I have in the libraries folder the
mongodb-driver-sync-4.11.0.jar
mongodb-driver-core-4.11.0.jar
and still it does not work
I have also tried
I also added the drivers to my project
Translated with www.DeepL.com/Translator (free version)
The home of Spigot a high performance, no lag customized CraftBukkit Minecraft server API, and BungeeCord, the cloud server proxy.
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
oh
and how
i cant finde the maven compile settings
IntelliJ IDEA
Run -> Edit configuration open this WIndows
oh demm so many inventoryHolder impl
I can not find the command for it online
its crazy to think that we have terabytes of data storage rn, but for a code we max out at 1GB at worst
Game assets
Do you mean Build -> Build Artifacts -> Build?
The graphics take a lot
the big green play button next to selected run config
merged command categories 
why ChiseledBookshelf - has inventoryHolder?
ok i have start it
you can put books in it
so you would want to see the content
i play minecraft 7 years wth bruh
i play since beta 1.8
12 years
lool
ohh nooo this not exists in 1.16.5
1.20 feature
can you use chiseled bookshelves for enchanting rooms?
but it still does not work
honestly idk
probably not id guess
No
hi whats the gradle (kts) depenticy to include nms / bukkit
for mojmaps there isnt one
for obsfucated just run buildtools and change spigot-api to spigot
i got
plugins {
id("java")
}
group = "org.livid"
version = "1.0-SNAPSHOT"
repositories {
mavenCentral()
mavenLocal()
maven("https://hub.spigotmc.org/nexus/content/repositories/snapshots/")
}
dependencies {
compileOnly("org.spigotmc:spigot:1.20.2-R0.1-SNAPSHOT") // The full Spigot server with no shadowing. Requires mavenLocal.
}
That great little exchange between Patrick Bateman and his Lawyer, as with a lot of the crap on my channel, couldn't find it anywhere else, so here it is.
Movie is American Psycho, 2000.
yes
with apiworks, without it
it's not found
i just saw you can also check if a user has a permisson using lp anyone know how it works im too stupid
how do i get the goalselector of a existing entity zombie.getHandle().?
get the lp user and check methods
u think i can do user.getNodes.contains...
?
probably
arlight th
Epic testing i realize that == is not correct for inventores. I did it with equals and there no problem they are found correctly
it is merely a problem in older minecraft versions
Okay that mkes sense know
umm i found documentation or bukkit api implementation bug
report it on jira or check for already existing bugs
?
according to documentation if there was a conflict between two commands which were registered within the same plugin (2 commands with the same name), it should be /foo:foo:mycommand and for another one /foo:mycommand
in reality its only one which gets prepended
cast to craft zombie, call get handle then check the obsfucated names
?mappings
Compare different mappings with this website: https://mappings.cephx.dev
i don't know the mapping
i tried entity.getHandle().PathfinderGoalSelector but No matching non-static field: EntityZombie#PathfinderGoalSelector
so use the link the bot just sent you
I believe it's just getGoalSelector
I really hope you aren't in an obfuscated environment because that would be a pain to work with
?nms
i am
but i'm just trying to find to the field name
https://paste.md-5.net/acabikuqow.css
This is inside a protocollib asynch MAP_CHUNK packet listener. In theory it should prevent the loading of a tile entity and it works. My question is how to modify it, to let only close tile entites load
If you just want to see the obfuscated name then use the link that Ebic sent
Zombie extends Monster and Monster extends PathfinderMob
I wish that mappings site showed all extensions and implementations of interfaces and classes
yeah
that'd be cool as hell i can see how that'd be a lot of work though
parchmant kinda adds javadocs but no site for that
I wish parchment did have a site that'd be cool
omg
Now why are you working in an unmapped environment
anyone know
Just use mappings?
I might kinda try and setup some sort of better page like that for my next javafx projcet
why trying to import textcomponent throws this: https://cdn.discordapp.com/attachments/475415047078936586/1163149165862338712/image.png?ex=653e8613&is=652c1113&hm=1754c4b3c158313ac5058cb7c81a1c41846bf09a3ea695f812e7b3911429388a&
(I'm staying away from the web) thank you very much
?paper
ur using paper
?fork
SpigotMC maintains the Spigot server. If you are using a fork of Spigot (such as Paper, Airplane, Purpur, or other derivative works), you should seek support in the appropriate Discord servers.
hi can anyone help me ? i want to add a custom texture for my items in my plugin can someone help?
please
?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!
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!
Perhaps reading the documentation may bring you the answer: Hint: use Adventure. If you need to keep spigot compat then why the hell are you compiling against paper?
Where am i momment
@EventHandler
public void onChat(net.md_5.bungee.api.event.ChatEvent event) {
ProxiedPlayer player = (ProxiedPlayer) event.getSender();
if (!module.getBanManager().isMuted(player.getUniqueId())) return;
event.setCancelled(true);
player.sendMessage("§cDu wurdest aus dem Chat gebannt. §cGrund: §e" + module.getBanManager().translateReason(module.getBanManager().banReason(player.getUniqueId(), false)));
player.sendMessage("§aVerbliebene Zeit: " + formatTime(module.getBanManager().getRemainingTime(player.getUniqueId(), false)));
}
``` why does it kick me when I remove the mute for: Received chat packet with missing or invalid signature.
Please for.long code use paste md5
https://paste.md-5.net/otaxalijah.java, why is the throwed potion an water bottle ?
I looked up on google everybody seems to do it like that
qq, whenever i start IntelliJ up these days i get a low memory warning, but my memory's like 16 GB free?
it cant possibly need that much
no like
i have 32 GB, and my system is using maybe 8 idle
Mines directly doesnt open i dont assign 32gb
how do you assign memory to programms directly then?
brah its less than 1 GB on both
Do you remember ny issue with typing?
wasnt here for that
Me having a r 7 5800x and 128gb, doesnt open if i don't assign 32gb to it
So 6G
that'd do it
If want megas 1024M = 1G
1g 8g should be fine
What?
for xms and xmx
I just put
32G 32G
yea that aint gonna be possible on me
Haha, actually coding a platform independent library
Males sense jajaja
It doesnt catch it
That happen Even me with 32G assigned to IJ
Just don't Open it
Ir doesnt crash anymore @last temple ?
Lol mine still and i assigned 32G but same shit
Where is the best place to learn java?
Ryzen 7 5800x
Well there many sites
Aires?
?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.
Do you know any ones specifically or anything you can recommend?
Those are the one which spiot recommend
Ty
Mainly courses not by videos
Because in videos You don't learn that the truth, You just use what he tells and nothing else. Is like cooy pasting
No problem just feel free yo ask
Maybe there are easier info i Will have to look at it
I find them i Will make you know. Emjoy learning and most important rule, programming learning is progresive
You won't learn from day
To night
what is the particle limit
??
ive been messing around with spawning particles
@EventHandler
public void onChat(net.md_5.bungee.api.event.ChatEvent event) {
ProxiedPlayer player = (ProxiedPlayer) event.getSender();
if (!module.getBanManager().isMuted(player.getUniqueId())) return;
event.setCancelled(true);
player.sendMessage("§cDu wurdest aus dem Chat gebannt. §cGrund: §e" + module.getBanManager().translateReason(module.getBanManager().banReason(player.getUniqueId(), false)));
player.sendMessage("§aVerbliebene Zeit: " + formatTime(module.getBanManager().getRemainingTime(player.getUniqueId(), false)));
}
``` why does it kick me when I remove the mute for: Received chat packet with missing or invalid signature.
when i get past a certain amount they flicker
Oh okay
It had happen to me too. Don't remember how to fix it
Have u try asking GPT he most of the time he know the solution
Sadly altered messages etc are not signed so you gotta turn off the ensurage thingy
where?
server.properties
it is allready off
That is fixed enforcing online mode
No other solution sorry
so i basicly can not filter messages?
yes and check if hes allready muted
not via packets its bungeecord
Doesnt have a chat event
Get the text component, them the text
is there a faster way to spawn particles than with the bukkit api
And apply regex
yo is there anyway i can set some custom keybinds for some events in my code?
like X,Z keybinds and stuff
No
ok
If you mean whether you can listen to keybinds sent by players, then no
ah damn...
server doesnt know what client keybind runs
ok
You can listen to keybinds that actually do something, e.g. you can detect pressed F when a player changes their main-hand to off-hand, etc
But it's not like you can "listen" to keybinds specifically
You can only deduce
You can't even listen to WASD that totally shity
And you can't know for sure if the key is F
dayum
Because keybinds are customizable
is plugin.getPluginMeta().getVersion() still a thing ? i cant seem to be able to use it
like f could be flight toggle key
getPluginDescription?
is there is some api which can help me maybe
You can't
No. There are no packets for keybinds
ok thanks for helping
It's imposible bro
Only mods can do that, not pluigins
thank you
Np
maybe a mod which transmit what he press vía plugin messaging channel yo server
Yeah just a wa je can do it
And that'd require the player to install the mod
uh its ok i will do something else
Which is not always convenient
I know!! They just ideas
The idea is actually a good one, especially considering that there's no much room for imagination here haha
Zbl
Do You have xp with abstracting?
I'm coding a platform indepent api plugin
And i need to learn the best way to abstracta the things between spigot and proxies
I mens anyone know about ir could help there
Conclure say it
I lalresdy seen yo 😂
How does "PacketEventsAPI" work?? I didn't understand how to record an event
hey i need a math experts help
how can i rotate something around its self like 360 degrees
like this
ayo how can i add stylish font in my plugin anyone got an idea?
i want to add like stylish font on my item lore anyone know how?
And why i was told to use the == so? Its creappy haha
yo VERANO123 ya know how can i add stylish font to my item lore??
it would be a huge help🙏
When I use:
saveDefaultConfig();
System.out.println(getConfig().getBoolean("item-settings.bow.inv-slot"));
So instead the data is loaded from my code's config.yml instead of the one in the plugin folder when you use the plugin.
uh sorry but i dont think i can help you
i know what you mean
You can use a simple class i have done for that
Do you want to give a try?
yes
It will also handle file loading if they are whitin a folder, you just create an ins
inhetitation
no? I use it with no overflow exception. It works perfect i would say
== is literally correct way for Inventories
Assuming you are saving your instance, not making new inventory every time
uh where new?
¯_(ツ)_/¯
since this is deprecated what should i use nowadays
You can use deprecated methods
i know
but
usally its not a good idea
and since its depricated i assumed theres a better way now
but if you find nothing you can use it tho
addEntry
ill look it up
its name
arlgiht thx
p.getDisplayName();
https://paste.md-5.net/otaxalijah.java, why is the throwed potion an water bottle ? I looked up on google everybody seems to do like me. (1.8.8)
i know how to get a players name
a
nah i figured it out
there isn't a premade system which is rough
so i just made text buttons that sent the same command but changing a param to change your position in the list
i mean rough that it has to grab a new list every time but it's not actually a big deal since there'll be only <1000 entries
Inventory has contains but not count? Is there something I'm overlooking?
Pass a listener, not an event.
Inventory has .size()
That sounds like a pretty specific method. You can get all ItemStacks of a Material and sum their amount.
declaration: package: org.bukkit.inventory, interface: Inventory
Hi, I don't see anything that stipulates sorting in alphabetical order of suggestions but yet my suggestions are sorted by alphabetical order whereas in my code I sort by online player
https://hub.spigotmc.org/javadocs/bukkit/org/bukkit/command/TabCompleter.html
The client sorts the suggestions alphabetically
its probs faster to just loop the itemstacks in getcontents lol
so there is no point in sorting before ?
Nope
thanks
Faster as in runtime performance or faster as in you can write it quickly.
Writing it was quite quick
Inventory inventory = ...;
Material stone = Material.STONE;
int amount = inventory.all(stone).values().stream().map(ItemStack::getAmount).reduce(0, Integer::sum);
that wasnt the point and u know it lol
It creates a map and puts all items in there. Its a tiny overhead compared to just iterating the content yourself.
i see
But do what suits you best. Maybe even make a util method
i am writing util methods, but not cuz i want stuff granular but cuz different things operate on a set of materials, or single material
annoying that events dont have a @After annotation
to run code after the event itself concludes
im doing Runnable.RunTaskLater(0)
hm this is weird. I coudl've sworn inventory had a remove(material, count) returns HashMap<? extends ItemStack> method but i cant find it
@lost matrix any idea? U seem to know inventory
removeItem
declaration: package: org.bukkit.inventory, interface: Inventory
Your signature is invalid anyways because HashMap takes two generic arguments, not one
https://hub.spigotmc.org/javadocs/bukkit/org/bukkit/inventory/Inventory.html#remove(org.bukkit.Material) the remove and removeItem methods seem to be the closest ones to what you're talking about
declaration: package: org.bukkit.inventory, interface: Inventory
And (Material, int) is basically (ItemStack)
im pretty sure i cant tell that method to remove an itemstack with more than 64 items
doesnt itemStack auto-cap itself to the limit values?
wtf is this constructor lol
like clone
like this is confusing
the only other set of constructors is deprecated
how r u supposed to make itemstacks
This isn't probably the right place to ask, but I bet somebody here would know webdev. How would I implement such a structure with html? I've sorta managed to do the navbar & footer, but the content goes under the footer with my current approach:
(uses Tailwind CSS)
<div class="container block">
<!-- Navbar -->
<section>
<nav id="ch-navbar" class="block bg-primary w-1/6 h-screen"> <!-- snip --> </nav>
</section>
<!-- Content -->
<section class="content w-auto h-auto"> <!-- snip --> </section>
<!-- Footer -->
<section>
<div id="ch-footer" class="flex w-full absolute bottom-0"> <!-- snip --> </div>
</section>
</div>
they call deprecated methods
wym 'Materials' btw, there's no method returning itemStack in material i can see
deprecated
what is so difficult to understand about me saying 'it calls deprecated methods'
@primal ermine Apologies for pinging you, you've helped me earlier so I thought I'd ask you one more time. If you do not want me to ping you again, let me know and I won't do it again
uuuuurgh please just read the code in the screenshot
ItemStack(Material) calls ItemStack(Material, count) calls deprecated ItemStack(Material, count, damage)
this and the clone constructor are the only constructors i can see
well, theres a protected constructor for an empty itemstack but i dont think i can make use of that
hm
when are itemStacks culled to their maximum sizes?
because dont go?
How to add achievments to minecraft?
So plugins can't add achievments?
Like this
I mean there's UnsafeValues#loadAdvancement
but you still need the same json as you would with a datapack anyway
https://bstats.org/getting-started/include-metrics?addedPlugin=true&software=bukkit does anyone know what exactly "my package" is? <pattern>org.bstats</pattern> <!-- Replace this with your package! --> <shadedPattern>your.package</shadedPattern>
com.eviperz.projectname
xyz.epicebic.plugin
i just use github
smh
wait, for github io, is it io.github.prefix.project name or prefix.io.github.projectname
brigadier nerds, is <something> required or is [<something>] requires param
i feel like 1st is required, 2nd is optional
Ty guys but I get this error: Unsupported class file major version 60
io.github.username.project
<relocations>
<relocation>
<pattern>org.bstats</pattern>
<shadedPattern>at.evipez.craftingtableplus</shadedPattern>
</relocation>
</relocations>
``` if I remove this block the error disappers
awesome
your java version is not supported by whetever version you ran this with
thats my pom: https://just-paste.it/L0g4X4QVme
is the error in server conosle or ide
ide
is that the full error? not max supported is xyz
wait
update ur maven shade plugin
latest is 3.5.1
Does anyone know how I can define my own logging format? I have tried making my own Logger and adding a new ConsoleHandler to it with a custom formatter and disabling parent handlers, but this did not log any messages. If I enabled parent handlers, it would print out messages but only with the parent's formatter. I gave up on this approach and tried to send messages by using System.out.print and Bukkit.getCommandSender().sendMessage(), but this resulted with duplicate timestamps and levels (see image).
alright what the fuck intellij
did
if it doesnt work invalidate caches
wheres that?
Yeah IntelliJ likes to get drunk
File menu
redownload sources and javadocs
thats probably it indexing
I havent had that issue. What you might be able to do is to remove the bukkit logger and register your own
print out the class of the loggers, throw out the bukkit/spigot logger, register your own
What do you mean by that? logger.name returns one with my plugin's name, the parent's name is an empty string, the parent's parent is null.
This is what I used to do in the constructor of my logger. I would make a new handler, set its level to ALL and make my own formatter. Then add the handler to the logger and set useParentHandlers to false.
init {
val handler = ConsoleHandler()
handler.level = Level.ALL
handler.formatter = object: Formatter() {
override fun format(record: LogRecord?): String {
val time = SimpleDateFormat("hh:mm:ss").format(Date())
val level = when (record!!.level) {
Level.SEVERE -> " ERROR"
Level.WARNING -> " WARN"
Level.INFO -> " INFO"
Level.CONFIG -> " CONFIG"
Level.FINE -> " DEBUG"
Level.FINER -> " DEBUG+"
Level.FINEST -> " DEBUG++"
else -> ""
}
val color = when (record.level) {
Level.SEVERE -> "\u001B[31m" // Red
Level.WARNING -> "\u001B[33m" // Yellow/Orange
Level.CONFIG -> "\u001B[34m" // Blue
Level.FINE, Level.FINER, Level.FINEST -> "\u001B[36m" // Cyan
else -> "\u001B[0m" // Default
}
return "$color[$time$level] $name${record.message}\u001B[0m"
}
}
addHandler(handler)
level = Level.INFO // Default to INFO level logging.
useParentHandlers = false
}
bruh the default listener aint in logger
Why I'm doing this is because Bukkit's logger is at the INFO level, and turning it up will log unwanted messages.
wtf
hm
what you might be able to do is to just add a handler that only logs >info messages
but i dont see a simple way to get rid of the default bukkit logger right now
What would be the best way to check if a line defined by a start and an end vector intersects with a BoundingBox? I can't use the BoundingBox#overlaps method because that creates another box with the start and end vectors as corners and not a line
So that logger is probably defined inside the spigot jar and not accessible by the api?
i... honestly have no idea. I just made a custom logger to provide specific information if Exception.printStackTrace is called
for each plane making up the boundingBox calculate if and where it intersects, then check if it is in the part of the plane making up the side of the bounding box
Cant you just get root logger and set it's level?
see screenshot, dont think so
alternatively, rayTrace might work
I could set the level of the plugin logger, but it would log method invocations as well which I do not want. Code:
val handler = ConsoleHandler()
handler.level = Level.ALL
logger.addHandler(handler)
logger.level = Level.ALL
logger.severe("It should print this")
logger.warning("It should print this")
logger.info("It should print this")
logger.config("It should print this")
logger.fine("It should print this")
logger.finer("It should print this")
logger.finest("It should print this")
Nor did it change the level in the original time stamp. All other levels default to WARN
r u not supposed to manually log that
use slf4j api ):<
I don't want to use the plugin logger anyway. I just want to print my own debug messages to the console with a blue color. The problem is that the prefix will always say INFO and be white (like shown in the screenshot a couple messages back). I want this to be consistent with warnings and errors from the bukkit logger.
But it seems that would be impossible
I'm about 95% sure you can just log whatever u want
Hello, i have a question if i don't use @eventhandler encore my event methode. The event méthode will be called or not ?
no it will indeed not be called
Not without this in front of the message you want to log
Because spigot loop all methods in all classes registreds il listeners and check annotation to check if a méthode is an event méthode ?
What method do you use to log?
Hi, i do:
PacketEvents.getAPI().getEventManager().registerListener(new dev.scienziato1pazzo.it.infiniteanticheat.checks.event.PacketEvent());
PacketEvents.getAPI().getEventManager().registerListener(new dev.scienziato1pazzo.it.infiniteanticheat.player.events.PlayerJoinEvent());
PacketEvents.getAPI().getEventManager().registerListener(new dev.scienziato1pazzo.it.infiniteanticheat.player.events.PlayerLeftEvent());
but it dont go and dont give error
thats just default behaviour. You need to find the printStream for console
How could I find that?
good luck man lol
i looked a bit through it, potentially thorugh Handler?
Ah I'll try messing around with that then. If it won't work, I'll just have to live with the INFO prefix. Thank you.
actually @tranquil dome just try this: grab the System.out stream and use messages on that
I've also tried to look through LP but its too big for me to quickly find anything
potentially Bukkit.getServer().getConsoleSender()
?paste
You mean System.out.println()?
Both that and sendMessage() use the format with the prefix I mentioned earlier
have you checked what your val printStream is?
Oh that's a string
ignore naming
Taking the parent of that results in null
so i've got the parent highest in hierarchy and it's not the format highest in hierarchy
Suffix or prefix? Also I tried printing to sout but it still has the prefix
consoleSender.RawMessage still prints the infno thing
hm
theres a thread that's an instance of TerminalConsoleWriterThread containing a OutputStream
theres a chance if you can somehow grab that you can write raw text to console
oh ffs
It's not in the spigot api, so I'm not sure how I would
in which dependency is craftbukkit.util
its not in the remapped one
interesting, if i flush System.out and append TEST and flush again, this is the result
and println produces this
that would only work local
for a plugin this isnt ideal
itd only work for 1 plugin at a time
no, he wants to get rid of the prefix

im a bit confused how system.out still adds that
huh this is weird
System.out in spigot is apparantly a log4j iostream
apparantly its overwrittein in DedicatedServer
With this, how would I log? Still with sout?
And if the logger has the same name as the one defined in the xml file, it will override?
I mean, yes there are plenty libraries that wrap around it
It has to be done at some point when it comes to logging/managing the std in and out
i see
any idea how to get the base console output stream
ah that wouldnt actually write to the logs would it
uuuurgh
cursed
bleh internet says to just cache System.out
Myeah
can we intercept system.out before DedicatedServer overwrites it
Probably not, but I mean, what exactly are you trying to do
Sounds like an xy problem
I mean, that is logger stuff tho
Cant you just add a loghandler or whatever its called
apparantly not
Remove the timestamp here for example
epic reload fail
logp aint doing it either
it still appends it
yea wrong window sue me
bleh anything involving the word 'prefix' spits out vault/pex/Lp results
wath is the best language to code one plugin?
java, servers tend to not run .exe files :kekw:
if you know java fully java or kotlin, if not java
thats an empty line for me
oh wait
this gave me an idea tho
man the intellij debugger is stupid
VK_DOWN gives me the last input but VK_UP doesnt restore what i typed
also grabbing the logger as described there aint helping urgh
bah im out of ideas
oh?
i wrote to the System.console().out stream and there was no message at all
thats already false
wait
oh u mean something else
anyone know a good npc api?
citzens
so apparantly System.console is completely ignored by minecraft, somehow
isnt citizens payed?
its not but as far is im aware its not recomended to use
oh arlight thx
i dont have any console output
System.console().writer().out.write("String") doesnt show up in the console
Well, Citizens 2 is premium, but you can get free builds via their Jenkins
wtf is that command
If you can pay for it, you probably should
me losing my mind
why not just System.out.println("") what is writer supposed to be for
arlight thx
do i look like i can
yes
see this chat for the last half an hour
see here
well uh
i can tell you for certain that it does not normally get ignored
i use it all the time for debugging
i know its possible
exception.print does not have that prefix after all
BRUH
WHAT THE HELL IS THIS
I'm done
im so done
xD
that is from log4j or whatever
you can change the output by supplying a different settings file
well i know that
but i want to make it possible for more than one plugin at once
though...
maybe
supplying a different settings file would change it globally
can we manipulate exceptions to not print their stack trace when they're thrown
idk. I don't have your financials. But if you're hosting a server you can probably afford the one time purchase of 10 bucks
its not easy to do it on a per-plugin basis to begin with
its something about the throw keyword that does it
it still shows up in the logs but doesnt have the prefix
you might be able to change that in the settings, but odds are you might have to intercept at the exception level and re-throw it with prettier output lol
hmmmmm
there is two ways you could do it
you can set the uncaught exception handler of the thread
Thread.currentThread().setUncaughtExceptionHandler(Thread.UncaughtExceptionHandler CaughtIt)
public class SomeException extends Exception {
public synchronized Throwable fillInStackTrace() { return this; }
}
this should remove the stack trace and only leave the message if there is one
caveat of the thread one, is that you would need to set it for every thread, not just the main thread lol
I'm having a much more elemental issue, manually throwing an exception doesnt compile, it demands i make a try/catch around it
ill one time purchase you
cringe
If the method added a throws, this would be required. Otherwise the other way is to create a new exception if you detected something that doesn't normally throw an exception. throw new (exception to be thrown)
yea well
@young knoll and what is your custom inventory? Just a class that contains an Inventory and more?
then just surround the code with a try and catch 😛
throw the exception before the catch, catch said excecption in the catch
and do whatever
this is his https://github.com/Jishuna/JishLib/tree/master/jishlib-core/src/main/java/me/jishuna/jishlib/inventory
interesting name
becaues its two different api's
those are generally your more severe ones
IE nullpointer for example is a runtimeexception
where as FileNotFound is an Exception only
one is more severe then the other
and also the only one without a prefix
you can create a class that extends RunTimeException
and create your own exceptions of those kind
yea this leaves one problem tho
to get rid of that path and replace it with something else
you can do that when you create your custom exception by overriding stuff
declaration: module: java.base, package: java.lang, class: RuntimeException
might need to use suppression?
Otherwise its going to be down to intercepting output
which is not overly difficult, but the output isn't controlled by MC
its controlled by JANSI lib
JLine
you could also just set the log level too for it
just set it to warning if you just want it to warn
or if you want it globally may have to introduce your own logger
hm even if i set suppression to true it still prints the class path
bleh this is irritating
i traded one prefix for another
Am I meant to have this many external libraries?
Lol, might have to look at the logger possibly. Why are you even trying to prevent this anyways?
to... have custom output?
What about this?
Ah ok, yeah might have to look into using a custom logger
and hook it into the server
other then changing the settings file for Log4J
wouldnt that still f me cuz both system.out and system.err are somehow only returning an intermediary print stream?
like
the exception system.err adds the class name to itself
not entirely sure, I haven't really messed with the log4j settings, but as far as I know it can do a lot in terms of tailoring the output. The only downside of it is that only one settings file may be registered for the entire application
well yea, I'm trying to find a way to not have to do that
that way more than one plugin can use custom output
'use me and nothing else' is not good design philosophy
Well, its used because most people don't even know how to interpret the problems to begin with and its not usually ideal to hide away the details
its not specifically about exceptions
its just that i noticed that throws results in a non-mc prefix
but apparantly that has its own damn prefix
probably wise
I appreciate you taking the time to look into this and I'm sorry for no longer being able to really add onto this.
If you come to a solution, could you ping me in the message?
thank you
hm though that gives me one idea. If spigot overrides them, why can't we override them, and just pass it back to spigot if it doesnt have a specific identificator prefix string
ill look into that later ig
because it isn't spigot overriding them
whats the difference?
I mean I suppose you could redirect the Out to somewhere else, but its not Spigot directly doing anything beyond setting where output should go, otherwise it goes into the abyss
So you have Log4J for the logging of anything, and then everything is directed to Jline, which is the console, and then JANSI is part of JLine which gives you the colors and the sorts
but spigot isn't dictating what these things should or should not be doing
probably
but its a pain to deal with because as I said, you can't register more then one settings file
and that file applies globally
the setOut if I recall should be setting output to Jline
at this point I'm tempted to just eat the JANSI code and make my own console urgh
My brain is failing to make an sql schema
I have dungeons, floors, and rooms.
One dungeon can have many floors, and one floor can have many rooms. A room can belong to multiple floors and a floor can belong to multiple dungeons
I need a dungeon table, a floor table, and a room table.
Then I also want a table to connect dungeon <-> floor and a table to connect floor <-> room
Do I have this right
you would need to use foreign keys for this
so you can associate what goes with where
sounds like you should cut out at least part of that. WYM a room can be in multiple floors? Are you making your dungeon out of preset rooms?
I think what you need is a table ROOMID -> ROOM, a table Dungeon -> Floors and a table Floor-> rooms. Depends which information you need, mostly, but having a floor belong to multiple dungeons would require extra information
Yes it makes a dungeon out of preset rooms
The floors are basically templates to build a floor, and a template can be reused by multiple dungeons
ah
ye then youre probs fine with a list of floors per dungeon and a list of rooms per floor
i thought you meant individual floors having connections to multiple dungeons
Yeah I guess floor template is a better name
what's a good way to implement an invites system for a factions plugin? Store the invites per faction mapping to a player or something?
Well, the question is, what are you needing to accomplish with the DB
Can I use java 19 with gradle?
what data does it need to hold?
Should I just use null as InventoryHolders for my custom inventories?
Btw I modified my customInventories now your lib is a great reference @young knoll
yeah
or is it just holding the template info for each?
ye
the gradle ver is too old
Ah, where would I upgrade that? I just built it using minecraft development plugin
java 19 needs 7.6
change it in /grade/wrapper/the properties file,the distribution url then run the wrapper task
https\://services.gradle.org/distributions/gradle-7.3.3-bin.zip would become https\://services.gradle.org/distributions/gradle-7.6-bin.zip
u can make a custom class extending inventory holder. since the holder isnt sent to the player directly it remains present and you can call inventory.getholder instanceof CustomHolder
s what i did for a vault plugin
No you don't i just learned that today
😉
dont use the holder api to determin if its ur inv
I download that zip write?
ur code is weird then
no change the distributionUrl in /gradle/wrapper/gradle-wrapper.properties in ur project
getHolder uses snapshot thats why it inefficient
I only got this in the wrapper file
show ur project structure
Ok I see 😂
And in that is
are you in your project