#help-development
1 messages · Page 2273 of 1
intellij
Could you show me a screenshot of how the window looks right now
DM me or verify for screenshots
I'm curious if your setup is correct since 1.18 pom isn't a module
Is the GameProfile no longer available in 1.19?
No
Well what you need it for
It was changed a bit
If it's for skulls just use the api
Where is the API located?
I really should write this down... this is the 5th time I help someone with this lmao
1 sec
hi, I want to print the names of each configuration section of my config.yml like this:
minigame1
minigame2
minigame3
and my config.yml might look something like this:
minigames:
minigame1:
key: value
minigame2:
key: value
minigame3:
key: value
so I used the following code:
for (String configSection : getConfig().getConfigurationSection("minigames").getKeys(false)) {
player.sendMessage(configSection);
}
but it only prints the first section (minigame1) when I want it to list through all of them. Any ideas?
https://hub.spigotmc.org/javadocs/bukkit/org/bukkit/Server.html#createPlayerProfile(java.util.UUID)
Here's a rough list of everything you need
declaration: package: org.bukkit.profile, interface: PlayerProfile
declaration: package: org.bukkit, interface: Server
declaration: package: org.bukkit.inventory.meta, interface: SkullMeta
declaration: package: org.bukkit.profile, interface: PlayerTextures
For the url decode the base64 and read the json
It would be best if you showed the actual config
Since that code doesn't match the one you provided
thanks
oh yeah sorry ill fix that
ok I edited the message
anyone able to direct me a forum how to use NMS
Be more specific
Just importing it to the project or?
Also what version. NMS is very version dependent
Hm looks fine. Make sure it's loaded in to memory and that the values actually exist
Rum BuildTools and replace spigot-api with spigot in your pom
?bt
ok thanks
just run it normally or in my project file?
BuildTools can be run anywhere on your system
I'd create a new folder for it
Run it and delete it after
will the regular spigot api still be accessible
Yes
how do i change my java version
Are you on windows?
yea
Install Java 16 at https://adoptopenjdk.net/?variant=openjdk16&jvmVariant=hotspot
^ same link just select 8 on top
i have and i need java 8 but its set to java 17 atm
change ur JAVA_HOME and update PATH envvars
already tried
didnt work
Did you restart cmd
ye
Could you show how you set your path
welp nvm, the java 8 instal i had was saying it was already on my pc but using the link u sent it worked
is there a way to dynamically get a value from a configurationsection? if i had something like this, it either throws a classcastexception when its a string int bool etc, or returns null if it is actually configurationserializable
private static <T extends ConfigurationSerializable> T getValue(String path, Class<T> clazz) {
return config.getSerializable(path, clazz);
}
clazz.cast(config.get(path))
doesnt actually get it as the instance of the class though, say the class i wanted to get it as was a material, it would just return it as a string
you'd need to handle enums and all
You would need to add a way for it to convert a string to material
Material is not ConfigurationSerializable iirc
turns out I just had an indentation problem in my yml. thanks for you help though!
just realized this lmao
^ it's an Enum
public void spawnArmorstand(Player p, int x, int y, int z) {
Level level = ((CraftWorld)p.getWorld()).getHandle();
ArmorStand stand = new ArmorStand(EntityType.ARMOR_STAND, level);
stand.setInvisible(true);
ClientboundMoveEntityPacket Velocitypacket = new ClientboundMoveEntityPacket(stand.getId(), x, y, z, true);
ClientboundAddMobPacket Standpacket = new ClientboundAddMobPacket(stand);
((CraftPlayer)p).getHandle().connection.getConnection().send(Standpacket);
}``` from ```ClientboundMoveEntityPacket Velocitypacket = new ClientboundMoveEntityPacket(stand.getId(), x, y, z, true);``` ```'ClientboundMoveEntityPacket' is abstract; cannot be instantiated``` yes i understand what that means i just dont know how else it would be done (1.18) im trying to apply a velocity to the armorstand
Use your tools and try to find implementations for the abstract class
^
Ctrl + Right Click goes into source code
Right click and click view implementations for the class header if you want to see implementations
right click what
The class header like the name
It appears to be a static class
why is it telling me the first =
is redundant?
You're not using the value
what do you mean
You aren’t using the variable for anything after
ahh i see so just like set the meta after or something
No you just need to use first for something
i still cant fingure out how to do this the ctlr click thing didnt really help i didnt see anyway to move it other then public Vec3 updateEntityPosition(Vec3 var0) { but i dont believe thats velocity
Try PacketPlayOutEntityMove or PacketPlayOutEntityTeleport
I did it with ProtocolLib
Lacks a lot of methods but I only need these to make a mystery box
¯_(ツ)_/¯
what is the easyest way to start
to start what
lol
assuming you mean plugin development altogether, then go learn basic java if you haven't already, then consult the spigot wiki on how to make your first plugin
https://www.spigotmc.org/wiki/creating-a-blank-spigot-plugin-in-intellij-idea/
or
https://www.spigotmc.org/wiki/creating-a-blank-spigot-plugin-in-eclipse/
(there's ones for netbeans and vs code too, but I rarely hear of them actually being used for plugin development)
The home of Spigot a high performance, no lag customized CraftBukkit Minecraft server API, and BungeeCord, the cloud server proxy.
The home of Spigot a high performance, no lag customized CraftBukkit Minecraft server API, and BungeeCord, the cloud server proxy.
there's several other resources on just the wiki about how to use the basics as well, like commands and event listeners
FactoryManager = https://paste.md-5.net/icoridofah.cpp
Config.yml = https://paste.md-5.net/asujiwudir.pl
1.8 
its so i can multiversion
Become based, only 1.16+ 
hi, i tried debugging this, and just everything else. I can't figure it out, please help.
if(!p.getItemInUse().equals(new ItemStack(Material.AIR, 0))) {```
i tried debugging
it said that the thing was
ItemStack{AIR x 0}
So generally, it's considered best practice to compare materials and not itemstacks, especially when trying to figure out if something is Material.AIR or not.
Oops wrong channel
What's best practice when writing the onCommand() and you have a bunch (20+) of commands? Case switch?
you could either use one of the thousand different command frameworks there are, or just make an abstract class that you trigger depending on the subcommand. switch case works but it’ll get messy after a bit
this is how I do it most of the time
Thanks both! I have a second, broader question - I'm mainly a front-end developer so my Java is rusty and I'm totally new to Spigot, but where can I learn best practices? A lot of YouTube tutorials are made by very young (albeit helpful and capable) developers, and I feel like I'm picking up a few bad habits sometimes by following them. Aside from looking at the docs directly, is there a resource most devs stick to?
I'd stay away from the tutorial videos as they are full of issues. There are some good channels, but most of them aren't great. One of the good ones would be TheSourceCode His tutorials are great for beginners. The forums are also a place that has a lot of information. You can usually find what you are trying to do just by googling it. spigot <what you are trying to do>
Other than that, it's just java. You can also find tons of help on StackOverflow.
For sure. Somewhat related, is it a Java thing to use single character variables for things? That's probably my biggest grief with the code I see from tutorials, which imo just makes code less readable. Ty for the suggestions btw!
Do you have an example of what you are talking about?
It's totally nitpicky but something like Player p = (Player) sender; instead of Player player = (Player) sender;
Could also just be a personal preference thing
Yea, it's a thing. Usually, we try to recommend the latter approach as code readability goes a long way. It can be seen as a preference, but most people here use descriptive variable names.
That's good to hear lol
You mean Player player = (Player) sender; instead of Player p = (Player) sender; right?
Because the latter is objectively worse.
I'm saying I would see people in tutorials with lots of variables in this style: Player p = (Player) sender; which I agree is worse than a descriptive variable name.
I worded it weird haha.
unfortunately I can't really help with this, I learned java way long time ago lmao
?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.
The home of Spigot a high performance, no lag customized CraftBukkit Minecraft server API, and BungeeCord, the cloud server proxy.
Hello, I have this code: https://paste.gg/p/anonymous/8e556102be3e4d57b2bc1a11ccd76e14
Right now, I'm trying to do something like: java Map<BlockData, Double> ores = new HashMap<>(); ores.put(Bukkit.createBlockData(Material.SPRUCE_LOG), 0.125); // 12.5% ores.put(Bukkit.createBlockData(Material.BIRCH_LOG), 0.125); // 12.5% ores.put(Bukkit.createBlockData(Material.JUNGLE_LOG), 0.125); // 12.5% ores.put(Bukkit.createBlockData(Material.ACACIA_LOG), 0.125); // 12.5% ores.put(Bukkit.createBlockData(Material.DARK_OAK_LOG), 0.125); // 12.5% ores.put(Bukkit.createBlockData(Material.CRIMSON_STEM), 0.125); // 12.5% ores.put(Bukkit.createBlockData(Material.WARPED_STEM), 0.125); // 12.5% Mines.fillCuboid(loc1, loc2, Bukkit.createBlockData(Material.OAK_LOG), ores);
... and it looks like this in game: https://fwoostyhub.com/🔊🍾🤣🐲
In theory, it should all be 12.5%, but it's just... not
If there's an easier way to do this without math as they're all the same percentages, I would really prefer that. Just not sure how :P
you seem to make it a 12.5% chance of getting one of those logs
instead of 12.5% chance of per log
mm you have a funny structure here
Yeah... it's quite weird, but it works for my ores system 😂
the fix is you need a delta
private <T> T getRandomElement(Map<T, Double> entries) {
double sum = 0;
for(double value : entries.values())
sum += value;
Random random = ThreadLocalRandom.current();
double choice = random.nextDouble() * sum;
T result = null;
for(Map.Entry<T, Double> entry : entries.entrySet()) {
T key = entry.getKey();
double value = entry.getValue();
result = key;
choice -= value;
if(choice < 0)
break;
}
return result;
}
You can make something like this and apply your current system
Huh, could you guide me through how I could apply it? I've really never done two systems at once :P
and just add the oak log to your drop table
for(...)
BlockData data = getRandomElement(ores);
...
imllusion has got you covered on it 🙂
You can also do some pre-validation to your map
like setting an upper bound to 100%
normalizing every value if we go above that value
or if we're below that value, adding the missing percentage as the base item
even setting lower bounds too like if you never want it to be 0%
Should make the system a lot more robust
hey, so im making a custom invsee plugin, and need to access to inventory objects i made in a different class file, how do i do this?
?di
Guide to dependency injection: https://www.spigotmc.org/wiki/using-dependency-injection/
Just so I'm on the right trade, should it look something like this? java int x1 = -114, y1 = 62, z1 = -55; Location loc1 = new Location(Bukkit.getWorld("world"), x1, y1, z1); int x2 = -102, y2 = 52, z2 = -67; Location loc2 = new Location(Bukkit.getWorld("world"), x2, y2, z2); Map<BlockData, Double> ores = new HashMap<>(); ores.put(Bukkit.createBlockData(Material.COAL_BLOCK), 0.15); // 15% ores.put(Bukkit.createBlockData(Material.IRON_ORE), 0.15); // 15% ores.put(Bukkit.createBlockData(Material.GOLD_ORE), 0.05); // 5% ores.put(Bukkit.createBlockData(Material.REDSTONE_ORE), 0.04); // 5% ores.put(Bukkit.createBlockData(Material.DIAMOND_ORE), 0.03); // 3% for(something) { BlockData data = Mines.getRandomElement(ores); } Mines.fillCuboid(loc1, loc2, Bukkit.createBlockData(Material.STONE), ores);
you do the getRandomElement within the fullcuboid method
but hmm
we can skip the lower bound check if we do something like
double totalChance = sum... // the first sum loop;
Random random = ThreadLocalRandom.current();
// inside loop
BlockData data;
if(random.nextDouble() < totalChance)
data = getRandomElement(...)
else
data = baseData;
set...
I'm making a lag notifier that needs to run every minute, would I create a separate class and put a bukkit runnable in that, or a method inside my lag notifier class to initialize a runnable?
Uhmmm, I'm so lost I'm sorry 😅
what would be the best way to add multi version support to a plugin that uses a decent amount of nms? rn im just going the approach of making a different NMS class for every version, but i think that could get a bit difficult and i would also have to run buildtools a ton of times to get the names of fields
I do think this is the best approach. I would have a module for each version containing version specific code using some interface implementations
Start one runnable that always runs every N ticks. If you have a message to display, send it otherwise do nothing.
Multi module project.
Your core plugin only uses interfaces and each module provides an implementation for those interfaces.
On the start you check the version and use the implementation for it.
yeah, think im probably going to go that route
is there a list out there of obfuscated fields/methods for nms? or do i just need to install all the different versions and see for myself
neat
How can I enable outer layer of skin on NPC?
?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!
How do i shadow with gradle on a multiproject build?
IIRC bungeecord needs an online player on the target server to work doesnt it, or else it just flat out doesnt work?
Remember a lot of talk around that in here before
@tawdry lava use dependency injection or a static getter
?di
Guide to dependency injection: https://www.spigotmc.org/wiki/using-dependency-injection/
np
you start normal like you always do, rightclick on your project and new > module
is maven better or gradle in terms of simplicity?
gradle is shit
gradle is defo simpler for a lot of things
Its some weird limitation the plugin messaging system has
If no ones online plugin messaging just yeets itself (From what i heard)
it only sends the message to servers which has players on it
The communication happens through the connection of a player. So the spigot server basically sends a packet to the player
but it gets intercepted by bungeecord.
Why do you send a message to a spigot server?
The spigot server does not decide when to connect a player.
Oh this is from a command framework. Ok let me look at that again.
Ok why do you want to use the "bungeecord:main" namespace if "BungeeCord" works?
That would be news to me
@scarlet swallow @lost matrix how to create a workspace in intellij that has multiple project modules?
any idea?
like we do in eclipse
Just create a maven project and add modules...
can u help me
i mean ill be screen sharing
hmmm?
@lost matrix
?
what shld i select
i already told you
maven
You can as well just create a minecraft project if you are using the mc dev plugin.
And then you just add modules like GodCipher told you
Right click the tab and New -> Module
its stays inside the main folder
yeah like that
what next
u see i hv already created a project
i want to add another in same list
You can use the previous project
The Minecraft Development project, and just delete the src folder
what shld i do
And then create the module
I'm not sure but I use the "New Module".
Just put the name of the module and click Create.
The parent automatically will be added.
And on the parent pom you will have a list of modules too
hey earlier i asked a question about accessing objects in different classes and was directed to dependency injection. idk if its just me not being as experienced, but I can't figure it out and how to apply it to my plugin, can someone help?
how can i create an instance of my main class
show us what you dont understand
?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.
bruh i know java
Mainly I have a module called core, that will contains all the main thing such as a class that extends JavaPlugin etc.
i want to know how to
This is how my folder structure look like
https://prnt.sc/5WPuK8DHjMTK
can i dm you the screenshots? i cant post them here
#verify yourself
okay hold on
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.
because you didnt choose a configuration to run
ikr
i want to know what shld be the type
i want to know what to select
maven obv
hear me out
no
mvn clean install
Okay, so I am trying to access targetInventory and my player object in a seperate class, I cant bring them out of the method because they rely on the args parameter
ok
Thats a very basic java question...
my b
can you answer it, or atleast guide me to where i can? i looked at the stuff about dependency injection
Dependency injection isnt the thing you need rn
like 4 people have told me to go learn it
what is then?
First of all, that question is somewhat vague. Object references are passed around everywhere in Java, and the how is based on what you are trying to achieve.
Im trying to be able to pass the objects into my listener class
What is your end goal?
im trying to learn spigot, and thought that a custom invsee plugin was a good choice, but i need the inventories to use in the InventoryClickEvent
looks like you are trying to learn java
the InventoryClickEvent already provides an inventory
i worded that poorly, i need to be able to use those specific inventories in the event
which will be provided once a player clicks their inventory
what you want is to identify if the inventory belongs to your target player
means, that you will have to keep track of what player specs whos inventory
i would go the OO way, but for your needs a Map of uuids would do the magic
okay, i think i see what you mean n how i would go about that, thank you
I wonder if you can go about it without Listeners
i dont see how i would
Absolutely not xd
probably
i mean for what do you need a listener in an invsee plugin
oh well
to not take out the items
just let them steal it
easy dupe
Ohhhh
what a nice game concept. every hour you can steal an item from a player
I just assumed invsee includes potentially stealing
it wouldnt be stealing though, cause without the event you coudlnt modify the targets inventory right?
itd just be duping
it will directly modify the player's inventory
Sounds wrong to me tbh
if you open the same instance the changes should be applied or no?
yeah it should be applied
depends if bukkit clones the inventory internally or not
im not just getting the target players inventory and opening it, im taking it and copying the items into a custom inventory that has extra buttons to open the ec / clear inventory
Correct
make a page system and every page is an inventory of another player
this might be helpful https://www.spigotmc.org/wiki/creating-a-gui-inventory/
thats what i was thinking at first
i was gonna do /invsee and it would open a menu w playerheads n then you click to open their inventories
cant remember why i went a different way with it
nah thats lame
just make 2 arrow buttons, left and right
then you go to the next/previous player with it
oo smart thinking
but with fancy animations
i wont even add names too, so its a guessing game of whos inventory im lookin at
a game within the game
and make a random button
which exchanges every item with a random one
and a swap button which just swaps the item slots
what abt a swap button that swaps players whole inventories?
and add a roulette game where you can bet on if the inventory either gets cleared or remains
make players pay to not have their inventory wiped every 24 hours
that would be p2w
but that could be something
eula smhula
let players play for their inventory
roulette. if they win, double every itemstack. if they lose, clear the inventory
and if they win on green, make 3 chests with their inventories and give it to them
am i gambling addicted?
noooo
ofc not
fun fact did you know that 90% of gamblers quit right before hitting it big?
lemme open csgo gambling sites rq
Technically, roulette means you have a better chance of winning than losing if you keep going
not if the 1st loss clears your inventory
$20 on black, red or green?
green
going risky i see
you should defintely go in a vc and screenshare this
fun fact did you know that 90% of gamblers quit right before hitting it big?
hey, so I have import org.bukkit.attribute.Attribute which allows me to use things like p.getAttribute(), but it doesn't exist in older versions like 1.8-1.12.2 (didn't check all versions), but i want to make it work on 1.8-1.19, does anyone know how I can do that? or at least how can I replace getAttribute("GENERIC_MAX_HEALTH") with something else?
or is p.getMaxHealth not locked in older versions?
but @hybrid spoke how would i actually go about modifying the target players inventory when the player moves things in the custom inventory
IIRC older plugins used reflection for max health
Yea I'm kinda new to spigot, what exactly is reflection?
It's a java thing. Allow you to access fields and methods, even restricted ones
Alright thanks, I'll figure something out
When programming for mc, we mainly use it to access the NMS (net.minecraft.server) which is the mojang root of the server
lool
thats when i ctrl click that bullshit method and scream "Wtf are you even doing"
Idk about yall, but i argue with every method i write
jokes on you
pls
it has no idea what to choose for loadHomes: https://paste.md-5.net/woberovole.java
wait lemme edit with da fuction interfaces
where are you calling it?
that scares me
*cough* *cough*
ive been working with this shit for like
forever
sec
its literally just chains of captures....
reference or optional?
oh no
check this
optional.orElse(null) kekw
Optional.empty() 
what the
not putting the return in the try :bonk:
optional.empty()
ez
discord lag smh
bro discord come on
this is ridiculous
fucking hell SEND
good design
i saw that earlier too
and i was like ill change it soon
google forced me to use deprecated code
sorry im not chaining class captures to a optional completable future
fuck that
idek wtf going on there
try with resources but usually u"d put try (Connection conn = getConn())
it will close it when the scope finished
hm
same for ps
well yeah ps would but idk how ide feel about the method yeeting my connection xD
what if i wanna chain it and do a few different statements
ide have to reopen another connection unless your using a connection pool
wdym chain? like try (conn; PreparedStatement ps = ...; prep.. ps1 = ...)?
like
if i wanna do multiple withConnection's
withConnection();
thenDoThisWithConnection();
thenThis();
ah i get it
idk tho im not good with mysql
i heard your supposed to open and reclose the connection almost every statement from a lot of people
i just always kept the one connection with a keepalive ping, or the connection pool
never know if that ever is an issue or not tbh
Well connections are supposed to be long lived
But they might timeout or other things might happen
yeah thats what i figured and people always told me that and i never got that
Which is why a connection pool is the most optimal solution
I know MySQL connections naturally time out after like 5 mins
actually didnt need it
but wouldnt conn be close by the second one?
The connection pool won’t necessarily close the connection when you use close(), it will lend the connection back to the pool simply
but if you dont need it dont need
Yeah thats what i normally use when i did mysql but
i cba writing statements
conn will be closed at this point
Fourteen brush you use a connection pool?
If you do then it’s fine
if those are async that connection its closed
fucking discord
send my message
^
Altho that’ll technically always consume 2 connections
actually it doesnt
whats wrong with ya internet smh
my internets fine im watching wt and connected to my vps rn
but discord doesnt like me and grays my msgs out but i can receive msgs totally fine
ctrl+r
my internet was doing weird stuff yesterday
i tried to ping google.com and that worked but discord and webpages kept loading
even got a new router
it kinda annoys me that we never learned at school how to create a good database table structure
we learnt like half of it
i just make my own
Well your abstraction is extremely coupled
and then we had to implement it for our final school project and mine sucked so hard
uhh
Which is a slight issue
Bam
As you see in your own example you’re bound to use 2 connections there
ye that method doesnt make sense either but ill see when i write new impl what i actually need
Sure
mongodb > mysql
ong
some things are indeed cursed
store everything in txt files > db
Well they’re suited for different things
storing json in db 😎
I mainly just like working with mongo and java together ngl
Mysql becomes extremely overpowered when you need it’s relational advantage in terms of scalability
so easy to shove java objects into a db
Much more scalable than Mongo actually at that point
does this look good now tho?
7smile told me to not use a combination of owner and name as primary key
Yes
like we always learnt it at school ¯_(ツ)_/¯
I mean probably depends
In some rare cases name + owner might end up being a self checking key
No need for a kay pair there as the homes own UUID must be unique
In which it could be fine
i still added a new field which kinda sucks in my eyes
The owner doesn;t define if the Home is unique. Its own ID does
school learnt me weird stuff then
Not necessarily
Just not needed in this case
Yep
can you think of a case where it would be needed to use a double pk?
instead of adding another field
off the top of my head no. But I have recommended it in here a few times
No not a double one, but you’d probably have an algorithm of a binary operation that takes both owner and name
If you have a composition instead of an aggregation
ill explain later
public boolean onCommand(CommandSender sender, Command command, String label , String[] args){
if(sender instanceof Player){
Player p = (Player) sender;
if(p.hasPermission("evanishplus.vanish")){
if(invisible_list.contains(p)){
invisible_list.remove(p);
p.sendMessage("you are no more vanished");
}else if(!invisible_list.contains(p)){
for (Player people : Bukkit.getOnlinePlayers()){
people.hidePlayer(plugin, p);
}
invisible_list.add(p);
p.sendMessage("you are now vanished");
}
}
}
'hidePlayer(org.bukkit.entity.Player)' in 'org.bukkit.entity.Player' cannot be applied to '(net.d1axowy.evanish.EVanishPlus, org.bukkit.entity.Player)'
how can I fix that?
what version ur on?
1.8
makes sense then, i guess use the hidePlayer(Player)
also use a Set<UUID> instead of a arraylist
thx though I am not really the best at java and spigot, so I'd like it to remain how it is, which version should i set for what i have now to work?
Anyone here experiences in deploying things to a linux server
I want to have my java program where i have it installed like a linux service, but also being able to go in and out of the console to view the logs, anyone have a good guide by chance?
ugh atleast not 1.8 unless you want that weird pvp stuff
would 1.8 work?
i mean 1.12
my brain didnt work while typing this msg
Hmm maybe the word im looking for is daemon
uhh people would say to use latest version but im on 1.17
I just install Pterodactyl for easy access
im using tmux to manage different things and then sshing to my server smh
You think oracles free cloud could handle that?
Yeah
the service im running is quite heavy
alright thx
why are you even on 1.8
i just slap them on my machine and run them in a new window
its bad
https://dzone.com/articles/run-your-java-application-as-a-service-on-ubuntu
This guide seems promising
im not the best at making plugins for multiple versions, and with simple plugins if i set the version to 1.8, it should work for 1.8-1.19
yes
thats how it works
yea
i guess a daemon is the best way to run multiple non mc related things
i just dont know if pterodactyl opens lots of threads
my program is fully async, it needs as much cpu as possible
and memory too
i bought the cpu so im gonna use the whole cpu lmfao
startup
classic
If I want to do tips above blocks like "Right Click to Reload" only when player is near
Should I do it every tick? or every second
why am i always solving my own coding problems when laying in ma bed :/
what
Do you want it when they hover over it
ye
ye but if it would kill server if I would update every tick
nametag will show on hover
but they gotta hover close to it, so if you want them to be farther youll need a checker
wdym by closer
2blocks?
like the normal entity reach
oh therefore its great
What do you think is better for users when choosing a color, decimal or rgb values? I want them to input the color through chat
I guess that's kinda true
like enter numeric value for red, then green then blue
and then the alpha if mc supports it
yeah or I was thinking about something like r[int]; g[int}; b[int]
rgb(0, 0, 255)
can have multiple ways setup for it
yeah sure
that way if users dont like one way they can do it another
the plugin that makes it like that
people are idiots
doesn't show up for me even tho im like 1mm from it
You gave the armor stand a name right
as.setCustomName(ChatColor.DARK_GRAY + "Right click on box to refill Ammo");
as.setCustomNameVisible(false);
how would i make sure some methods will run every X ticks or every X seconds
is the armor stand actually spawned in too?
?scheduling
Bukkit Runables
yes
when I set customNameVisible to true it displays fine
also my armor stand is invisible
How can I tell if a block is solid or not? E.g. I want to filter out something like dirt, stone, logs, but ignore flowers or tallgrass or those non-solid blocks
Material class has util methods for that like isSolid and occluding etc
Ok thanks
Is there something simpler to remove whitespaces at the beginning and end of a message than this?
if (Character.isWhitespace(message.charAt(0))) {
message = message.substring(1);
}
else if(Character.isWhitespace(message.charAt(message.length() - 1))) {
message = message.substring(0, message.length() - 2);
}```
String#trim
oh of course 😂 thanks!
why isn't it being removed?
private boolean isConfirmed(String playerName) {
if (toBeConfirmed.contains(playerName)) {
toBeConfirmed.remove(playerName);
return true;
}
toBeConfirmed.add(playerName);
new BukkitRunnable() {
@Override
public void run() {
SmartClearCommand.this.toBeConfirmed.remove(playerName);
Bukkit.broadcastMessage(""+SmartClearCommand.this.toBeConfirmed);
}
}.runTaskLater(NeoPerformance.getInstance(), 20*10L);
return false;
}```
what is toBeConfirmed?
in the list
for a command
you need to run it twice
but in the runnable it doesnt remove it from the list
you don't need to check if it contains the playerName, just call #remove(), it already takes care of that
if (toBeConfirmed.contains(playerName)) {
toBeConfirmed.remove(playerName);
return true;
}```
ah I see since you want to return
return toBeConfirmed.remove(playerName)
Ah wait you only want to return if removed
please change that to 10 * 20L
So if(toBeConfirmed.remove()) return true;
Is there a nice way to simplify this?
String input = "120 49 244";
String[] rgb = input.split(" ");
if(getPlugin().isInt(rgb[0]) && getPlugin().isInt(rgb[1]) && getPlugin().isInt(rgb[2])) {
}```
int[] rgb = new int[]{120,49,244};
and then you can skip the if
or do you mean that as input example
yeah that was just an example
if the user messes up and does something like 40 toast banana i wanna tell him he messed up
if the numbers are small enough you can remove the whitespace and
try catch with Integer.parseInt
if they get larger then it might overflow
it should be possible to make it so your command has to contain numbers
dont ask me how tho
it's not even a command it's just a raw chat message
Oh I see what you mean, since it's rgb the number can only reach 9 digits (255255255)
would this also work if the first number is a 0?
you need a separator
I mean since it's just for the validation and you dont use the validated number it would also work with 0
If you need to use the 9 digits directly and you only get 8 digits after conversion you would know that it has to be 0xxxxxxxx
but if you parseint the full 9 numbers it will only remove zeros at the beginning
So any missing digit after that is a 0 at the beginning
Hm okay, I actually need to store all 3 values afterwards
You can either cast them to integers after or you do it by dividing/bitshifting which might be a bit of a hustle unless you really need that little extra performance
Alright, I'll try my luck
that doesnt look like minecraft logs
wtf is minecraft
on not this again
i had three different people quote me that just with different titles
im so done
*in the last 12 hous
why doesnt ``` public void spawnArmorstand(Player p, Vector v) {
Level level = ((CraftWorld)p.getWorld()).getHandle();
ArmorStand stand = new ArmorStand(EntityType.ARMOR_STAND, level);
stand.getBukkitEntity().setVelocity(v);
ClientboundAddMobPacket Standpacket = new ClientboundAddMobPacket(stand);
((CraftPlayer)p).getHandle().connection.getConnection().send(Standpacket);
}``` do anything? i want to spawn an armorstand at the player and give it a velocity but with this nothing happens, no armor stand spawning or velocity, 1.18 and no console errors
lets google that error
did you know that a C++ success message has an ERROR CODE
Are you on newer mc version(s)?
1.18
if so just use normal bukkit code and youll be fine
yeah
you dont need nms for that haha
no but i need it for 1 player
wdym
Just in debugging wise
FATAL ERROR in native method: processing of -javaagent failed, processJavaStart failed
*** java.lang.instrument ASSERTION FAILED ***: "!errorOutstanding" with message find class on InstrumentationImpl failed at ./open/src/java.instrument/share/native/libinstrument/JPLISAgent.c line: 494
*** java.lang.instrument ASSERTION FAILED ***: "result" with message instrumentation instance creation failed at ./open/src/java.instrument/share/native/libinstrument/JPLISAgent.c line: 402```🤡
doesnt 1.18 provide a #hideEntity method
You know what i think it does but does it have a LivingEntity argument?
when i package the plugin it creates like 6 different jars would me using the wrong jar be the issue?
you need the one that has remapped in the name and doesnt have obf behind the remapped
Entity doesnt but LivingEntity might
alright thats the 1 im using already
https://hub.spigotmc.org/javadocs/spigot/org/bukkit/entity/Player.html#hideEntity(org.bukkit.plugin.Plugin,org.bukkit.entity.Entity) player has it. he can just hide the armorstand for others
ohhh its a player method
thought it was a Entity method haha
yep that would work tho 100%
.showEntity is deprecated
Thats what a Player is haha an Entity
Hence why i thought like Entity#hideEntity(player)
and that entity is hidden for player
speaking of an actual entity, not a subclass
but it was other way around
ah nice i know atleast where the error comes from smh
always fun when c code crashes
It doesn't already shade into the jar.. That's the problem I think
lets try another jdk
No you're shading it
Stop doing that
If you're using maven send your pom and I'll check
lmao eclipse jdk doesnt have the problem
?paste
why doesnt ``` public void
After a day, he magically settled himself and now does the shade inside the plug-in and finds the class, this is the result: https://paste.md-5.net/isiqopikeb.xml
whats buildtools
Set scope to provided
The thing you use to get spigot
It's how you get the spigot jar
No just the regular spigot jar
ah
ah and tf is this
PortableGit
ah fun now it complains bout my java version smh
viruz installing, please wait...
how do i run it with java 17?
how it feels to run without Git Bash
Just use a J17 Install bro
i did the bat thing
Install the new java, then change the JAVA_HOME path to the new folder
No that's what you've done if you downloaded the spigot jar
never used that xd
guys can anyone help me with imageonmap plugin? Its not working on 1.19*
(though paper is fine)
send how ur launching it
i did this thing lol and clicked it
just change the "java" text to the path to the jre u want to use
hmm
Yeah, either update your PATH var or change the java path on the bat
like "C:\Program Files\Java\jdk-17\bin\java.exe" -jar
(isContained,exc) -> {
if (exc instanceof Exception exception) {
return new ContextImpl<>(Result.no(exception), user);
}
if (exc == null) {
return new ContextImpl<>(Result.yes(isContained), user);
}
SneakyThrow.sneakyThrow(exc);
throw new AssertionError("Unreachable code");
}
So I'd need a second opinion, should I handle all exception (even Throwables), or do I just handle Exception instances (which I do as of now)? I know many of Throwable instances are Errors and not suppose to generally be caught but still 
cant you do throw SneakyThrow.sneakyThrow(exc); btw
yeah thats what Im doing as of now, but well I could make it so that I always return the exception instance (with a result object) rather than rethrowing it
rare md sighting
this one ig
This is what I use for now```bat
@echo off
curl -z BuildTools.jar -o BuildTools.jar https://hub.spigotmc.org/jenkins/job/BuildTools/lastSuccessfulBuild/artifact/target/BuildTools.jar
set /p Input=Enter the version: || set Input=latest
if %Input% LSS 1.17 (
set cmd="C:\Program Files\AdoptOpenJDK\jdk-8.0.252.09-hotspot\bin\java.exe"
) else (
set cmd=java.exe
)
%cmd% -jar BuildTools.jar --remapped --rev %Input%
pause```
Generally anything but ThreadDeath is okay to xatch
@chrome beacon I've another small problem rn lmao
java.lang.NoClassDefFoundError: me/vagdedes/mysql/basic/Config
(That's a jar lib, registered in the pom )
Hmm OutOfMemoryError seems to be a dangerous one as well
but ye
Yeah that one too
You shouldn't use jar libs directly like that. Also you need to shade it
But some Errors are fine to Catch auch as ClassDefNotFoundError
true
There isn't a maven lib for this https://www.spigotmc.org/resources/mysql-api.23932/
but Itd be a hassle to check individual error types just to sort out those that arent supposed to be caught
or well
so I think at least
Though arguably you can Just decide to rethrow anything that extends error
Catch throwabke, rethrow error
You the install-file command to install that jar
Also it says that's a library plugin
So try placing it in the plugins folder
I thought about it but then I went to see better... says that it is used by Spartan, then I went on the spigot page of Spartan Anticheat and it doesnt ask for dependencies, I think a shade should do the job... But how can I shade the jar inside the project?
Open the jar and see if there is a plugin.yml in it
3000 IQ
yep, there is
Ok so don't shade it
maybe better if I do it the old-fashioned way and remove this, it would make it harder for anyone who downloads the plug-in
thank you olivo
How can I give any entity animations?
for example wardens when he climb up from ground
Havent touched an ide in forever so might just be stupid and this was a project from abit ago
https://paste.md-5.net/uzijososuy.bash
Line 68 is
List<Punishment> bans = data.getPunishments().stream().filter(punishment -> punishment.getType() == PunishmentType.BAN).collect(Collectors.toList());
.
I have literally no clue how it could be null;
I tried filling bans, mutes and everything I check for here with atleast one
item.addLoreLine("&aBans: &f" + bans.size());
item.addLoreLine("&aBlacklists: &f" + blacklists.size());
item.addLoreLine("&aMutes: &f" + mutes.size());
item.addLoreLine("&aKicks: &f" + kick.size());
item.addLoreLine("&aWarns: &f" + warns.size());
and I use this exact same code here (totally different purpose) and it works;
@Override
public ItemStack getItem(Player player) {
ItemBuilder item = new ItemBuilder(AMaterial.retrieveWoolFromData(3));
item.setName("&bBans");
item.addLoreLine("");
List<Punishment> bans = punishData.getPunishments().stream().filter(punishment -> punishment.getType() == PunishmentType.BAN).collect(Collectors.toList());
item.addLoreLine(PunishmentUtil.MAIN_COLOR + "Currently banned&7: " + (punishData.isBanned() ? "&aYes" : "&cNo"));
item.addLoreLine(PunishmentUtil.MAIN_COLOR + "User was banned " + PunishmentUtil.SECONDARY_COLOR + bans.size() + PunishmentUtil.MAIN_COLOR + " times.");
item.addLoreLine("");
return item.toItemStack();
}
are you using ide?
ofc lmfao...?
"it" could be null. What could be null?
A punishment could be null which would result in an npe
"data" could be null
And if you use the exact same code twice then why dont you make a method for that?
wdym by "it", the actual punishment isn't null as it not only goes through and writes into the db but I can get it in other ways, it's just for some reason here where it doesn't work
how can i apply velocity to a packet armorstnad? ``` public void spawnArmorstand(Player p, Vector v, double x, double y, double z) {
Level level = ((CraftWorld)p.getWorld()).getHandle();
ArmorStand stand = new ArmorStand(EntityType.ARMOR_STAND, level);
stand.setPos(x, y, z);
stand.getBukkitEntity().setVelocity(v);
ClientboundAddMobPacket Standpacket = new ClientboundAddMobPacket(stand);
((CraftPlayer)p).getHandle().connection.getConnection().send(Standpacket);
}``` doesnt work, nothing happens but the armorstand does spawn and no errors in console (1.18)
because it's displayed very differently and there is more to it then I've shown
but the idea of getting the number stays the same
Btw you should not collect the whole list if you dont need the entries. Just count them.
First of all: Tell us what doesnt work. Do you get any exceptions?
long bans = punishData.getPunishments().stream().filter(punishment -> punishment.getType() == PunishmentType.BAN).count();
I do /punish "username" and get a null pointer. The command SHOULD open the "main menu" which only gets the number of bans / kicks ect from the db
everything else is just taking to another menu which has it's only pulls in a seperate class, I have commands to open these separately and it works fine so that has nothing to do with it
Show the npe and the method that causes it
let me check if I need anything else from the field, otherwise I'll use this, thanks
I do
here
It says line 68 but...
Well either "data" or a "punishment" is null. Check which one it is
enabled my plugin for the first time and got so many exceptions lmao
huh whats wrong here?
replaced it but doesnt work
I think that parser is tweaking
try using " instead of ' around yoru string in that line
nop
when i remove the whole block its good```yaml
home:
limit-reached: "&cYou have reached the maximum amount of homes!"
already-exists: '&cYou already have a home with that name!'
no-homes-created: '&cYou haven't created any homes!'
created: '#83c916You have created a new home, %s'```
ohhhhh
i thought that was replaced automatically
nms velocity
still seems to give errors
if not wrapping the whole string with ".." use a double ' like haven''t
nothing seems to work only removing the '
"" should allow '' inside
It does. Even allows numbers for keys
seems to work now
DM me if anyone wants to hire developers
?services
If you wish to request or offer development/art/building/administration services, please do so at https://www.spigotmc.org/forums/services-recruitment-v2.54/
?services
If you wish to request or offer development/art/building/administration services, please do so at https://www.spigotmc.org/forums/services-recruitment-v2.54/
ha

how to forceload chunk?
Could someone guide me if I'm doing it right, i want to set servers names as tabcomplete arguments and then get the address to display the address
https://hastepaste.com/view/CAJTLA353
I just ran into the good old problem that comments are not being saved when saving the config file.
getConfig().set("Setup-Plugin", setup);
saveConfig();
}```
Anything I'm doing wrong?
1.19 btw
check docs for chunk class
pretty sure you have to config#options().copyDefaults(true) to preserve comments
Trying that now
You are using a lot of confusing language here. The code seems convoluted and a bit weird but it should work.
seems there is a setting to force comments now https://hub.spigotmc.org/javadocs/spigot/org/bukkit/configuration/file/FileConfigurationOptions.html#parseComments(boolean)
nope comments are still gone after saving something :(
minecraft already has that
what spigot version?
And the list goes on. Just take those statistics and display them in a gui.
1.19 newest
and not a fork?
paper
test it on spigot
okay
Well... You can listen to the StatisticsChangeEvent and create one Map<Statistic, Long> which is shared.
isnt there api code to get global statistics?
Are there any global statistics even?
hmm idk i was thinking about the singleplayer thing
Doesnt look like it
dunno if multiplayer has that too
Yes per-player
ah
For global you would just listen to this
https://hub.spigotmc.org/javadocs/bukkit/org/bukkit/event/player/PlayerStatisticIncrementEvent.html
declaration: package: org.bukkit.event.player, class: PlayerStatisticIncrementEvent
Well, I actually can't do that as I'm using Paper Components everywhere and I'd have to change half the plugin to run it on spigot
Then IDK what is going on here
@eternal oxide you mind if I send you a PM?
I just did java saveDefaultConfig(); getConfig().set("test", true); saveConfig();And comments were preserved.
Sorry I can't help. Works perfectly on Spigot
comment is in my default config.yml in the jar
same here
# Delay (in Seconds) before a regeneration starts.
# (The time between the explosion and regeneration)
delay: 10
# Frequency of regeneration (in server ticks).
# (How fast the regeneration runs)
frequency: 5```
Spigot 1.19 and compiled for java 16
Do free lines work? I thought comments have to be right above the setting
I canb try it without
https://paste.md-5.net/qenavifinu.makefile
That's what the config.yml looks like, anything wrong with it?
I'm doing it the exact same way I'm doing it in one of my other plugins where it's working
so weird
are you sure you are not doing something silly, like you already have a config saved with no comments so you are just loading and saving a broken config?
well getting all the values works fine
i'm trying to set spawned items to 2x their amount with this but i don't want dropped items to multiply, I tried to set the metadata of the dropped item then check for the metadata in the itemspawn event but that doesn't seem to work.
@EventHandler
public void dropEvent(PlayerDropItemEvent event){
Bukkit.getServer().broadcastMessage("dropped");
event.getItemDrop().setMetadata("dropped",new FixedMetadataValue(Lootsmp.instance, true));
}
@EventHandler
public void onItemSpawn(ItemSpawnEvent e) {
if (!e.getEntity().hasMetadata("dropped")) {
e.getEntity().getItemStack().setAmount(2);
} else {
Bukkit.getServer().broadcastMessage("dropped item");
}
}```
broken as in no comments not broken no data
How would I check if it does not find any comments in the file?
yep the new file has all its comments just like in the config.yml from the jar
why not use https://hub.spigotmc.org/javadocs/spigot/org/bukkit/event/block/BlockDropItemEvent.html and double the drops
huh i forgot about that event, that is probably what i'm looking for thanks
How it looks like when it's just created
my eyes
at what point does it lose comments?
show some code that caused that
public void set(String path, Object o) {
plugin.saveDefaultConfig();
plugin.getConfig().set(path, o);
plugin.saveConfig();
}```
This is literally all I'm using
works fine on my other plugin using the exact same paper version too
You must be doing something differently then. config.yml file encoding is UTF-8?
No clue then. I can't replicate your issue on Spigot
:( Thanks for trying to help tho
which one is better i7 or amd 5950x
depends on what generation ig
both 10th gen
which i7 is the question
null at FactoryManager.java:65
didnt know List#replaceall was a thing
1.19.1 is the chat report update
1.19 cannot support 1.19.1
not even with via
i tested it a few days ago
"[22:04:43 WARN] [viaversion]: Due to technical limitations, ViaVersion does not support 1.19.1+ clients on 1.19.0 servers. Please update your server to a newer version."
There is nothign above 1.19 on Spigot yet
Well once 1.19.1 releases I will probably update the server to that, but I already have a patch to strip the new signing from everything.
probably not, but who cares about those?
isn't it off by default anyway
there's already an option to disable the chat entirely, not much you can do except tell them to turn chat on
their loss
I haven't really checked out how the secure chat option works, it might just be a setting to ignore invalid signing on player chat messages, but "system" messages will still get through
I strip out uuids and signatures associated with the messages
System messages will look the best 👌
I believe that way it just appears as a system message
They should show unsigned
And they got the red little exclamation point
Poor md5 has to redo the entire chat api ahaha
Mojang forcing API changes in all the wrong ways.
1.19.1 might have a decent delay
except they wont
since mojang decided to be stupid and add grey bars??
i wont even use 1.19.1 on my client because of the chat padding and grey bar stuff
ugly ugly
not sure what you mean
sounds like you're overcomplicating it though
Looks better then a red or yellow bar with an exclamation mark imo
Hot take
oh yeah that's what i thought it was at first