#help-development
1 messages · Page 1776 of 1
Ok yeah you're still really not showing enough code
It would be cache.get(uuid).get(string)
oh
Or you can use the aforementioned table, which would allow you to do this
Careful with null
I would use getOrDefault
Actually no
That would create an unnecessary hashmap
Regular null checking probably better
Map<String, LBHome> map = homesCache.get(uuid);
if (map == null) return null;
return map.get(name);```
private static final Map<UUID, Map<String, LBHomes>> homesCache = new HashMap<>();
public LBHomes getCacheHome(UUID uuid) {
return (LBHomes) homesCache.get(uuid);
}
public LBHomes getHome(UUID uuid, String name) {
return homesCache.get(uuid).get(name);
}
}
is bad?
Yeah
I would like to add houses and pull their name into the hashmap
Like this
if(homesCache.get(uuid).get(name) == null) return null;
return homesCache.get(uuid).get(name);
}
Map<String, LBHomes> maphomes = homesCache.get(uuid);
if (maphomes == null) return null;
return maphomes.get(name);
}```
Mhm
Map<String, LBHomes> map = homesCache.get(uuid);
return map != null;
}
public LBHomes getHome(UUID uuid, String name) {
if(!hasHome(uuid, name)) return null;
return homesCache.get(uuid).get(name);
}```
Uhh
hasHome will just return whether they have any home
You want to return if they have a home of that name
Or maybe you do just want to check if they have any homes, in which case you should remove the name argument
I want to check if he has a house with this name
Why stop at 2d
Looking for a partner for a crypto project. Any specific channel I should post in?
lmao
begone crypto bro
crypto is a scourge and this is a spigot development discord
?
Looking for some help with randomized worlds to gift to my nft holders as part of a larger gaming ecosystem
Does that not fall under development?
But now I am curious why you would think this, lol.
Well let's see
Crypto was meant to be a way to decentralize currencies and help people circumvent oppressive governments, or you know, be some type of currency
What with cryptocurrency being the name and all
I'm going to assume you have white privilege's before you even start
But less than 2% of trades in crypto are actually merchant transactions/sales
The remaining are all investments
So effectively, crypto is just another investment in... what exactly?
Nothing
Absolutely fuck-all
It generates no net value
It contributes net nothing to humanity
For one person to gain any money, someone else must lose money buying the crypto
So building a gaming ecosystem that is open source and provides real world tangible benefits while helping multiple non profit causes is nothing?
It's net zero
You can do that without involving crypto
More energy is used mining bitcoin than is used by the entire country of sweden
The environmental impact is enormous for something so useless
And NFTs are just the next step down the useless path
Says the one typing on the computer that was assembled by slave children in 3rd world countries
It takes a lot of energy to mint an NFT and their actual value is also pretty much zero
They're largely used for money laundering schemes
you part of the problem as well, what are you doing about it?
Love that argument
We atleast planted 50k trees and donating to help
Where we can
I am here looking for a developer to give a product to my holders, because we are developing a gaming ecosystem
a free gift
"let he who is without sin cast the first stone", right?
You can analyze things beyond just "this causes emissions" vs "this does not cause emissions"
Computers are essentially a necessary part of daily life and have contributed massively to human progress
The same cannot be said for NFTs and crypto
Yes, there are environmental costs to computers
They haven't iterated yet to that point
And we need to work on minimizing them
But there are great benefits as well
Crypto is net zero
If you understood the magnitude of smart contracts, lol
It produces no net value, for one person to gain another must lose
That's just how it works
We are talking about two different aspects of crypto
the one you are referring to has no impact on my project and we are not involved in that kind of fuckery
I also appreciate how you're deriving more things about my political views based on my stance on crypto too
But if you don't understand smart contracts I would say you should probably educate yourself as, decentralized autonomous organizations are a thing of the future
Do you know how many people are being lifted out of poverty thanks to it, people in third world countries?
It's not worth causing a chip shortage and the collective energy usage of sweden for the creation of something that is inherently worthless
distribution of wealth to the poor isn't worth a chip shortage?
lol
I'll check another channel or try back tomorrow.
Best of luck
Never heard of crypto lifting people out of poverty on any meaningful scale
The programs that lift people out of poverty are not decentralized ponzi schemes
Should read the story about a brother of ours we rescued from Iraq
Him and his family
2700 people crowdfunded the money necessary to move him out of the warzone
thanks to my energy sucking nft project
Crowdfunding is not exclusive to crypto
It's also a very dystopian view
Crowdfunding healthcare in the US is not uplifting any more than that is
All it is is a signal that we live in a dysfunctional society
This Forlane guy kinda annoying and cringe ngl
How to spawn fireball?
thanx
wtf is a gaming ecosysteam
What to write in class place?
anybody know how i can modify packets in buildtools? i wanna edit server packets but i cant seem to find out how
Uh
buildtools????
BuildTools does not contain the packet classes
You'd have to make your own patches for NMS.
missed one } prob
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.
that isnt what i asked but ok
didnt
`public class bedwarsgeysersupport extends JavaPlugin {
@Override
public void onEnable() {
//Disable if pl not found
if (Bukkit.getPluginManager().getPlugin("BedWars1058") == null) {
getLogger().severe("BedWars1058 was not found. Disabling...");
Bukkit.getPluginManager().disablePlugin(this);
return;
}
Bukkit.getServer().getPluginManager().registerEvents(new BedrockShopEvent(), this);
}
{
if (Bukkit.getPluginManager().getPlugin("floodgate-spigot") == null) {
getLogger().severe("FloodGate was not found. Disabling...");
Bukkit.getPluginManager().disablePlugin(this);
return;
}
Bukkit.getServer().getPluginManager().registerEvents(new BedrockShopEvent(), this);
}
@Override
public void onDisable() {
getLogger().info("onDisable is called!");
}
public void bedwarsGame() {
BedWars bedwarsAPI = Objects.requireNonNull(Bukkit.getServicesManager().getRegistration(BedWars.class)).getProvider();
}
}`
mate im slowly studying it
put our if in onEnablr
nooooooooooo
put ur code in the existing one
why make shit so complicated
could fit in one if
i want more then one message?
what’s the point of the void bedwarsGame
????
not even accessed ig
also why are you trying to register BedrockShopEvent twice
i just noticed
it’s a listener lol
- should be called BedrockShopListener
its in main file lol
:/
in gods name what
I think you made the problem worse
yeah
it is there?
yes that is where the problem is
`package io.github.creeperz653.bedwars1085geysersupport;
import com.andrei1058.bedwars.api.BedWars;
import io.github.creeperz653.bedwars1085geysersupport.events.BedrockShopEvent;
import org.bukkit.Bukkit;
import org.bukkit.plugin.java.JavaPlugin;
import java.util.Objects;
public class bedwarsgeysersupport extends JavaPlugin {
@Override
public void onEnable() {
//Disable if pl not found
if (Bukkit.getPluginManager().getPlugin("BedWars1058") == null) {
getLogger().severe("BedWars1058 was not found. Disabling...");
Bukkit.getPluginManager().disablePlugin(this);
return;
}
Bukkit.getServer().getPluginManager().registerEvents(new BedrockShopEvent(), this);
{
if (Bukkit.getPluginManager().getPlugin("floodgate-spigot") == null) {
getLogger().severe("FloodGate was not found. Disabling...");
Bukkit.getPluginManager().disablePlugin(this);
return;
}
Bukkit.getServer().getPluginManager().registerEvents(new BedrockShopEvent(), this);
}
public void onDisable () {
getLogger().info("onDisable is called!");
}
public void bedwarsGame () {
BedWars bedwarsAPI = Objects.requireNonNull(Bukkit.getServicesManager().getRegistration(BedWars.class)).getProvider();
}
}
}`
ok cool
now close the fuckin' method with } lmao
last error
nvm
i removed the }
and it fixed
unberable suffering
unbearable*
I think your brain cells are bustin'
or maybe burstin'
either way, they're dyin'
wasnt needed bruh
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.
we're just saying this problem would be fixed easily if you had basic knowledge of Java's syntax
5 links which explain just that
in all coding langs im shit at syntax
even the ones i know a lot
know em better
i end up fixing it
by playing with the file
changing stuff
if i cant figure out how to fixi t
i ask support
which is bad. because just fingering at code instead of understanding syntax
is shit
yeah ill study syntax tmr
how do you finger code
mine doesn't have any holes
Could not Rename File
pending ban
I mean I would if I could, my code is just that hot
like so hot that is_computer_on_fire() always returns true when I run it
sheeesh
nah I screenshot convos on the regular
bruh
I like sharing the funnies
also yes that means my friend group of like 4 other people has seen "unzip pants commit"
that has to be my status now
you're welcome
its not like here are more than 4 peopl
ye but everyone else here is lower class
they don't have enough social credit
unlike me and the boys (and single female thing)
mmmm I dunno if I'd factor you into this
but if it makes you happy
now my profile has the funny
sad :c
show error
no error
it auto enabled
it should have disabled
since i didnt have floodgate installed
`package io.github.creeperz653.bedwars1085geysersupport;
import com.andrei1058.bedwars.api.BedWars;
import io.github.creeperz653.bedwars1085geysersupport.events.BedrockShopEvent;
import org.bukkit.Bukkit;
import org.bukkit.plugin.java.JavaPlugin;
import java.util.Objects;
public class bedwarsgeysersupport extends JavaPlugin {
@Override
public void onEnable() {
//Disable if pl not found
if (Bukkit.getPluginManager().getPlugin("BedWars1058") == null) {
getLogger().severe("BedWars1058 was not found. Disabling...");
Bukkit.getPluginManager().disablePlugin(this);
return;
}
Bukkit.getServer().getPluginManager().registerEvents(new BedrockShopEvent(), this);
{
if (Bukkit.getPluginManager().getPlugin("floodgate-spigot") == null) {
getLogger().severe("FloodGate was not found. Disabling...");
Bukkit.getPluginManager().disablePlugin(this);
return;
}
Bukkit.getServer().getPluginManager().registerEvents(new BedrockShopEvent(), this);
}
}
public void onDisable () {
getLogger().info("onDisable is called!");
}
public void bedwarsGame () {
BedWars bedwarsAPI = Objects.requireNonNull(Bukkit.getServicesManager().getRegistration(BedWars.class)).getProvider();
}
}
`
there isnt any errors
bruh
.
?paste

yeah but its very compressed on a small ass laptop display
sorry for delay https://paste.md-5.net/ugeyerepus.java
and what exactly is not working?
wont disable if i dont have floodgate
Creeperz
is "floodgate-spigot" the original name? and why do you put it in an extra scope?
for what???
Bedwars geyser support
no?
No i found one on git before
you dont understand what the plugin is but k
It prob turns java gui to bedrock's modern thing
yeah no your caping
and thats the plugins name?
well the spigot servers need that one for it to work yeah
What name it shows when u do /plugins
^^
and also unnecressary scope change. remove those { } around your if statement
why isnt it disabling
what scope???
since you put {} around your check, its in another scope, completely unnecressary
can you high light
my brain is smooth
{ // <------------------------------------------------------------
if (Bukkit.getPluginManager().getPlugin("floodgate-spigot") == null) {
getLogger().severe("FloodGate was not found. Disabling...");
Bukkit.getPluginManager().disablePlugin(this);
return;
}
Bukkit.getServer().getPluginManager().registerEvents(new BedrockShopEvent(), this);
} // <------------------------------------------------------------
btw
i dont even have floodgate-spigot and the plugin isnt named that
so why isnt it disabling
could just guess here. try to debug. also you are registering your BedrockShopEvent twice
yeah how should i remove it
there is this thing called delete
i dont know the flow of your program. if it necressarily needs to be executed before everything else, the last one.
otherwise it wont matter
done remove extra event
should i test?
i got an error
wait
why the hell
is my main class
changed
I want to make sure I'm not completely off the reservation here. This is not exact code but it' should be enough to understand what I'm trying to achieve.
In the Config:
SubSection:
TrueOrFalse: True
In the code:
If (SubSection.get("TrueOrFalse"){execute code}
Or is my thinking wrong here?
The reason I ask is that IntelliJ freaks out at this and places a red line under it, suggesting to invert it making it:
If (!(SubSection.get("TrueOrFalse")){code}
Except that doesn't make any sense
simply said, you are completely off
Could you elaborate? What should I be doing to extract that "True" value?
you need to get your paths thing as a boolean
there is an method called getBoolean(String path)
Thank you
01:56:56 ERROR]: Could not load 'plugins/BedWars1085-GeyserSupport-1.17.1-R0.1-SNAPSHOT.jar' in folder 'plugins'
org.bukkit.plugin.InvalidPluginException: Cannot find main class `io.github.creeperz653.bedwars1085geysersupport'
at org.bukkit.plugin.java.PluginClassLoader.<init>(PluginClassLoader.java:73) ~[patched_1.17.1.jar:git-Paper-385]
at org.bukkit.plugin.java.JavaPluginLoader.loadPlugin(JavaPluginLoader.java:153) ~[patched_1.17.1.jar:git-Paper-385]
at org.bukkit.plugin.SimplePluginManager.loadPlugin(SimplePluginManager.java:414) ~[patched_1.17.1.jar:git-Paper-385]
at org.bukkit.plugin.SimplePluginManager.loadPlugins(SimplePluginManager.java:322) ~[patched_1.17.1.jar:git-Paper-385]
at org.bukkit.craftbukkit.v1_17_R1.CraftServer.loadPlugins(CraftServer.java:419) ~[patched_1.17.1.jar:git-Paper-385]
at net.minecraft.server.dedicated.DedicatedServer.initServer(DedicatedServer.java:287) ~[patched_1.17.1.jar:git-Paper-385]
at net.minecraft.server.MinecraftServer.runServer(MinecraftServer.java:1220) ~[patched_1.17.1.jar:git-Paper-385]
at net.minecraft.server.MinecraftServer.lambda$spin$0(MinecraftServer.java:319) ~[patched_1.17.1.jar:git-Paper-385]
at java.lang.Thread.run(Thread.java:831) ~[?:?]
Caused by: java.lang.ClassNotFoundException: io.github.creeperz653.bedwars1085geysersupport
at org.bukkit.plugin.java.PluginClassLoader.loadClass0(PluginClassLoader.java:151) ~[patched_1.17.1.jar:git-Paper-385]
at org.bukkit.plugin.java.PluginClassLoader.loadClass(PluginClassLoader.java:103) ~[patched_1.17.1.jar:git-Paper-385]
at java.lang.ClassLoader.loadClass(ClassLoader.java:519) ~[?:?]
at java.lang.Class.forName0(Native Method) ~[?:?]
at java.lang.Class.forName(Class.java:466) ~[?:?]
at org.bukkit.plugin.java.PluginClassLoader.<init>(PluginClassLoader.java:71) ~[patched_1.17.1.jar:git-Paper-385]
... 8 more
werid
org.bukkit.plugin.InvalidPluginException: Cannot find main class
check your plugin.yml for any typos
`name: 'BedWars1085-GeyserSupport'
softdepend:
- BedWars1058
- floodgate-spigot
version: '1.17.1-R0.1-SNAPSHOT'
main: io.github.creeperz653.bedwars1085geysersupport
api-version: '1.17'`
yeah no
wdym
you declared your path to your main class as your main class
not the main class itself
also check out javas naming conventions
seems like some evil hackers changed your main class path
or do you have any ghosts around you?
not funny
your main class is io.github.creeperz653.bedwars1085geysersupport.bedwarsgeyesersupport
huh
I might have mistyped that
let me check smh
so should i remove the
bedwarsgeysersupport
extra folder?
Just add ".bedwarsgeysersupport" to what you've defined as main in your plugin.yml
io.github.creeperz653.bedwars1085geysersupport.bedwarsgeysersupport
You wanna doublecheck that to make sure there are no typos but it should find the main class just fine then
yeah already did
this addon im making IS teach me a lot
about mc plugins
how do ik which one to download for the spigot api
im new to dis
a little confused
what version do you want your plugin to work in ?
1.17.1
im just following the guide on making one from scratch on intellij
it wants me to put the spigotAPI for the dependencies
The home of Spigot a high performance, no lag customized CraftBukkit Minecraft server API, and BungeeCord, the cloud server proxy.
im still preparing the IDE
im not exactly sure which of the following im supposed to use
"preparing the ide"
Hi guys I am trying to set a smoker to burning state I did something like that but I am getting this error Craftsmoker cannot be cast to block.smoker Block block = p.getTargetBlockExact(5); Material smoker3 = block.getType(); BlockState state = block.getState(); Smoker smoker = (Smoker)state; BlockData data = Material.SMOKER.createBlockData((blockData) -> ((Smoker)blockData).setBurnTime((short) 1)); p.sendBlockChange(smoker.getLocation(), (BlockData) smoker);
any -shaded one is fine
? who you replying to
i am...
are they different completely?
it will make it easy
yes
im not really sure where to find the maven one
The home of Spigot a high performance, no lag customized CraftBukkit Minecraft server API, and BungeeCord, the cloud server proxy.
you dont need to have a hard time figuire out spigot api jar
stuff
in pom.xml you can just type a version
lol
just read it
in case you dont own
jdk
????
go search the plugin minecraft development in intellij plugin searching
also works
it will do everything for you.
hmm?
so with the plugin installed i wont have to do anything?
sorry if im asking obviously stupid questions
im just trying to start a small project whilst learning to have some sort of application with what im learning
where would i go after installing the plugin?
ok wait nvm its convenient
tysm
is it possible to do sth similar to
public class eventManager implements Listener{
public Plugin plugin;
public eventManager(Plugin p){
plugin=p;
}
@EventHandler
public void onEvent(Event e){
plugin.hashmap.get(e.someKindOfOperationToGetWhichWorldThisEventWasTriggeredFrom()).dealWith(e);
}
}```
to separate event handling in different world instead of checking which world the event belongs to in every EventHandler?
pLeAsE sTaRt ClAsS nAmEs WiTh UpPeRcAsE lEtTeR
no
ye
which event?
all event that can be triggered from a world
hm i don't think you can do it with any event, you'd have to code your own implementation
ye
checking if the event is an instanceof another event, cast it and use methods from that event
it's painful and you probably don't need that
¯_(ツ)_/¯
also why do you need to listen for a general event?
bc i dont wanna check which world the event belongs to in every EventHandler
yes.
no not in spigot. you would have to got over the handlerlists iirc or listen to every event yourself
or packets might work
Packets and events are really different
they aren't. events are just received packets translated into an api
Absolutely no
Sure, packets sent by client causes events
But events arent got handled on packet level
events are mostly the result of a sent packet
Eh idk if I’d say mostly
i would
No. Those are for absolutely different things. Events can be caused without packet being sent. Event is not an api representation of packet, thats a representaion of game event. Packets is just the way for clients to interact with game.
I've never said that an event represents a packet. nearly every, or when we dive into the technological terme, everything that happens for the server and the player are packets. events are the result of a packet. a packet is being sent, evaluated and processed, sent to the opposite and, if there is a reason, translated to an event.
but you Just said..
a packet is being sent, evaluated and processed, sent to the opposite and, if there is a reason, translated to an event.
and i just did again, more clearer.
the perfect example would be the PlayerInteractEvent since you can't detect a rightclick made into air if the player doesn't hold anything in his hand because no arm swing packet is fired.
Hello
Can someone tell me a plugin that allows players with an permission enter my server although it is full
Needs to work on 1.17
?paste
there
It's supposed to give xp only on natural blocks(they arent placed) but its not giving exp on anything.. ideas?
Needs to work on 1.17 is urgent please
thats not how isPlaced works
you are getting the state of a Block in teh world. it will be placed
The best way you can work around this is to maybe add a metadata yourself to say it's been placed by a player
you can;t add metadata to placed blocks
Make the server slots the amount you want, then you can code/use a plugin to adjust what shows up as the player slots.
when a block is placed add its x/y/z to the chunk pdc. Then you can check to see if tis a placed block or original.
?pdc
Make the server slots the amount you want, then you can code/use a plugin to adjust what shows up as the player slots.
I dont understand, is there a plugin or no? Sorry for dont understanding im Spanish
Does metadata get removed when a server is restarted?
You are in the wrong channel to ask for plugin suggestions. #help-server
metadata does not persist. Thats what the pdc is for
damn... I just coded a plugin for a client which will most likely break on restart 😂
I thought it was persistent didn't know there was a whole thing for persistent data
hey, recently i kinda started my first 1.16 plugin which went well but I have seen something that i don't understand
which is RGB colors
i can't find how people added it to mc
it really looks cool and amazing but i still wonder how
ChatColor.of(color)
what about the gradient they do?
i know like 2 of those type of people 😩
is that even implementable in SpigotMC api?
anyone have any idea on how to fill remaining air slots in an inventory with a specified material? using a library to handle inventories btw
Uhm, sure?
or what do you want to implement
bruh alright nevermind then 😔
loop through the slots in the inventory, if it's air then set item
oh thank you
ty
That's super easy with normal Java
yeah i just realized that
guys
@EventHandler
public void test(PlayerInteractEntityEvent e)
{
Player p = e.getPlayer();
Entity en = e.getRightClicked();
if(p.getItemInHand().getType() == Material.SADDLE)
{
if(p.getItemInHand().getItemMeta().getDisplayName().equalsIgnoreCase(ChatColor.GOLD + "THE Saddle"))
{
en.setPassenger(p);
}
}
}
um
this is my code and i want to controll all the entity that the player ride?
but i have any clue to make that
so i need help for this can someone help me to do this?
You’ll need NMS
ik that
alr
b-but i dont know what NMS that i need for this
;-; ....help
i try this for 1month on 1.16.5 but NMS change on 1.17...
Have you opened the link?
dude i really want to say THANK you this is THE THING what i really looking for 9999999999999999year
thank you (:
yo
how to use intellij decompikler ?
i've been trying
cant see to find any tutorials that worked for me :(
just drag and drop the class
.jar file
unzip it then drag in the .class files
or just use fernflower yourself
or jd-gui is also a good option imo
Hello! I have a quick question: Is it somehow possible to save a location in a database? If so, how can i do that?
what database?
MySQL
read its data or use serialize
how do you mean that exactly?
well, first you need to learn how to use an SQL database in Java
I'd recommend you do that first
I already know how it works.
Your question implies you don't
Is it possible to somehow join an async task?
you either end it or jump back sync
I just don't know how to save a location, as there is also a slightly different way for saving locations in config files.
saving locations to a config is simple as its serializable
Yea but for example if I have a task, that runs in a loop, but operations inside the loop sometimes can take seconds, then I want to wait in onDisable until it finishes that cycle
no, you can never wait
Thats what ive meant with joining
all tasks ran by teh scheduler will be terminated when it shuts down
For example:
//my async task:
while(running) {
Thread.sleep(10000); // now imagine the server shuts down while this task is sleeping here
}
```What am I supposed to do then?
send it an interupt
Howto
Yea but I dont have the thread, do I?
if you made it you do
I mean if I would execute this code with BukkitScheduler#runTaskAsynchronously
doesn;t work?
Why do this?
Thats just an example
I basically did this:
int count = 0;
while(true) {
count++;
if(count % 10000000 == 0)
info(count+"");
}
```as a test and if I call `task.cancel()` it doesnt stop.
`info` just prints a message to the ConsoleCommandSender
not in a bukkittask
then use while(!isCancelled())
if 10 is greater than 5 return 1
But it'll never cancel because its an endless loop, therefore I either have to interrupt or join it somehow
yes, untill you call task.cancel()
I mean yea, in practice I could do this but not for this example
What’s the meaning of this just out of curiosity?
My main question was if you can somehow join or interrupt an async BukkitTask because it didnt seem to work for me. That was just for testing reasons.
Yeah you can
What am I doing wrong?
You could setup a CountDownLatch in the runnable which gets queued on to the cached thread pool, then just countdown the latch and await somewhere else
If its some reusable task, might wanna use CyclicBarrier instead
You don;t seem to have registered the class
i do in the onEnable
your error says you didn;t
Caused by: java.lang.IllegalArgumentException: Specified class does not exist ('de.crowraw.chatmessages.SendableMessage')
ConfigurationSerialization.registerClass(SendableMessage.class);
Okay thanks 👍
Do you register it before you attempt to use it?
The error seems to say you didn;t
But would it be possible to wait for a non-endless task in onDisable like this:
while(task.isRunning());
```Or would this cause errors or something?
checkout the whole code here
Well that’s loop abusing (which can take on performance unnecessarily)
But probably would work
Yea but if I need to do some operations in a database for example before the server stops, then I'll have to wait somehow in the main thread
private final MessageConfig config = new MessageConfig(this, new ConfigProvider(this));
initialized at teh class level, before onEnable runs
Yes but still, there are proper concurrency classes for this that do these operations like joining, waiting etc much more efficient and performant than your feeble while loop.
does that use your class?
yes agreeing, ty 👍
I might ask
Are you familiar with promises (Future and CompletableFuture in Java)
Concerning the database operations
Because that class actually has a join and get method (which basically await the current thread for the computed result)
And if you really want to be sophisticated here, you could even use your own thread pool with a calculated blocking coefficient
No, but thanks for pointing that out I'll take a look on it
Does anyone know a good documentation on creating spigot plugins? Explaining all things like commands, items, events etc.
?jd
That’s for all the classes, items and api coverage generally
Spigot offers a set of wiki pages on how to get started with certain topics
i know the spigot docs but it's just useful for finding very specific things i use it mostly for events
but i would like to find something like that
?scheduling
The entire branch that wiki is on
just to refresh my brain with spigot
Is just filled with articles on how to do x and y
yea idk spigot's main wiki is kinda shit imo
The documentation doesnt show how to save data to chunks
Just use Chunk::getPersistentDataContainer iirc
?pdc
You have the block, get the Chunk, get the PDC
hey, so im trying to make a custom GUI but for some reason tuSKe is sending loads of errors is there an upto date verion or another plugin i can use to make guis/plugins?
who is tuske
A Skript iiirc
https://mclo.gs/opRKg3I someone got any clue what the heck this stacktrace means ?
Get a new jar
And remove the cached jars
Also seek help in the paper community as you’re using paper next time
Aight!
is it a bad practice to saveConfig() on WorldSaveEvent?
i use this one
and it just doesnt work
when i try to export the files
no? although i'd use a relational database for your data
meh, just need to save 3 variables, not worth the effort
but alright, thx!
wasnt sure if maybe something could go wrong
any way to find where am player is looking so North, East also i want timplement this into a join event so i have to get the player name too!
ah then fine
ah
player getlocation getYaw
yea xD
and then check the value
its between 0 and 360 i think
but why ping
hey
i decompiled the plugin with intelij
and
did the creator really made them named a and b or is the decompiler that did that ?
i decompressed the .jar file
and then opened the folder with intelij
how do i get the player in a event handler? NOT in a command
The decompiler did that. It has no access to what the names of fields, classes, or methods were so it just names them something more readable than the obfuscated code is named.
The event should provide you the player if it extends PlayerEvent
:(
how can i edit the plugin
i just want to change the bed break event
and make it make the player a final kill and not end the game
yeah how do i do it im pretty new to spigot lol
Do you already have the event setup
If the code is open source you should be using that.
If it's not open source you're not really supposed to modify it 😬
oh
almost done.. just waiting to get the player name
public void onPlayerJoin(PlayerJoinEvent event)
{
String PlayerName = event.getPlayer().getName();
/**
* Created by lorinthio on 3/3/2018.
*/
class DirectionHelper {
enum Direction{
NORTH, EAST, SOUTH, WEST
}
/**
* Get the cardinal compass direction of an entity.
*
* @param entity
* @return
*/
public static Direction getCardinalDirection(LivingEntity entity) {
double rot = (entity.getLocation().getYaw() - 90) % 360;
if (rot < 0) {
rot += 360.0;
}
return getDirection(rot);
}
/**
* Converts a rotation to a cardinal direction name.
*
* @param rot
* @return
*/
private static Direction getDirection(double rot) {
if (0 <= rot && rot < 45) {
return Direction.WEST;
} else if (45 <= rot && rot < 135) {
return Direction.NORTH;
} else if (135 <= rot && rot < 225) {
return Direction.EAST;
} else if (225 <= rot && rot < 315) {
return Direction.SOUTH;
} else if (315 <= rot && rot < 360.0) {
return Direction.WEST;
} else {
return null;
}
}
}
Direction direction = DirectionHelper.getCardinalDirection();
}```
Which event is it
:(
i was too lazy to make my own direction thing
i wont publish it is that ok ?
yes ik but it wont work with Direction
You're still not really supposed to decompile someone's JAR and modify it.
What are you trying to do
Legal reasons shakiz
okay
But I'm also not a lawyer so I can't really help much with that
getting a players facing location when a player joins
Best thing you can do is ask the original developer to either make the change or give you the source
its for a wb message
😩 now i gotta make a plugin from scratch and am not that good lol
or pay 100 bucks to buy frozed plugin that has everything i need
Looks like all you need to do is pass the player into DirectionHelper.getCardinalDirection()
Hello i have a bug with bungeeCord, and idk how to fix him:
java.lang.NoClassDefFoundError: net/md_5/bungee/BungeeCord
Caused by: java.lang.ClassNotFoundException: net.md_5.bungee.api.ProxyServer
Caused by: java.lang.NoClassDefFoundError: net/md_5/bungee/api/ProxyServer
it's a class import error i think
hmm ok so PlayerName as a str would work right?
but idk how to fix
No just use event.getPlayer()
Don't need the name
ok cool!
hey anyone can helpe me , i need to learn how to make a practice core/plugin
?paste Send the full error
Why do you have to use player.spigot().sendMessage(BaseComponent[])
and not player.sendMessage(BaseComponent[]) ?
Why isnt that method implemented on the player? its really counter intuitive
if i write and compile my plugin in java 11, 16 or 17 will it run on 1.8 mc server?
Are you running a BungeeCord plugin on the Spigot server?
yes
i know cuz i tried
ty
I have only this pl
Yeah it’s a bit weird
🤷♂️ That whole Player.Spigot class is odd
Looks like you're trying to access the BungeeCord API on a Spigot server though... 
how can I fix this ?
What is your plugin supposed to do
it's just the InventoryClickEvent, and it's getting all ProxyServers to get in gui the servers with online players etc..
I have already did this
Send your code in another paste
it wont allow me to import shall i do it manually? if so whats the import
Should be DirectionHelper probably
Or DirectionHelper.Direction
i'm gona send you screenshot in dm
i think it's better
Ok
it really wants it to be direction
DirectionHelper.Direction direction = DirectionHelper....
md_5 wants to feel special? Or i think thats to separate features added by spigot
But still dumb
xd
thansk!
Wdym doesn't save
because they are all crap
yeah
Wdym
lol kinda true
Like change the variables?
yeah
The names?
a lot of ppl do it just to make it simple
yeah
they all change it to the same names
no one i have seen so far made it a different name
and most of them make the same plugin for tutorial xD
Just easier I guess
Well I don't remember so 🤷♂️
yeah but it feels like they all learned from the same person xD
nobody knows whats wrong
They probably all learned from another tutorial man 
lol yeah
if u want to u can set args to a
no 
i wanna find that tutorial 
args is good
yeah
args make sense while being ez
args is good
OK, I understand. Do you have an example or something? I have never serialised data from a database before.
Does it throw an error or just do nothing
what plugin you making ?
But it does copy the original file right
Like the file is there you just can't update it
yes the file.createFile() and plugin.saveResource() work
i can read from it and set values, and read those but at the end of the day nothing gets saved
its just an empty file
Well you are calling saveConfig() right
is there a better way to test out other than building like Fabric has a inbuilt client
hello i have a question how can i run a interval (task run)
i have try it with bukkitrunable but it doesn't work
i wanna know to fix the plugin parameter
here my code ...
public class SideBoard {
public void setScoreBoard(Player player) {
...
player.setScoreboard(board);
//HERE I WANT TO REFRESH THE BOARD EVERY X SECONDS
}
public void updateScoreBoard(Player player) { //<-- this is the update void
Scoreboard board = player.getScoreboard();
//players
if (Bukkit.getOnlinePlayers().size() == 0) {
board.getTeam("onlineCounter")
.setPrefix(ChatColor.DARK_RED + "0" + ChatColor.RED + "/" + ChatColor.DARK_RED + Bukkit.getMaxPlayers());
} else {
board.getTeam("onlineCounter").setPrefix(ChatColor.DARK_RED + "" + Bukkit.getOnlinePlayers().size()
+ ChatColor.RED + "/" + ChatColor.DARK_RED + Bukkit.getMaxPlayers());
}
//health
board.getTeam("HealthCounter").setPrefix("" + ChatColor.DARK_RED + player.getHealth() + ChatColor.RED + "/"
+ ChatColor.DARK_RED + "20");
}
}
i call the function in my conntection class here the class to view..
public class Connect implements Listener {
@EventHandler
public void onJoin(PlayerJoinEvent event) {
welcomeMsg(event);
new SideBoard().setScoreBoard(event.getPlayer());
}
}
and my main file
public class App extends JavaPlugin {
@Override
public void onEnable() {
System.out.println("[MCP]::START");
//Events
getServer().getPluginManager().registerEvents(new Connect(), this);
}
have everyone a idea to make the interval ?
With the FileType
?scheduling
yes like here
hey i want to add a thing where if someone joins and they never joined before the plugins +1 to a variable and displays it on chat
my question is
.
should i just put that variable normally
or will i have to store it somewhere
👀
am noob dont bully me
lol
i think it will have to be a file unless u dont restart ur server ever again
ok
What is the "homes" field there
i only know how to use .json uwu
i used python f.write functions so i have no idea
which is set in the constructor
I'm wondering if you're accidentally overwriting it or something
i dunno
yes i know but i don't unterstand what i set as plugin parameter
App ?
Connect?
Sideboard?
For which parameter
The plugin is an instance of your main class
your main class' instance

ok also App ?
i dunno whats your main class is
hey i've watched a few tutorials now
not that many
but
this guy is the best i have found
:D
anyone know if is this the right path for my settings?
private final File SIGNS_FILE = new File("plugins/RecipeSigns/signs.yml");
i get permission error
Use getDataFolder
kk
would it be the same as: new File(this.getDataFolder() + "/signs.yml"); right?
new File(getDataFolder(), "signs.yml")
Registered listener still dosnt show a msg on join
CODE :
@EventHandler
public void onPlayerJoin(PlayerJoinEvent event)
{
class DirectionHelper {
enum Direction{
NORTH, EAST, SOUTH, WEST
}
/**
* Get the cardinal compass direction of an entity.
*
* @param entity
* @return
*/
public static Direction getCardinalDirection(LivingEntity entity) {
double rot = (entity.getLocation().getYaw() - 90) % 360;
if (rot < 0) {
rot += 360.0;
}
return getDirection(rot);
}
/**
* Converts a rotation to a cardinal direction name.
*
* @param rot
* @return
*/
private static Direction getDirection(double rot) {
if (0 <= rot && rot < 45) {
return Direction.WEST;
} else if (45 <= rot && rot < 135) {
return Direction.NORTH;
} else if (135 <= rot && rot < 225) {
return Direction.EAST;
} else if (225 <= rot && rot < 315) {
return Direction.SOUTH;
} else if (315 <= rot && rot < 360.0) {
return Direction.WEST;
} else {
return null;
}
}
}
DirectionHelper.Direction direction = DirectionHelper.getCardinalDirection(event.getPlayer());
Bukkit.broadcastMessage(ChatColor.RED + "for debugging ONLY~ " + direction);
}```
local class
does that work in a method?
yeah, it will be just like a normal class just that you can only access it within that method
me who never uses it :kek:
love it it dosn't work 😄
Caused by: java.lang.ClassCastException: class de.maurice.mcp.events.Connect cannot be cast to class org.bukkit.plugin.Plugin (de.maurice.mcp.events.Connect is in unnamed module of loader org.bukkit.plugin.java.PluginClassLoader @42e4d7d; org.bukkit.plugin.Plugin is in unnamed module of loader 'app')
...
new SideBoard().setScoreBoard(event.getPlayer(), (Plugin) this);
and this in on my main file
package de.maurice.mcp;
import de.maurice.mcp.events.Connect;
import org.bukkit.plugin.java.JavaPlugin;
public class App extends JavaPlugin {
@Override
public void onEnable() {
System.out.println("[SERVER]::START");
//Commands
getCommand("api").setExecutor(new testiing());
//Events
getServer().getPluginManager().registerEvents(new Connect(), this);
}
@Override
public void onDisable() {
System.out.println("[SERVER]::SHUTDOWN");
}
}
class de.maurice.mcp.events.Connect cannot be cast to class org.bukkit.plugin.Plugin
my head, you can only cast a class that extends JavaPlugin with (Plugin)
App instance then
not really spigot but can i tp aplayer while looking in lets say North?
ok thx
How can i do in the plugin protectionstones put a limit of each protection can a player have?
how is it possible that my plugin cant write its settings because "permissions denied" but any other pl can?
[19:18:03 INFO]: Sapu98 issued server command: /recipe edit [19:18:12 WARN]: java.io.FileNotFoundException: plugins/RecipeSigns/signs.yml (Permission denied) [19:18:12 WARN]: at java.io.FileOutputStream.open0(Native Method) [19:18:12 WARN]: at java.io.FileOutputStream.open(FileOutputStream.java:270) [19:18:12 WARN]: at java.io.FileOutputStream.<init>(FileOutputStream.java:213) [19:18:12 WARN]: at java.io.FileOutputStream.<init>(FileOutputStream.java:162) [19:18:12 WARN]: at me.sapu.RecipeSigns.saveSigns(RecipeSigns.java:67)
I save it like this:
File signsFile = new File(this.getDataFolder() ,"signs.yml");
public void saveSigns() {
try (FileOutputStream outputStream = new FileOutputStream(signsFile)) {
outputStream.write(Serialization.serialize(recipeSigns).getBytes(StandardCharsets.UTF_8));
}catch (Exception e) {
e.printStackTrace();
}
}```
:sad_pepe:
hm?
Plugin.saveResource
solved, for some reason the file was created without write permissions .-. it usually does and recreating it, fixed it
is there a way to check if a item is on the ground im using this to trigger a different command
ty
is an item an entity?
yes
oh
how do i check for a entity? also is a specific entity type / cords possible?
entity.isOnGround
where do i implement it?
If you are waiting for an item to hit the ground, start a runnable when the item is thrown
And keep checking until isOnGround is true
Bukkit Runnable on Time
if Item is onGround add to list?
if item doesn't contain list?
Check if Item in list isn't onGround?
if false then remove
yeah i switched it up is there a way to check what item a player has held so smth like player.mainHandHeldItem?
For 1.9+ use 👇
player.getInventory().getItemInMainHand();
OR
getItemInOffHand();
otherwise use 👇
p.getInventory().getItemInHand();
how can i implement this so when i press a button it works?
what are you even trying?
you mean PlayerInteractEvent?
i press butoon if the item is held ill be tped
Like left and right like
register Your Event_Class
im new help with that
so you want to teleport yourself when you right click a button with an item? 🌝
(Main_Instance)getServer().getPluginManager().registerEvents(new YourEventClass(), Main_Instance);
no just the item :)
i will help you along :))
also very off but ```java
public void onPlayerJoin(PlayerJoinEvent event)
{
String PlayerName = event.getPlayer().getName();
Bukkit.broadcastMessage(ChatColor.RED + "for debugging ONLY ");
Bukkit.getServer().dispatchCommand(Bukkit.getServer().getConsoleSender(),"execute as "+PlayerName+" run tp " +PlayerName+ " -206 71.500 47 -90 0");
you probably miss @EventHandler
@EventHandler
public void onClick(PlayerInteractEvent event) {
if (event.getAction() != Action.Right_click_block) return;
if (event.getPlayer().getInventory().getItemInMainHand().getType() == Material.YOUR_MATERIAL) {
Bukkit.broadcastMessage(event.getPlayer().getName') + "right-clicked with a block from a type idk")
}
}```
shh you didn't see that
Damn what a nice person <3
dont dispath command
whats a better way>?
i tried to tell you @pine islandbut @tardy delta was more clear about how to do it
yes
does it work for you now?
@tardy delta have you check your database
wdym?
on my database opens for 30 secs and closes in my settings
uhh imported it stil?
Click block and click air
Action.RIGHT_CLICK_BLOCK
ty
is there not autocomplete for you
it shows recomandation after .
getting this error java no suitable constructor found for ItemStack(no arguments)
with this code java itemstacks.put(filename, new ItemStack());
can anyone see why this wouldnt work?
is that really required?
do i make it a int then use it or is there a diff way?
new ItemStack(Material.YOUR_MATERIAL)
is it possible to set a material through #setItemMeta from the ItemStack class ?
no
fuck
I dont think so. You can copy the item meta on to a new itemstack of the material you want
or that ^^
wait
is the world End or is it a server management thing
@Utility
public void setType(@NotNull Material type) {
Validate.notNull(type, "Material cannot be null");
this.type = type;
if (this.meta != null) {
this.meta = Bukkit.getItemFactory().asMetaFor(meta, type);
}
if (type.isLegacy()) {
createData((byte) 0);
} else {
this.data = null;
}
}
tp
it does exist
ty
i want to do overworld
overworld is Bukkit.getServer()getWorlds().get(0)
world isnt a location?
ah nvm
i understand
it wants me to create a method
trying to do a double jump event using the playertoggleflight event, it doesnt work:
@EventHandler
public void onDoubleJump(PlayerToggleFlightEvent event) {
Player player = event.getPlayer();
if (player.getGameMode() == GameMode.CREATIVE) {
event.setCancelled(true);
}
else {
player.setAllowFlight(false);
player.setFlying(false);
Block block = player.getWorld().getBlockAt(player.getLocation().subtract(0, 2, 0));
if (!block.getType().equals(Material.AIR)) {
Vector vector = player.getLocation().getDirection().multiply(1);
player.setVelocity(vector);
player.playSound(player.getLocation(), Sound.FIREWORK_BLAST, 1F, 1F);
}
}
}
which wont work i belive
what are you trying to do?
ill send the code
yesh
are you talking about the check for the player's gamemode being creative?
@EventHandler
public void onPlayerJoin(PlayerJoinEvent event)
{
String PlayerName = event.getPlayer().getName();
Bukkit.broadcastMessage(ChatColor.RED + "for debugging ONLY ");
Bukkit.getServer().dispatchCommand(Bukkit.getServer().getConsoleSender(),"execute as "+PlayerName+" run tp " +PlayerName+ " -206 71.500 47 -90 0");
new Location(Bukkit.getServer()getWorlds().get(0), );
event.getPlayer().teleport();
you dont need to make a new location
im replacing despatch with
oh
entity.getPlayer().teleport();
but if you're trying to get the spawn location use Bukkit.getServer().getWorlds().get(0).getSpawnLocation()
no i have set coords
or you can make a new location if you want specific coordinates
what
rotation
yes
hello
im trying to create a plugin where instead of raw iron/gold being dropped from mining ores , it drops nuggets
i have three questions :
1 - how can i make fortune affect the nugget drops
2 - how can i stop nuggets dropping if a creative mode player breaks the ore
3 - how can i make the pickaxe take durability damage every time i mine iron or gold ore ?
ping me or reply with a ping if you have the answer for this 🙂
Bukkit.getWorld("Name")
i dont think anyone would spoonfeed
wdym ??
