#help-development
1 messages ยท Page 2112 of 1
the session.lock file is the lock
you can just delete that file and it will start as normal
conveniently it also tells you the exact path of the file: /Users/ianerbacher/Desktop/Server 1.17/./world/session.lock
note that there may also be locks on the nether and end worlds
ok
dat worked
I thought the little charachter inside did sothin
this little guy โ
wait...
its a snowman?
wot
unicodesnowmanforyou.com
lol
โ
does someone have any idea how replacing the premium resource placeholders work? I already opened a thread but I'm impatient lol https://www.spigotmc.org/threads/apply-premium-resource-placeholders-manually.555347/#post-4403275
If you're tryna do it with a plugin it's not gonna be easy at all
How do you create a plugin data folder
ya but create it
I'm guessing that it gets replaced with a simple string search + replace over the jar itself but I could be wrong
because strings have to be embedded in their literal forms anyways
though I guess they can be compressed so you'd have to decompress them first
still though
no, I just need something like
java -jar string-replacer.jar input.jar output.jar "%%__MY_PLACEHOLDER__%%" "some replacement value"
basically just a tool to replace placeholders in string constants like fields, local vars, etc
Probably be easiest to use some bytecode lib my personal favorite is bytebuddy
yeah I also found byte buddy but haven't found a way easily replace something in a .jar and then save the file again :<
Been a bit since I've worked with it, might be a different lib that's better suited for it. Anything ASM based is going to be the right direction though.
RIP this going to be more complicated than I thought
I thought there must be an existing tool for this
after all, all those illegal leaking websites replace those placeholders automatically
if you only used gradle
why?
I also have to replace that stuff in already compiled libraries
oh
I need to replace strings within string constants in .class files
nvm then
:<
file = new File(Bukkit.getServer().getPluginManager().getPlugin("DisappearingBlocks").getDataFolder(), "blocksConfig.yml");
Is there a better way to get the plugin object
the plugin name?
in the on enable method I can use this.getDataFolder()
just pass an instance of your main class to the other class' instance
e.g. ```java
MyOtherClass myOtherThing = new MyOtherClass(this);
class MyOtherClass {
private final MyMainClass plugin;
public MyOtherClass(MyMainClass plugin) {
this.plugin = plugin;
plugin.getDataFolder()....;
}
}
wot
I am confused
Plugin plugin = new CustomItems(this);
file = new File(plugin.getDataFolder(), "blocksConfig.yml");
does that work @tender shard
no
why not
you're initiating your main class
and that will error
and disable the plugin
?di
Guide to dependency injection: https://www.spigotmc.org/wiki/using-dependency-injection/
so what do I do
initialize your 2nd class and pass your plugin into its constructor
else if (!(args[0] instanceof Player)) { gives error
yea how can a string ever be a Player object?
how to convert string to player
by using Bukkit#getPlayer(String name)
then performing a null check to see if this player is actually online.
nope
๐
Two options
- Depend on Spigot API (or whatever) before Vault. Dependencies will prioritize based on when they're defined
- Exclude Bukkit from the Vault dependency
I advise doing the first. It's way easier. Just move your Vault dependency below Spigot
Currently rewriting https://www.spigotmc.org/wiki/using-dependency-injection/ if anyone has any thoughts on the edits recently made feel free to tell me or change just change it :3
java is a great language
https://github.com/Burchard36/BurchAPI/blob/main/src/main/java/com/burchard36/api/utils/reflections/PackageScanner.java Behold, my masterpiece kind of
Seek Jesus
ask away
I was doing the DiscordSRV setup
And where do I put the channel ID so the bot would show the messages from the in game server?
indeed, aids asf but no other way to really do it without using a library like Reflections 
Hey I've got a question, how do you get the data of a seed when a player breaks it ?
The level that the seed has grown.
How would you do it ?
Block#getState
and do a instanceof check for Ageable
then just cast (Ageable) theBlock.getState()
Ohhh.
Actually https://hub.spigotmc.org/javadocs/bukkit/org/bukkit/block/data/Ageable.html
It might be Block#getBlockData instead of getState
just in case you run into any errors ^
make sure you import
org.bukkit.block.data.Ageable because theres a Entity one as well iirc
@EventHandler
void onBreak(BlockBreakEvent e){
if(e.getBlock() instanceof Ageable){
Block block = e.getBlock();
Ageable age = (Ageable) block.getState();
age.getAge();
}
}```
This'd work, right ?
yep, if you get a class cast exception use getBlockData instead of getState
well it won't do anything with the age but i'd work.
Ohh okay.
And one more thing, is there a way to make it so the crops don't need water to grow ?
you can get the soil block underneath it and set it to a waterlogged state (i think) and prevent state changes on it
Ohh okay, thank you!
https://hub.spigotmc.org/javadocs/bukkit/org/bukkit/block/data/type/Farmland.html
So you use Block#getBlockData and cast it to this class and set its moisture level to 7 IIRC, and add this Block to a List of Blocks so you can keep track of it, preferable do this when you right-click a block with a hoe to make it farmland (PlayerInteractEvent)
From there use this event: https://hub.spigotmc.org/javadocs/spigot/org/bukkit/event/block/MoistureChangeEvent.html and set the event to canceled if the Block effected here is in your List of blocks mentioned previously
OR:
If you wanna prevent all state changes of soil blocks, forget the List of Block's entirely, and just check if the BlockData from this state is farmland, and cancel the event there
do note
if you do the List of blocks route youll likely need to store them in a file/database so they can be loaded when the server starts up
What is this bruh, is this just the Discord Authenticator of myself like Google Authenticator?
So I guess it'd be the best to use the MoistureChangeEvent
https://imgur.com/j9wBpbi
would anyone have an idea on how i could replicate this teleporting?. like how do i figure out the target location.
indeed, BlockPhysicsEvent is rather wonky
Idk what this means
is that basically just a door or something?
So moisture event it is, thanks alot man!
IIRC you can check when a player colides with a block
Google authenticator code from the app
if i take the player direction it could pose issues as he could be looking the other way
what happens when you go into it from the opposite side? does it teleport at all?
yea it does the same but to the other side
And it says this
you could get the BlockFaces of those glass panes, and check if the blocks facing north east south and wast are air set the location to that
yea i guess il try that
not sure tbh, just looks like you dont have 2fa setup but if its asking for the code you do have it enabled
maybe ask discord support or check its reddit page
in fact
it was the first google search i found
whoever developed that bot, needs to do that ^
Is there a way I can get the max food level a player has for a variable?
max or current
Max
well its 20 by default
if your changing it, that would be up to you to hold the max food level of the player and enforce it
i dont think theres a well written api for adding hunger bars like there is with health
theres only getFoodLevel and setFoodLevel
@noble lantern do you think it would also be possible to just detect block collision and then teleport the player to the other side of the block using a vector maybe?. i dont know much about vector math but i should be able to get a vector in the direction of the collided block and have that vector be 1 block long.
indeed you could, but im in the same boat as you, i dont know a whole lot about vector math
aw unlucky haha
cause it would be amazing if i could do it in a way like this. so it will really work from any direction

just need to wait for my very smart friend to wake up xD
so he can teach me how vector work
@noble lantern
@EventHandler
void moistureChange(MoistureChangeEvent e){
Ageable age = (Ageable) e.getBlock().getState();
if(age.getAge() == 7){
e.setCancelled(true);
}
else{
age.setAge(7);
}
}```
Would this work ?
just cancel it all together
And you should be checking if the blockstate is Farmland not Ageable
no need to check its age or stuff
just instanceof Farmland then cancel event
Okay then what if it's not watered ?
How do I set it to lvl 7?
Nvm found it, casted it to a farmland.
@EventHandler
void moistureChange(MoistureChangeEvent e){
if(e.getBlock() instanceof Farmland){
Farmland land = (Farmland) e.getBlock();
if(land.getMoisture() != 7){
land.setMoisture(7);
} else {
e.setCancelled(true);
}
}
}```
Wouldn't this work as well ?
player interact event -> check right-click block -> if player is holding a Material which its name ends with HOE -> check if block right-clicked is a typeof DIRT/GRASS_BLOCK/etc -> run one tick later to change its Farmland moisture to 7
i mean you could yeah
it would still work
prolly a lot simpler tbh
And for the crop's age use Ageable, understood.
your casting Block to Farmland
not Block#getState or Block#getBlockData
and then your chillin
yes but a Block will never be Farmland because Block doesnt directly inherit it
Farmland implements BlockData, not Block
Ohh that makes sense.
any idea why this would make a null pointer exeption?
static Scoreboard scoreboard = Bukkit.getScoreboardManager().getMainScoreboard(); Cannot invoke "org.bukkit.scoreboard.ScoreboardManager.getMainScoreboard()" because the return value of "org.bukkit.Bukkit.getScoreboardManager()" is null
"this will only exist after the first world has loaded"
ah that makes sence. would worlds be loaded when on enabled is called?
yup
ok thanks for the help
wondering, why does blockbreakevent trigger when you left click a block in creative with a sword?
sort of seems like a bug
hello, how can i disallow people to drag items in to a GUI. I have made so people can't steal items from gui, but people still can drag their own items, so it works like a trash can :D
InventoryDragEvent
Is there a way to check for if a key has a deeper structure to it in a configuartion file? for example:
hello:
world : hi
getConfig().something("hello")
this will return true
hello :world
getConfig().something("hello")
this will return false
#getConfigurationSection(path)
getKeys
You can pass a boolean for whether to get deeper keys or only the first layer
Oh right, and then I can check for the size of the set, thanks!
whenever im using the SignChangeEvent event, the server is printing the first line on the sign when i dont have that programmed in
how do i remove it?
Recompile and use that jar
Yeah it happens
https://paste.md-5.net/nolifuzoja.xml My dependencies are not being shaded, this used to work a while ago. It's probably due to Lombok, that thing is being more of a hassle than it's worth. How do I configure it properly?
You can remove that transformer setting. Also make sure to actually be using maven to package your jar.
Oh and there aren't any dependencies in that pom to shade
<dependencies>
<dependency>
<groupId>com.destroystokyo.paper</groupId>
<artifactId>paper-api</artifactId>
<version>1.16.5-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>1.18.24</version>
<scope>provided</scope>
</dependency>
</dependencies>
How would I do that?
Can anyone respond with an explanation?
My bad lmao, Lombok works fine. Just a little null pointer
If you want to shade lombok remove the provided scope. I do however recommend using the lombok maven plugin to delombok
https://hub.spigotmc.org/jira/browse/SPIGOT-2670
Any fix for that?
The client requires a location of the anvil. I have no idea how that handles it
I'm talking specifically about Grindstone
ah I see
You might have to use NMS then to fix that
Take a look at https://github.com/WesJD/AnvilGUI for reference
You're free to fix it yourself and add a PR
i'm completely confused.. why tf does this always return false? doesnt look wrong to me
public static boolean doesDBEntryExist(Player p) {
try {
PreparedStatement ps = Main.getPlugin().getSQLManager().getConnection().prepareStatement("SELECT * FROM " + Constants.TABLE_NAME + " WHERE UUID=?");
ps.setString(1, p.getUniqueId().toString());
ResultSet result = ps.executeQuery();
if (result.next())
return true;
} catch (SQLException e) {
e.printStackTrace();
}
return false;
}```
and yes, the database exists, is connected, and works fine. The following one just always puts it into the database, regardless of if it already exists
public static void createDBEntry(Player p) {
try {
if (!doesDBEntryExist(p)) {
PreparedStatement ps = Main.getPlugin().getSQLManager().getConnection().prepareStatement("INSERT IGNORE INTO " + Constants.TABLE_NAME +" (UUID, RANK) VALUES (?,?)");
ps.setString(1, p.getUniqueId().toString());
ps.setString(2, "&7Player");
ps.executeUpdate();
}
} catch (SQLException e) {
e.printStackTrace();
}
}```
yay I got my "replace strings in compiled .jar file" thing working
if this always returns false, it seems like the ResultSet actually doesn't have a next row
ofc it doesnt
the question is why
because the entry in the db does in fact exist, it just creates the exact same entry below it
-_-
but have you checked it yourself?
if with "yourself" you mean checking the table inside heidisql, yes
it now has 10 entries with the same uuid and rank
yes that's what I meant
okay, makes sense
I just checked
uuids are shit
then it fits into 32 chars
nah doesnt matter
i just had the rank at 32
so i made uuid at 32 too, not knowing it has 36
4 fucking letters
they do
why?
they crash my server sometimes
then you're doing sth wrong
yea, i wasn't checking if theyre null
A uuid itself ist just a string represantion of 2 "long"s
i didnt knew that uuids of joined players can be null
hm they can't
well they do. when bots with null uuids join
which happens quite frequently for some reason
you mean from Citizens?
no
like spam accounts
from idiots with too much time
console literally also says "uuid=null"
oh that's what you mean, like in AsyncPlayerPreLoginEvent
yeah but that's not the fault of java's UUID but rather mojang allowing such weird stuff ๐
mojang is shit as well
imagine getting bought from microsoft
that's like the best that can happen to you
without those microsoft accounts i could without libraries login into my dev environment for my mods
notch enjoys
now, i need libraries because i'm a lazy ass and i dont want to create a new one for this shitty new login system
anyway, I'll continue improving my custom string encryption, have a nice day everyone :3
also javafx doesn't work for whatever reason, so i need to fucking have my login details in a config file
which makes me feel bad
also
[11:02:38 WARN]: Nag author(s): '[Cxlina]' of 'Survival' about their usage of System.out/err.print. Please use your plugin's logger instead (JavaPlugin#getLogger).```
this is fucking annoying when you just want to debug some shit
just ignore it if it's only for debugging
I always just let allatori remove all sout's from my final .jar
or I add a public static debug() method that checks a System.getProperty before using sout
i would never use MainClass.getInstance().getLogger().info(some shit); to fucking debug something
i just use sout in intellij, and bum
how do i use custom fonts in bossbars?
why don't you just do something like this:
public class YourMainClass {
private static boolean debug = false; // set to true using a config.yml setting
public static void debug(String... args) {
if(debug) myMainInstance.getLogger().......
}
}
that way people can also enable debug mode themselves and you don't have to worry about forgetting sout's before releasing a jar
Hey guys ! Do you know a plugin that can simulate a player connection, with fake players, to test if my server handles well a large number of players ?
Thanks
it would still fuck up with my brain bc i use the sout thing
that intellij has
which is fucking nice
resource pack
no it's a custom font
why does it have to be so hard, it's so easy in commands ):
can i do it with protocollib?
package samplepluginspigot.samplepluginspigot;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.bukkit.plugin.java.JavaPlugin;
public final class SamplePluginSpigot extends JavaPlugin {
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
if (sender instanceof Player) {
Player player = (Player) sender;
if(command.getName().equalsIgnoreCase("hello")){
player.sendMessage("Hello There");
}
}
return false;
}
}
I tried to test my plugin on my server and it enabled but it kept on returning unknown command and didnt work
name: SamplePluginSpigot
version: '${project.version}'
main: samplepluginspigot.samplepluginspigot.SamplePluginSpigot
```this is my plugin.yaml
Hm?
so i should override onEnable instead of onCommand? is there anything else to fix in order to make it work?
there is
Im confused because someone is telling me theres no method and then someone is saying there is
Lmao
it should work, you just have to register the command in your onEnable
Hey does anyone have a link to the picture that shows Inventory indexes, I got a small inventory (1 row 9 columns) and I want to add items into some slots
just row*slot it
๐ thank you
I want to find the slot
ezpz map it out urself
and whats wrong with row*slot then?
it requires slot?
-1
3*9+4
Ohh so the slots are just called like
* * * * * * * * * (9 slots)
0 1 2 3 4 5 6 7 8
This?
yes
i thought it was something real weird cause the inventory one looked like that too, my bad
thank you guys
Wait What?
0 1 2 3 4 5 6 7 8
9 10 11 12 13 14 15 16 17
18 19 20 21 22 23 24 25 26
etc
Aight, thanks
Ah thank you
doesn't the slots count from bottom to top?
no
tf
well it's like text
you start in the upper right corner
erm
upper left corner
then it goes to the right
until the next line starts
uhh
i always used slot 13-15 for below the crafting field
well if you're using raw slots, it's a bit different
this for example is the "raw slot" of the player inventory view
this are the "proper" slots for a CraftingInventory
yea the top and bottom afaik
imagine you have a top inventory (double chest)
and a bottom inventory (the player inventory)
a double chest has 54 slots, counting from 0 (upper left) to 53 (lower right)
If you refer to the "raw slot", the first slot in the player inventory is now 54
in the normal "CRAFTINGInventory" (which basically is the player inv + the armor slots, crafting table, etc), the first slot of the player inv isn't 54 but actually 9 (because the hotbar already goes from 0 to 8)
package samplepluginspigot.samplepluginspigot;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.bukkit.plugin.java.JavaPlugin;
public final class SamplePluginSpigot extends JavaPlugin {
@Override
public void onEnable() {
getCommand("hello").setExecutor(this);
}
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
if (sender instanceof Player) {
Player player = (Player) sender;
if(command.getName().equalsIgnoreCase("hello")){
player.sendMessage("Hello There");
}
}
return false;
}
}
```would this be okay now?
I think this is a good example:
slot 3 of the inventoryview is the same as slot 9 of the bottom inv
slot 30 of the view is the same as slot 0 of the bottom inv
imo counting from the bottom would make more sense
so the "inventory" slots (which are basically always present) are always the same
it's a bit random, that's true
๐ Thank you for all the help
and then if a chest is present as well, just start from the last inventory slot
imho the "raw slot" thing shouldn't exist at all
but well, that's the way it is and it will never change
the slot thing in general could've been easier
the InventoryClickEvent in general sucks eggs
e.g. if I press Q to drop an item from my hotbar, how is that a CLICK event?
was it the PlayerDeathEvent which has getEntity instead of getPlayer? this sucks ass
yes, inherited from EntityDeathEvent
lol yeah and why is it a HumanEntity
EXACTLY
getWhoClicked is to allow plugins like Citizens to create proper NPCs
however Citizens is stupid and extends Player instead
"implements" I meant
they should implement HumanEntity instead of Player
because NPCs are NON-PLAYER characters... yet they implement Player, that's so stupid
so it currently dont even has a real reason?
well it does have
Citizens could implement HumanEntity instead of implement Player
it's Citizen's fault that they don't do it
hytale hype
i'm literally so un-hyped for the 1.19
i literally don't care a single bit
that update has no reason for me to update my game/server
one of the reasons behind why some people stil use 1.8
1.19 isnt super exciting but 1.18 damn that was epic
also the sculk sensor is a pretty cool mechanic in my opinion
thats still a thing?
just play modded minecraft
legends say that hytale is releasing since 1500
they started like 500 million years ago
the main reason why people use 1.8 is just the cooldown
i rant about the 1.19 because it has no feature that i think is useful
the warden for example has no reason to go kill it
People who use 1.8 just want to purposly make devs jobs harder
true
thats the only reason they exist

imo spigot should completely trash the pre-1.12 builds
alltho probably all those kids would completely cancel everyone involved in that step lol
i love when the people dont know you can disable cooldown by commands
always funny to see them
i just choose not to support anything that cant use jre 16 natively without modifications
oh fr?
didnt know that

the only thing you can complain about is not having block hitting
everything else can be reimplemented
block hitting is so stupid
only something sweaty 13 year olds use while using auto clickers to click 30 cps
/attribute <EntityName> minecraft:generic.attack_speed base set 30.0
there you go
no cooldown for all your weapons
i dont think that command exists in 1.9-1.12, i might be wrong
is there a difference between setting it to 30 and the max 1024?
uhh
i dont think so
i think 4 is actually no cooldown
idk
nvm
24*
is the effective value for no cooldown
afaik knockback can also be tweaked
players apparently dont have that attribute tho? huh
I made a server fork to make knockback 1.8 again
thats also an option
" Applies only to mobs with physical attacks"
sucks that bukkit doesnt allow for mixins
no need to create an entire fork
or at least asm
and thats why mongodbs better
is it possible to detect while a player is breaking a block
i want to give a player mining fatigue while he is breaking a specific block
but if he stops it should be removed again
pretty thats only fires once when you start breaking the block
and how do i know if the player stopped
which eventually won't even work on instabreak blocks tho
youd need packets
its dah only way
ughhhhhh
i thought blockdamageevent would fire every time the block changes damage state
but it doesnt
i see
there you go
give fatigue on damageevent, and remove it on damageabortevent
i guess
cries in using 1.8
tell that guy your working for
you won't get support in here anyway
to updoot
1.8 is old ass
no one will help you in here, except theyre using 1.8 as well
and i dont evne know if staff likes that
ahahaha
MY MAN
you have no idea how much people hate on me for my 1.8 opinions lol
I cant stand anything 1.8-1.13/1.14, i don't get why people don't use update
same
1.8 users when they need to use their brain for pvp
just wait to tell them you can hit shield users from behind and on the sides

Is there like an onCreeperExplode event I can use to modify things that are happening upon creeper explosion?
when i tell em you can use axes
.
they are like CoOlDoWn
1.9 pvp is epic
^
entityexplodeevent
yeah
change my mind
Pre 1.13 netherrack was the best texture
FALSE
True
i completely disagree
false
with all my power
which is none
the old textures are ass
flase
NO EMBED FAIL
FUCK
what? granite will and forever be my favorite texture.
idk why it failed to embed thats some bs
Nah but the old netherrack definitely made the nether feel more netherry to me than the new one
lololol
STOP SENDING GIFS
the old nether was ass
true
The new texture is better
old netherrack is fucking horrible
^
me wasting your internet like
But the coarseness of the old netherrack felt more hellish
facts
all older textures are doggy but theyre good for memories
old netherrack is like a red pixel gradient spam
true
ccp
internal shaders epok
lmao
c++ epic
C plu plu??
ัััั
but hard
UHH
didnt even know it looks that bad
really, loaded up a client and went to the nether for that screenshot?
i have my client open anyway
could have at least got a piglin selfie!
and my server as well
piglin chan
love that
its simply the truth
true
what is this world.dat coming to
alltho aternos is worse
skynode and sparked on top
content://com.android.chrome.FileProvider/images/screenshot/16511449649303049870528196045836.jpg
btuh
wait, i need enderios
i did manage to do my problem from yesterday with vectors by the way. @noble lantern it ended up being quite easy actually
honestly, i have no idea what discord needs to make smt embed
yesterday? i havent even slept yet
ok, nvm, lemme act all professional like
#help-development is called #offtopic
this is all it took if ur interested.
private Location getDoorEndpoint(Player player, Location door) {
Vector blockL = door.getBlock().getLocation().add(0.5, 0, 0.5).toVector();
Vector playerL = player.getLocation().toVector();
blockL.setY(playerL.getBlockY());
Vector DV = blockL.subtract(playerL);
double multiple = 1 + (STEP / DV.length());
return playerL.add(DV.multiply(multiple)).toLocation(door.getWorld());
}
yas, someone thru up some code.!!!
Sorry to make you sad, but the red thing are not the eyes
but this is the code channel
i hate it
we have to talk about code related stuff
godsend code
i could send my entire live into death by dropping 3 words
now you cant unsee it
or worse, lets have a nice chat about ecapsulation.
alltho i dont think i want that
3 words = channel ded.
nah
this channel never dies
more like what i think about specific coding languages
promiscuous pointers?
dangling pointers
better than dangling pointers?
shall we poll?
oh and dare I say, shall we talk about tabs vs. spaces??????
3 spaces is best.
_ _
what has this server become... ffs
yas, this thread will live.
wtf did you send
its always been like this
welcome back
_ _
_ _
Why main class named Main
_ _
angy
could we have half spaces vs tabs?
because hariy mains are dope.
well becuase of the main loop
it was thought at the time, that there was a main proccessing loop
unlimited time
and everything else was, well not so main, but secondary
wait, y goes to infinity.
your chart is incorrect
hey, so i have this code to create an inventory :
public Inventory coldInv;
public void createcoldInv() {
coldInv = Bukkit.createInventory(null, 27, BOLD + "" + RED + "Printer");
ItemStack item = new ItemStack(BLACK_STAINED_GLASS_PANE);
ItemMeta meta = item.getItemMeta();
meta.setDisplayName(" ");
for (int a = 0; a < 10; a = a + 1) {
item.setItemMeta(meta);
coldInv.setItem(a, item);
}
for (int a = 18; a < 27; a = a + 1) {
item.setItemMeta(meta);
coldInv.setItem(a, item);
}
item.setItemMeta(meta);
coldInv.setItem(9, item);
item.setItemMeta(meta);
coldInv.setItem(17, item);
item.setType(PEONY);
meta.setDisplayName(GREEN + "Rรฉcupรฉrer");
item.setItemMeta(meta);
coldInv.setItem(11, item);
item.setType(CHAIN);
meta.setDisplayName(GREEN + "Refroidir");
item.setItemMeta(meta);
coldInv.setItem(13, item);
item.setType(WARPED_SIGN);
meta.setDisplayName(GREEN + "Argent");
item.setItemMeta(meta);
coldInv.setItem(15, item);
}
```before u guys ask, yes i put createcoldInv ine onenable
and i call it by doing :
```java
if (command.getName().equalsIgnoreCase("mรฉtier")) {
String argumentOne = args[0];
if (args.length > 1) {
if (StaffList.contains(playerSender.getDisplayName())) {
if (Objects.equals(args[1], "test")) {
ItemStack item = coldInv.getItem(15).clone();
ItemMeta meta = item.getItemMeta();
meta.setDisplayName("test");
coldInv.setItem(15, item);
playerSender.openInventory(coldInv);
playerSender.updateInventory();
}
//and then some other objects, command and other things
please demonstrate y = โ in your graph
when i run the command in game, nothing happens
too few indents
i hate your code to create an inventory
you didnt set the item meta
BurchAPI's inventory api is very poggers
do you call you command mรฉrtier?
๐
WLib better
why tf do you check the commands name
can your inventory have listener for everything?!?!?!?!
i dont think so
yea looks like a pretty solid inventory api
command api is noice too
can yyou make the inventory close, listen for any event and then open again?
https://github.com/Burchard36/BurchAPI/wiki/Creating-your-command-class
Commands get automatically registered via this class
Dont really see a need for that tbh
Yes
configuration inventory
player click "set name"
player enter the name
open the inventory with the item showing the updated inventory
yea. il still go for my own stuff though as i know how that works
At least with Bukkit that id
can someone help me with a coding problem?
meh im not here to write a plugin for people thats more or less some type of subsystem you add in a specific inventory
indeed i would do the same thing
Is it cause i said poggers :((
well, the api is fast
speedy boi
did you know that you can have two inventories linked
?paste
for me?
i didnt do that, i just made a functional interfaces for the specified inventory events
@noble lantern this is how i do menu's https://paste.md-5.net/yudeteracu.java
yes indeed
not too bad tbh
ya got a problem with mah naming!?
im gonna add animated frames into my api here soon
it's not camelCase
bump
@noble lantern does yours support title animation tho ๐
Composition > inheritance
guys
player names can't contain - right?
dont think so bc to my knowledge ivnentory names cant be reset
a-zA-Z_0-9
aight
Thats the main code for the inventory api
thats helpful
reltively simple tbh
seems like ur knowledge is wrong ๐
well i have never tried actually playing a full on animation. but i can for example show a message to the player
then revert back to the old title
no
oh you just got interfaces for it all huh zack
i use packets
well depending on the mc version i use packets or nms
indeed it is
ew
i wanted to do that but didnt really see a reason for it
any specific reasons?
epic god pr that inventory name fix
maybe it is just the window packet
I've used the open window packet before
It does change the title but there's a bit of a client-side issue where the contents of the window won't be visible/update until the player clicks on a slot :p
@quaint mantle i use PacketPlayOutOpenWindow
Window property doesn't apply to the title
i was talking with @quaint mantle
What I did for an animated title was just reconstruct an inventory with matching contents but a different title, then close the old inventory and open a new one
There was no flickering or anything, but I don't know
It's slightly hacky
maow what happened to your pfp
i heard that same inventory holders dont make it flick
Inventory holders probably have no actual importance
@quaint mantle i could even send you my method that does it. but its slightly big and uses a lot of stuff from my library
u woulnt be able to use half of it
well, when i want to open a new inventory with the same holder, it does not take my cursor to the center
Several. One is higher flexibility, another one is that inheritance breaks strong encapsulation.
You can read about it in books like "Design Patterns: Elements of Reusable Object-Oriented Software"
๐
hmm yea i might read up on that then.
events
for some annotations there, i would use only 1 annotation with more parameters
!paste
Command:
permission, defaultPermission, permissionMessage, cooldown
something like this
?spacex
move your command-testing to #text
imagine having to use a lot of annotations
ah, thx, GodCipher
What are the signatures for those interfaces
nice to know it's still there
Are there any libs that give plenty of annotations interfaces and enums?
Ty!
of course. i gladly plug ur stuff ๐
imagine not using some obscure fucking tree structure
code warning go brrrt
a
nah its because i needed to init the engine and intellij is like "engine is null will make npe help me"
lmfao
font
fira code 16
so im just blind with smaller font
using windows sketch or whatever
yeah but the actual ide looks exactly like i so i was curious
thats my wallpaper lol
your ide bg
yea its very popular
yh
i did too
My brain: "Protogen go brr"
legit all of my devices have protogens on them
I have an obsession
save me
whats the pom thing for vault
Do you mean the artifact?
yea
Check the GitHub https://github.com/MilkBowl/VaultAPI
is 1.7 for 1.17
I believe Vault is version-agnostic
what that mean
Google your question before asking it:
https://www.google.com/
always forgot that existed
Google the word "satan"
link
somehow we have the same wallpaper
It's probably really common
this guy too
Here's my desktop
at least for intellih
Home screen
That screenshot is like, 13 hours old
And actually one sec I'll send my laptop's desktop too
This is animated btw
Old screenshot but yeah, 0 customization here.
I'm having an error with the newest version for my NMS
It all broke from 1.18 to 1.18.2
Failure to find org.spigotmc
jar:remapped-mojang:1.18.2-R0.1-SNAPSHOT in https://maven.enginehub.org/repo/
I ran buildtools and restarted even
I want to make a plugin that checks for custom items, but not checking for the name or lore. I tried Persistent Data Container but didn't worked....
PersistentDataContainer works, you just need the exact same NamspacedKey as the custom item youre looking for has in its PDC
its important to have the plugin instance which created that NamespacedKey, as it wont be the same otherwise
public static String getArenaServer()
{
return instance.getConfig().getString("plugin.server");
}
public static SimpleLocale getLocale()
{
return instance.locale;
}
public static Database getMySqlDatabase()
{
return instance.database;
}
public static ClassManager getClassManager()
{
return instance.classManager;
}
public static PlayerManager getPlayerManager()
{
return instance.playerManager;
}
public static TeamManager getTeamManager()
{
return instance.teamManager;
}
Guys, I have various classes extending a custom database class made by me. I don't want to have a getInstance() method in all of these singleton classes (because static). But to get them from the main class.... What do you think is the best way?
oh god the static abuse
I know, but the problem is how to get rid of it?
maybe just call getInstance every time you need it?
Ok so you are for a getInstance() in every class?
no
I am for calling your plugin's getInstance method
or tbh just avoid it all and stick to dependency injection
And that is?
?di
Guide to dependency injection: https://www.spigotmc.org/wiki/using-dependency-injection/
i cant find a way to do this
i want to make a shop config where you can use this format to set blocks and items
shop:
Blocks:
Grass:
item: Grass_Block
price:
buy: 10
sell: 5
Dirt:
item: Dirt_Block
price:
buy: 5
sell: 2
i wanted to get all items in the blocks category and put it in the inventory
get the shop section
each key on it will be an item or something
then that item's section can just be parsed
i dont understand
ConfigurationSection shopSection = config.getConfigurationSection("shop");
for(String category : shopSection.getKeys(false)) {
ConfigurationSection categorySection = shopSection.getConfigurationSection(category);
...
}
get the keys
I want the creeper to not destroy blocks when exploding, is there anything else I have to do?
i did
i dont want keys i think idrk
also I know this one
it doesn't work
so obv you have to do something else
that's why I'm here
!doesnotworking
what is even a key
?notworking
"Does not working" is a useless statement. Please describe what exactly is not working, what you expect it to do, and what actually happens. If you get any console errors, also ?paste the entire stacktrace.
I-Am-A-Key: "my value"
so basically the holder of further information
event.blockList().clear
oh thats a key
huh
java and javascript are very diffrent thats why i dont understand anything
tf is hasmap ;-;
That one worked, thank you so much!
dont mind it till you need it
;-;
you will need it
a hashmap is the root of performance
yet they are 2 diffrent things
() => {} wtf is that supposed to be?
despite a syntax error
javascript arrow function
oh you're talking about js
They're basically the same thing :p
how is the server user supposed to fill in item section
most admins dont know spigot enums
I was trying to do a performance test, but I noticed, that this code
public static void main(String[] args) {
Random random = new Random();
int[] data = new int[100_000];
for(int i = 0; i < 100_000; i++) {
data[i] = random.nextInt();
}
long startTime = System.nanoTime();
//Measure Time between these two lines of code
long endTime = System.nanoTime();
long duration = (endTime - startTime);
System.out.println("Took " + duration + " ns");
}
Takes 2000 to 3000 ns
But when i remove the array creation:
public static void main(String[] args) {
long startTime = System.nanoTime();
//Measure Time between these two lines of code
long endTime = System.nanoTime();
long duration = (endTime - startTime);
System.out.println("Took " + duration + " ns");
}
It only takes 100 to 200 ns
Does anyone know why?
whats an enum
?learnjava ig
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.
dont benchmark like this
then how do i, without setting up some super complicated software
Use a benchmarking library
no
that sucks
