#help-development
1 messages · Page 172 of 1
Hey guys, can someone help me with craftbukkit beta 1.7.3 events?
1.7.3 wtf
1.7.3 isnt supported anymore
But it probably works tbh
hmmm, it very weird how it works
it doesnt work
I somehow randomly got it to work without disconnecting the player
I cant make events
nvm, fun
yay
I think I know how to do it now
Team prefix and suffix time for you
In short, how to make events in such an old version?
do you think a debug setting that spams console with info is sensible? (Off by default, of course) Just in case people cant figure out why something doesnt work about your plugin?
No idea, no one uses that anymore. I assume it's the same as current versions but I've no idea.
Easiest way to fix your problem is to not use such a dinosaur version
yes
Someone know how to fix this? I get a FileNotFoundException Error. Seems like it doesnt really download the file with the bearer token
public static void main(String args) throws IOException {
URL url = new URL("https://github.com/ole1011/Newsc-master/releases/download/release/newscTEST.jar");
HttpURLConnection client = (HttpURLConnection) url.openConnection();
client.setConnectTimeout(0);
client.setRequestMethod("GET");
client.addRequestProperty("Accept", "application/octet-stream");
client.addRequestProperty("Authorization", "Bearer [token]");
client.setDoInput(true);
client.setDoOutput(true);
client.connect();
try {
InputStream in = client.getInputStream();
Files.copy(in, Paths.get("newscTEST.jar"), StandardCopyOption.REPLACE_EXISTING);
} catch (IOException e) {
throw new IOException();
}
client.disconnect();
}
build
Seems like the URL is wrong?
check if mapping rebuild works
alr
My players dont think so
The repository where the release is in is private, thats why I need to download it with the token
Well from a developer standpoint, thats the easiest way. There's probably some old threads on the Bukkit forums that explain how events works
It didnt work.
without using a keybind how do you build the project?
build > build artifacts > build
imagine 1.7.x
press crtl twice then type mvn clean package then try the keybind
older than some teenagers
Also, when i go onto the url with my github account which has access to the repo it works
didnt work
?paste
guys what is wrong with this code? I am writing this on my phone so I cant use things like devtools
not really anything else i can think of that might help, sorry
alr all good
try replacing "Bearer" with "token" maybe?
new Circle(new Vector(0, 0), 'red', 30).30.intersects(new Circle(new Vector(30, 30), 'blue', 20))
).30 probably
Now im getting https://paste.md-5.net/oxixofaqoz.nginx
?main as well
https://paste.md-5.net/asexokoguy.cs and main("https://github.com/ole1011/Newsc-master/releases/download/release/newscTEST.jar");
Send the whole class, and why do you have a main method in a spigot plugin 
just called it main, will change it later anyway
sec
How would I go down a line when setting an armor stands custom name?
Does \n not work
If it doesn't then you'll have to use multiple armor stands
nope
Hm, honestly I'm not sure. Maybe try making it public temporarily and then making sure that part is working. Once you can download it publicly you can re-make it private and then mess with the tokens. Just kind of breaks your problems up so you can really narrow down whats wrong.
Yea, i already tried it with a public repository and it worked

is there a way to call a bukkitrunnable for a certain amount of time but have that time be adjustable
im not sure how to explain it but sort of like a while True for python
Sure
maybe its a problem with the personal access token
I have no idea then
all that error gives me is that it's either failing to create the input stream or it's failing to read it
how would u go about it
Could be, did you set the right scopes?
Do a for loop and run it i*delta
Or create a repeated runnable which starts a new runnable at the end of its run method
Or create a repeated runnable which has a counter and stops after a certain amount of runs
idk, im checking rn
if u multiply a for loop by delta wouldnt i still run out?
So like normal loops you can approach this iteratively and recursively. Its just async.
which scope should it be?
wait can we make a thread for this real quick
Do you want to run a runnable indefinitely?
its kinda hard to explain im gonna make a thread and add u
read repo or something like that
Make a Runnable run for a dynamic amount of time
didnt find anything about that here https://docs.github.com/en/developers/apps/building-oauth-apps/scopes-for-oauth-apps or i am just blind
this one would probably work, if not, then read:packages too
download a jar file to kinda auto update the plugin
Ah
gonna try it again with a public repo
yea, it works with public ones
then the issue should be smth with the auth token, idk
Hi guys. I wanna maka a plugin so everytime you shoot an arrow tnt spawns every tick and ignites when the arrow hits the ground. But i dont know how to summon tnt with a timer and how to check if the arrow has landed. Anyone know?
yep :)
wont that just cause really really unnecessary lag
It would
its satisfying and thats the point
idc about lag if its satisfying <3
But it's not satisfying if it's lagging
use the ProjectileHitEvent and the World#spawn method
ok thx
So you want to spawn tnt every few meters while the arrow is flying? Or only on impact.
Then you need a runnable which keeps track of the shot arrow. So ProjectileLaunchEvent and a runnable.
?scheduling and ProjectileLaunchEven then
depends
If you just run sql executor in browser you do
in java
"""SELECT *
FROM cringe
WHERE id = '123'
"""```
alr
This is what i have so far: https://paste.md-5.net/ujigudazic.java
But i wanna make it so that the tnt only explodes when the arrow hits the ground
Hi, how can i make an area effect cloud with a really really small hitbox to make a kind of raycast? I tried setting its radius but it doesn't seem to do anything and other than that i want to remove the particles
Why not use the raycast methods in the api?
because i need to get every single block on the line
like this it works but i still get the annoying mob spell particle
how can i remove it
?
Look in to raytracing algorithms instead of spawning a bunch of entities
i wonder if its because your spawning insane amounts of tnt
maybe a non terminating loop?
no it spawned 1
idk
send your code
is it this?
The PlayerInteractEvent may be called once per hand. If you only want code to be executed once, you can check the result of https://hub.spigotmc.org/javadocs/spigot/org/bukkit/event/player/PlayerInteractEvent.html#getHand(), then decide functionality.
For example, only executing code if the main hand was used:
@EventHandler
public void onPlayerInteract(PlayerInteractEvent event) {
if (event.getHand() != EquipmentSlot.HAND) { // * if the hand used is NOT the main hand:
return; // do not progress past this point |
}
// provide functionality
}
try spawning entities sync
buildtool
would love to know why TNT is public
and why its called TNT and not something thats more descriptive and in camel case
while (!arrowLanded) {
((TNTPrimed)tnt).setFuseTicks(1000);
}
why
^ That would be an infinite loop
you might wanna put that in a task to check every tick
this is more of a java question but is there a way to detect if a pixel is empty on a BufferedImage
For full Project check repo here. Feel free to clone and run. Note the test images
https://github.com/AshGale/Image2RGBA
When Reading in a PNG that has sections shown as empty(hashed) in GIMP, the
Google your question before asking it:
https://www.google.com/
Hey is it possible to check how many blocks a player fell from?
Thank you very much!
This link is useful but depends on what you are doing.
I tried serching it but I didnt really get anywhere
Ill look into it though thank you!
No problem boss
like this?
so if the alpha is 0?
Can anyone help me with the terra plugin?
While loops are bad when you dont know what they do
not the right channel for that but what is the issue
you want a repeating task that runs every tick, not always
while does the "Always" part
I have done lots of research for how to get it to work but it just doesnt generate my world as a terra world.
ok
my friend @peak depot told me to
are you on paper or spigot?
spigot
use a paper server
told you to use a while loop like that?
yes
everything should work
ah alright
bad advice then
i think we both went brain afk
btw common "issues" with paper is not being able to dupe tnt, break bedrock with glitches, and some mob farms might not work like they do in vanilla due to the amount of optimizations done
good to know thanks
You can re-enable both of those
do you know how terra works and if I need to download any extra plugins?
I am trying to do @EventHandler for Entity but it gives me this error
"Paramater is not a subclass of org.bukkit.event.Event compiling and running this listener may result ina runtime exception" How could i fix it then?
i know how the plugin works
is gaea necessary?
im sure u know what to add to the bukkit.yml
not anymore
Make sure the parameter is an event
is there a reason why the bukkit.yml file doesnt appear?
do I need to launch the server first?
yes
ok
are u running on minehut?
i got trolled by YT
typical case of tas lmao
running on minehut might not be the best idea
@EventHandler
public void onFall(Entity e) {
}``` Why wouldnt this owrk?
if its the free server at least
Because entity isn’t an event
?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.
"Programming" challenges on YT basically have answers with no programming
private static final int EVEN_AMOUNT_OF_DOORS = 100;
public static void main(String[] args) {
IntStream.range(1, EVEN_AMOUNT_OF_DOORS + 1).filter(i -> Math.sqrt(i) == (int) Math.sqrt(i)).forEach(System.out::println);
}
Have no connection to actual challenge
How do you unregister a command?
but is the way to find answer
If I remember correctly, you gotta reflect into the commandmap from bukkit and might need to do it there and then reload the commands
pretty sure yeah
ok
just letting you know it may crash if its on minehut
and then i delete the original world folder?
or server tps will be low low
yeah
its aternos
its still only like 2gb of ram
setExecutor(null)
idk if it's gonna throw error
but actually parameter is @Nullable
I assume they are talking about a command from a differen plugin
Programming challenge: find all perfect squares from 1 to given even number
@stuck flax could you be more specific?
Are you trying to unregister one of your own commands or one from a different plugin?
I'm trying to unset the executor of a command that my plugin set the executor of
oh, then Nukers should work
all my plugins work but terra still hasnt seemed to work
maybe u typed something in wrong idk
try TERRA
instead of Terra
cuz you needed to add them to TNTs list?
https://paste.md-5.net/qasimuquno.java
Can pls someone help me. I wanna shoot an arrow and spawn tnt where it go's and when the arrow lands it all explodes. But idk how to do that and my brain is fked up bc its 11:30pm at my time and im really tired and wanna get this done
for (String s : getConfig().getConfigurationSection("COW.drops").getKeys(false)) {
String type = getConfig().getString("COW.drops." + s + ".item.material");
int amount = getConfig().getString("COW.drops." + s + ".item.amount");
ItemStack item = new ItemStack(Material.valueOf(type), amount);
}```
you need ((TNTPrimed)allTNTs).setFuseTicks(0); i guess
cuz i see no use in your entire loop
learnjava then probably
i'm not in the conversation tho
just saw your last piece of code
hm
there may be some other places u can ask
already tried it
try paper
i dont have any solutions sorry
yeah ik
they just asked in here and i didnt feel like moving channels
bonjour, y a t il qqn qui parle francais svp
English please
Okay, I download the totem faction plugin (event) but I can't break it
I am a beginner 😅
Hello friends i asked twice , and non answered!
i am getting this error , the werid thing ,
i have 2 vps servers ,
i host this plugin on 2 diffrent hosts
1- the first vps , give me this error :
2- the second vps dosen't give me any error
its related to a plugin i worked on
its working fine on one of my vps's , the other vps it get disconnected after a while
server related topics in #help-server
but its related to a plugin i worked on ..
You are saying this is plugin related HOWEVER you are oslo saying its the other vps that is getting disconnected
its related to both server + development
mysql
I don't know enough about MYSQL to help you out brother, someone will answer you when they have time
why would you want to break it
that's the principe of the totem event
What do you even mean with that
the totem is an event where you need to be the first fac to break the totem to win some rewards
but in my case, I cant break the totem so I request some help
So that's help #help-server
Although I'd contact the plugin maintainers, should the plugin be maintained
How can I move a player to a different server inside the console in a BungeeCord server?
like run a console command that moves a player
is x the player?
mk
oh is that only for the connector?
can I run this command in the console of the individual servers?
hm ok
it does work on the bungeecord console tho
ig ill just make a plugin for the bc connector
thx
also, is there a way to remove the "Summoned to <server> by console" message?
or is there a way to change all of the bungeecord error messages
like You are already connected to this server!
In general the inCanceled method is a great way to check if like a blockbreak is canceled, but on something like PlayerInteract, or EntityDamageEntity etc... Thats not viable, and so on. Is there a better way to detect if a player has permission to build/do something for those events?
as an example:
@EventHandler
public void on(EntityDamageByEntityEvent e) {
if (e.isCancelled()) {
return;
}
Even when this event is canceled it still goes through
Do i need a higher priority?
@EventHandler
public void on(PlayerInteractEvent e) {
if (e.isCancelled()) {
return;
}
Or this event
you should refactor this to use configuration sections instead
lot easier to read/maintain and less error prone.
something like this
for (String mobSectionKey : config.getKeys(false)) {
final ConfigurationSection mobSection = config.getConfigurationSection(mobSectionKey);
final ConfigurationSection dropsSection = mobSection.getConfigurationSection("drops");
// now calling dropsSection.getX(...) is like calling config.get(mobSectionKey + "." + "drops")
if (dropsSection != null) {
// code
}
}
final 😀
refactoring your code to use ConfigurationSection will likely solve your issue. It's way easier to read using ConfigurationSection instead of what you're doing but yeah I get you. I'm not sure what's causing your current code to bug
i have ``` Location loc = location;
x = Math.cos(a) * radius;
z = Math.sin(a) * radius;
Particles.spawn(loc.add(x, 0, z), Particle.FIREWORKS_SPARK, 0, 1, 0, 0, 0, true);
a++;
if(a >= 360){
a = 0;
}``` to spawn a spiral of particles which works but if i make the size bigger the particles are spread really far apart, how can i make it so they dont do that?
how would I go about making a particle spiral around a player
all i need is the maths part
i'm well aware how to spawn particles
I'm getting an error while loading my BungeeCord plugin. Anyone know why?
to double the radius, i believe you can make a reset at 720 and set x = Math.cos(a / 2) * radius and z = Math.sin(a / 2) * radius
you are trying to load a bukkit plugin on bungee
probably wrong import
oh uh I think its bungeecord
hmm
oh wait
the issue isnt the radius its that if the radius is 1 for example and i set it to 2 the particles are spread out by a lot
kinda need to find a way to add more points if that makes sense
what is the thing I use to run a console command on a BungeeCord server?
yes, that's what the a thing should do
it puts them closer together and adds more
ah alright ill try it thanks
at org.bukkit.plugin.java.JavaPlugin.getProvidingPlugin(JavaPlugin.java:428) ~[spigot-api-1.18-R0.1-SNAPSHOT.jar:?]
at games.kingdoms.kingdoms.publiccmds.kingdoms.KingdomsConfig.<init>(KingdomsConfig.java:19) ~[?:?]
at games.kingdoms.kingdoms.Kingdoms.<init>(Kingdoms.java:36) ~[?:?]```
how would i fix this?
?paste
KingdomsConfig.java
https://paste.md-5.net/odonavadih.cpp
Kingdoms.java
https://paste.md-5.net/nileyeceqe.cs
Guide to dependency injection: https://www.spigotmc.org/wiki/using-dependency-injection/
Player#openBook(ItemStack)
I don't remember if the book has to be in the player's inventory or not. If it does, set it to a slot temporarily, call that method, remove the book again
If you want to have only one instance, Google about singleton pattern
any idea on why this is always false?
this.acceleration = 10, 0
this.radius = 10
other.acceleration = 0
other.radius = 50
full code
that is not the problem
https://paste.md-5.net/cihajevuwu.java
why isnt this outputting anything when i type the commands?
KingdomsConfig kc = new KingdomsConfig(Kingdoms.getPlugin()); Why don't you just DI this?
Also, did you register it in your plugin.yml and your enable
Wait why are you using a command over a commandexecutor?
Hempfest from spigotmc suggested it. He owns a spigot account and a discord server
For what purpose?
"oh youre doing it the kody way with executors
man just switch out command executor for Command.class directly
use the CommandUtils.register static method to register it on your enable
boom
extends Command
then remove the commandexecutor from your implements"
im not seperating into seperate lines
but thats his words
The kody way? Aka the way you're supposed to
If you are using a third party lib to register it then use that
you good bro?
Yes maven

Ah build tools
@round finch special ping 📌
Is it possible to load an API jar from a specific folder location in java?
if ((Player) sender).isInvulnerable() {
return true;
}
Incompatible types. Found: 'org.bukkit.entity.Player', required: 'boolean'
You're missing a closing bracket
I am?
Ohhh
I was just using intellij suggestions
https://github.com/EthanGarey/BetterCommands
https://paste.md-5.net/kisocoziso.md
God.java, line 16, I dont see the problom.
im literally just running the main command
Can you send the plugincommand.java one?
you aren't returning if the length of args is 0
then on line 77 it gives you an ArrayIndexOutOfBoundsException
You should use a switch, it would also make the code run much faster.
https://paste.md-5.net/qowotezeja.java
Added switch for you
what is the point of that switch statement
Youll have to fix the rest
I dont like doing peoples work 😉
Anyway someone can help me?
that command doesn't exist
?
did you put it in your plugin.yml
thank you im going to slap myself now
i do this every time!;
god EthanGarey
god EthanGarey
god EthanGarey
Now it's not returning anything ;-;
omg finally fixed
where would a break; go if i were to make multiple cases?
it breaks the case right?
out of the*
@wary topaz
i like to make things as difficult as possible for myself...
me too
instead of using a more fleshed out command handler i decided to make my own
it kinda sucks but whatever
it does what i need it to do
thats all you need
exactly
what packet is sent to remove player from tab ?
i believe it's player info
question do you need to mess with nms to do complex particles
i remember theres like a plugin that makes nm access easier?
is it protocalib?
Using an ORM (OrmLite), is it better to cache data and write that and then save it or just write it directly to the database?
how would i set the randomtickspeed to 0 in some places
but normal in the other
is tehre an event
yeah protocolLib makes life easier with NMS, and it will be probably last thing youll need. about particles no idea but particles are included in API that does works perfectly. but totally depends how do you handle them
In the same world?
are you required to shade brigadier?
No
Hi there! I am trying to send a simple packet from a spigot server to a fabric client, but the server doesn't seem to be sending the packet. This is the code I have. Any help would be greatly appreciated!
public class TestPlugin extends JavaPlugin implements PluginMessageListener, Listener {
private static final String channel = "test:main";
public static Logger log;
@Override
public void onEnable() {
log = getLogger();
this.getServer().getMessenger().registerOutgoingPluginChannel(this, channel);
this.getServer().getMessenger().registerIncomingPluginChannel(this, channel, this);
this.getServer().getPluginManager().registerEvents(this, this);
}
public void onDisable() {
this.getServer().getMessenger().unregisterOutgoingPluginChannel(this);
this.getServer().getMessenger().unregisterIncomingPluginChannel(this);
}
@Override
public void onPluginMessageReceived(@NotNull String channel, @NotNull Player player, @NotNull byte[] message) {
log.info("Message received on channel " + channel + " for player " + player.getDisplayName());
}
@EventHandler
public void onPlayerJoin(PlayerJoinEvent event) {
var player = event.getPlayer();
log.info("Sending test packet to player: " + player.getDisplayName());
var bytes = ByteStreams.newDataOutput();
bytes.writeUTF("Test");
player.sendPluginMessage(this, channel, bytes.toByteArray());
}
}
yes
Would i be correct in saying
List<String> TYPES = null;
for (String s : plugin.getConfig().getConfigurationSection("punishments").getKeys(false)) {
TYPES.add(s);
}
should all all sections in punishments to TYPES list
if your punishments looks like this:
punishments:
punishment-a: ...
punishment-b: ...
then punishment-a and punishment-b will be added to TYPES
if you want it to look like
punishments:
- "punishment-a"
- "punishment-b"
then use TYPES.addAll(config.getStringList("punishments")) iirc
@remote swallow
thanks
Should be using sneakythrows too but i refuse to use lombok
SneakyThrows are helpful rather having mess of try catch and just printing their stacktraces
anyways any idea what's going on there?
Im just rethrowing them uhh
ThenAccept assumes the computation was succesfull
Try with whenconplete and print out ex and result
What happens when you join it and call it sync?
🤣 I don't want a thread block
It's a threadpool of 10 threads
Hmm dunno
It's impossible in this case
I thought of it
and I have a memory leak
that i'm aware of
and 1.19.2 just makes it worst
Be sure to close everything
I hope I'm
You arent closing your resultset now
yeah i know but if I do that I can't compute the value
it's closed at application level
rather at api level
Use a try w resources
Yeah, I'm thinking of that
Converting ResultSet to a JsonARray
and closing the statement
and returning the completed JsonArray
I think it'd be performance efficient
Dunno how to remove damn embed on phone
No need for a jsonarray ig
Where does the PersistentDataContainer store data?
Hoping you're not saving json into a DB brr
Data files obv lol
no it's just for data interpretation
Ah lol
good beans
uhh how do i generate flat worlds again starting a test server takes a great time now
does anyone know an open source AI training model
There are plenty
what are u looking for
im making an ai to detect if something is a taco and i dont wanna make it myself so im stealing it rn
Well, I'm like most amazed by Stable Diffusion (it's a trained model with dataset available ig)
You need a dataset or a model?
no
i have the dataset
wait
LMAO
i actually use stable diffusion
and know some contributers
lol
1 sec
oh
isn't that (one of) the AIs that takes natural text and makes pictures
gpt-3 go brrrr
yes
after 31 tests
yeah
it works damn good
i made gpt-2 print hello world in python
i tried to generate a logo for my prior school's chess club and it summoned horrors from dimensions unknown
https://www.youtube.com/watch?v=hfMk-kjRv4c ima steal this
Exploring how neural networks learn by programming one from scratch in C#, and then attempting to teach it to recognize various doodles and images.
Source code: https://github.com/SebLague/Neural-Network-Experiments
Demo: https://sebastian.itch.io/neural-network-experiment
If you'd like to support me in creating more videos (and get early acce...
yeah it's gonna work just fine
but you don't need to classify image on different basis
it's just a Yes or No kind of prediction needed
imagine being a neural network looking at a doodle of a windmill and saying "yeah im 1.45% sure thats an octopus"
yeah 🤣
@grave lagoon You using tensorflow?
Keras?
Pytorch?
the uck
pain
mans on another level coding brains from scratch
should i
train model using python
object_detection
very carefully
give it treats when it does the right thing
ironically enough this is fairly accurate
wise words
to be completely honest
thats tru
but loke
is there a function there
in the api
that trains it
tenserflow
or wahtever
Who we got there
you will find what you need
im pretty sure its even .train(...)
couldnt say what the args are but check the docs
ok
here
aa90usduihasdhnxzc
and wrote about it
I HAD THIS IDEA IN 2021
i dont need an AI to identify tacos. i have my brain. i am expert taco identifier. 100% accuracy
the only problem is that i eat them when im sure its a taco
so 100% loss
also btw do you know the side of the food dataset i gave u
4.7 GB
🤣 requires intense hardware
lmao i just bought a 3070 ti for training AI
no
but u should have gotten like a TPU
i mounted it in my system like 3 days ago
its aklso for gaming
and stuff
goodnight
ima sleep
Is there a post online anywhere that shows a way to get sections in a configuration section, getkeys false, and add them to a List<String>
Its like getConfigurationSection(“”) and get keys, is this what you mean?
Its all in that method im pretty sure im not at my pc or i would show you
yeah, its getConfigurationSection("path") i just cant figure out how to add any sections to a List<String> that could be used in tab complete
Ahh, sorry, not sure
Im guessing its a for loop but all the ways i can think of dont work
@grave lagoon I trained the model and attained about 93% accuracy
Xd
ill try and make this work later and after i have some sleep. Bet ill fix it instantly when i wake up
Yeah sleep is important
@EventHandler
public void onGrow(BlockGrowEvent e) {
System.out.println("grow");
MinigameManager minigameManager = MinigameManager.get();
@Nullable Minigame m = minigameManager.getActiveMinigames().stream().filter(mini -> ((ChunkMinigame) mini).getActiveLocation().getWorld().getName().equals(e.getBlock().getWorld().getName())).findFirst().orElse(null);
if (m != null) {
System.out.println("grow2");
ChunkMinigame cm = ((ChunkMinigame) m);
if (!cm.getModifiedBlocks().contains(e.getBlock().getLocation())) {
e.setCancelled(true);
}
}
}
why doesn't this work
ahghagw
grass
"doesn't work" is a very broad concept
does your debug get to grow2?
generates
yes
because there's no way that fails
did you check?
it's an empty list
yeah you didn't
Anyone here experienced with integration of economy in Vault? I'm having trouble with my plugin. I'm trying to make my own economy plugin for practice. Plugin runs correctly - no errors, but when I execute the command /vault-info, then Vault returns a NPE (I've already tested it without the plugin, and it works correctly). This is just a prototype, that's why it doesn't use databases & stuff
TEconomy.java (main)
public final class TEconomy extends JavaPlugin {
public Economy econ;
public HashMap<UUID, Double> money = new HashMap<>();
public EconomyImplementer economyImplementer;
private final VaultHook vaultHook = new VaultHook(this);
@Override
public void onEnable() {
// Plugin startup logic
vaultHook.hook();
economyImplementer = new EconomyImplementer(this);
}
@Override
public void onDisable() {
// Plugin shutdown logic
vaultHook.unhook();
}
}
EconomyImplementer.java
public class EconomyImplementer implements Economy {
private final TEconomy plugin;
public EconomyImplementer(TEconomy plugin) {
this.plugin = plugin;
}
@Override
public boolean isEnabled() {
return true;
}
@Override
public String getName() {
return "TEconomy";
}
VaultHook.java
public class VaultHook {
private final TEconomy plugin;
public VaultHook(TEconomy plugin) {
this.plugin = plugin;
}
private Economy provider;
public void hook() {
provider = plugin.economyImplementer;
Bukkit.getServicesManager().register(Economy.class, this.provider, this.plugin, ServicePriority.Normal);
plugin.getLogger().log(Level.INFO, "Hooked into Vault");
}
public void unhook() {
Bukkit.getServicesManager().unregister(Economy.class, this.provider);
plugin.getLogger().log(Level.INFO, "Unhooked from Vault");
}
}
I've left out the rest of EconomyImplementer.java because it's basically empty, but contains all the necessary methods (may supply if requested for)
looks like you check whether a Collection of Blocks contains a Location?
no, a collection of locations
because why not
private final @Getter List<Location> modifiedBlocks;
I'm having trouble figuring out how i can call for this itemstack as I need it inside this event for the whowashit, whohit variables...
It gives the head, just working on right click event and then removing it upon right click from the inventory
damager, victim
which ai
so what is the problem
I need to get the player who has been killed display name??
Like I said, I can get the killer, but not the victim
Just pass the victim as an argument?
yea..
No i didn't, thats in red, it won't let me use that method.
u trying to do it in your method...
where it does not exist
use the passed in player there
I can't use the ItemStack in the listener, as i cant call for it in another event, so I need to make the ItemStack seperate to both so i can call for itemstack in both events but i have no idea how I can do this as i dont' know how to make the owningplayer of the skull the player who has died.
just make a method that gets you a skull of the passed in player?
Yeah... I know that but I've been saying I don't know how to make it of the player who has died...
?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.
Pass the player as an argument and use it
That's it if you do not know how to do that take a look at the links above
what spigot version u on
1.19
Help plz, I made a Discord bot using this tutorial: https://www.spigotmc.org/threads/create-a-discord-bot-within-a-spigot-plugin.368423/ However, when receiving a message, the following error occurs: java.lang.IllegalStateException: zip file closed
at java.util.zip.ZipFile.ensureOpen(ZipFile.java:831) ~[?:?]
at java.util.zip.ZipFile.getEntry(ZipFile.java:330) ~[?:?]
at java.util.jar.JarFile.getEntry(JarFile.java:518) ~[?:?]
at java.util.jar.JarFile.getJarEntry(JarFile.java:473) ~[?:?]
at org.bukkit.plugin.java.PluginClassLoader.findClass(PluginClassLoader.java:189) ~[paper-api-1.19.2-R0.1-SNAPSHOT.jar:?]
at java.lang.ClassLoader.loadClass(ClassLoader.java:587) ~[?:?]
at org.bukkit.plugin.java.PluginClassLoader.loadClass0(PluginClassLoader.java:129) ~[paper-api-1.19.2-R0.1-SNAPSHOT.jar:?]
at org.bukkit.plugin.java.PluginClassLoader.loadClass(PluginClassLoader.java:124) ~[paper-api-1.19.2-R0.1-SNAPSHOT.jar:?]
at java.lang.ClassLoader.loadClass(ClassLoader.java:520) ~[?:?]
at org.javacord.core.util.handler.message.MessageCreateHandler.handle(MessageCreateHandler.java:52) ~[SecretPlugin-1.0-198.jar:?]
at org.javacord.core.util.gateway.PacketHandler.lambda$handlePacket$0(PacketHandler.java:51) ~[SecretPlugin-1.0-198.jar:?]
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:539) ~[?:?]
at java.util.concurrent.FutureTask.run(FutureTask.java:264) ~[?:?]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136) ~[?:?]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635) ~[?:?]
at java.lang.Thread.run(Thread.java:833) ~[?:?]
What should I do? I am confused
Do a full restart of the server
I was doing
try this
public ItemStack getPlayerSkull(Player player)
{
PlayerProfile profile = Bukkit.getServer().createProfile(player.getUniqueId());
ItemStack playerHead = new ItemStack(Material.PLAYER_HEAD, 1);
SkullMeta meta = (SkullMeta) playerHead.getItemMeta();
meta.setDisplayName("blablabla");
meta.setPlayerProfile(profile);
playerHead.setItemMeta(meta);
return playerHead;
}
Okay will do, so how does this work? How does it know it's the player who's died?
ahhh i see...
Thanks, this was helpful instead of someone typing ?learnjava lmfao. Cheers man will give it a go
Well that is basic Java
You would have known what to do if you decided to learn it by going through the tutorials
I'm new, so obviously, I wouldn't have known.
?
Just saying ?learnjava doesn't help anyone. That's exactly what i'm doing
You shouldn't learn Java and Spigot at the same time
and before you say "LeArN JaVA FiRsT" I'll learn better this way.
Knew it was coming LOL
Typical.
?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.
@civic wind
at some point people will just ignore you
so this method isnt as efficient as you think
It is. I've got a full time job, been coding about a month. I'd say i'm doing decent. I know tons of devs who learnt this way.
I dont think youre as decent as that but sure
Everyone learns in different ways. Just like everyone has different hobbies, interests, hair colour, size, so on and so on.
No one is the same.
What took me 2 years to learn, he's taken about 4 months
we all did
but it's not the efficient way
"Everyone learns in different ways."
💀
you really just sound like someone who doesn't want to learn java
then your way is to annoy people with meaningless questions
and then complain when they tell you to learn java
and like
how would you get a fulltime job
when you have no experience with java, im seriously doubting that
bagging groceries
lol
Full time job? When did i say it had anything to do with Java
Lool
I'm a bricklayer
based
then why did you mention that
I'm losing brain cells responding to you. Read the damn chat
I mean
"It is. I've got a full time job, been coding about a month. I'd say i'm doing decent. I know tons of devs who learnt this way."
in this context anyone would understand that its something to do with coding
otherwise why would you mention it
Nope, I was referring to the fact I haven't got a lot of time and i'm doing fairly good.
Y'all just nitpicking fr
kilo you lack basic OOP knowledge, you seem to have functional programming skills
💀
Yeah i do, but i also know DI and stuff. I appreciate the feedback and I will be doing 🙂
2Hex you have daddy issues, grow up and stop picking on this guy
But i've formed many in this conversation? Another stupid thing you have said.
You can't teach common sense, sadly, so unfortunately for you, you are doomed.
I got more things to do with my life than watch you 2 fight over nothing
2Hex time for a discord break
let the dude lay his bricks before he lays the dirt over you
anyone would be confused?
are you sure you have a job
also I didnt know they teach python at gcses lmao nice
Read the sentence, I've already said what i was referring to
I'm british, yeah they do
Studied Python at GCSE Level
This is your biggest plague
you not having enough time has nothing to do with the conversation either
And I've witnessed it on your code
Why would this mean "are you sure you have a job"
Unlike python where everything is a def, java uses return types and access modifiers for "functions"
Yeah, I'm new and still learning. I'll get there eventually 🙂
and you can do that in a much faster way by learning java
👀
So that's where that mistake was coming from
You do you, you'll get there in a year
because there are probably 12 year olds that have more HTML and CSS experience than you
yeah i needed ItemStack
What has that got to do with a full time job?
You don't need to know that to have a job though 🤔
I started coding at 6, people see me as an inspiration but I really don't care if you learned later
how would you even code at 6
what
@molten hearth you made yourself look very stupid
personally I wouldn't work with anyone that doesnt have some sort of basic webdev skill
I made c# bots for flash games
wtf
even if I work with a C++ developer I sure hope they at least know how to stitch some html together
and dabbled with some C
even if it looks like ass lol
html is easy, css is a bit harder
nah hear me out <center></center>
I'd just appreciate the effort that kilo is taking to learn while y'all are trying to put him down
then you go to school and you're forced to make most of your web page as a fuckin table
How old are you guys?
<center><table></table></center>
around 18
if you look really hard you can clearly see he doesn't care
welp
just let the man take 3 years to learn how to do OOP, his problem not mine
I also took 3 years so who am I to judge
I won't take 3 years
for me i just like
gave up on doing spigot and java at the same time after a while
and then learnt java on itself
@grim ice What did you use to learn java?
the websites in ?learnjava
I switch between the two as it keeps me interested, I like seeing things i've made in mc
and spending most of my day on stackoverflow and intellij
I did a basic refresher course in jetbrains academy
Yeah i saw somethings on youtube on unity, looks well cool
make 50 cent's game but for pc
50 Cent Bulletproof Full Game Walkthrough with all story missions recorded in 4k Ultra HD.
50 gets caught in a web of corruption, double-crosses and shady deals that lead him on a bloody path through New York's drug underworld. Working with the unlikeliest of allies, the streets heat up as 50 Cent takes on the most dangerous crime families in t...
I’m hoping to do thag in a couple years if i can learn enough
React isn't a programming lang though ;/
mc 1.8.9
is almost 2500 days old
6 days away
and by coincidence, that's also the minecraft mob vote 2022 opening
and by coincidence, that's also my sister's birthday
.
Your EconomyImplementer doesn't implement all Economy methods?
I recommend extending AbstractEconomy
also try registering it in onLoad instead
i mentioned that at the end, i cut it off so it isnt long
the class has all of them afaik
will try both
pretty sure you just register it with the RSP and that's all
make sure it loads before other econ plugins
or after idk how the chain works
I dont have any other installed
so yeah onLoad should work
Is there an efficient way to check to all players in a server if they have a certain item with certain properties?
doing directly
for(Player p : Bukkit.getOnlinePlayers())
and then do for every player in a server
for(ItemStack item : p.getInventory().getitems())
looks a bit inefficient and could cause lag
especially if multiple players trigger that algorythm at the same time
depends how often you're doing that
its an action triggered from players so i can't know how many times it will be triggered, that's why i need a more efficient way to do that
wdym
i'm italian so my english is bad
well an option would be to run this async with a callback
as far as i remember, you can't call async inventory things
but i'm not sure
what are you even trying to do?
like whats the end goal
maybe there is some other way to achieve it
basically its a phone thing, a player can call another, and to check if there is a player with that phone number it has to check all players
before, the algorythm worked that every player was stored with a number, but i can't do it anymore since now i have to do that player numbers depend on the phone and not on the players
so basically it has to check items not players
hmm well maybe you should just make some benchmarks using your current algorithm
loops are faster than some people think
this might just be fine
what if 30 players trigger this at the same time?
like fr the algorythm would have to check like 35(i think inventories are 35 or smth else) items for 30 players, its like 1500 calls
btw since i think there isn't an other way i'll just do that, if my user that asked me this private plugin thing complains about performance, i'll try something else, thanks anyway 🙂
well it also heavily depends on what you are doing in the loop
it checks if an item has a certain metadata
The most efficient way would be to detect when a player
gains or loses your custom ItemStack. For phone numbers you would then have something like a
Map<UUID, Set<String>>
Which improves the algorithm from O(n^2) to O(n)
i already said i can't, that's the current algorythm but i have to change it xD
there isn't a direct PlayerLosesItem and PlayerEarnsItem event, i would have to check like every possible way to lose and get an item
Yes
true. but that would indeed be the best way to do this performance wise
it seems a very difficult thing to do
i'll try the non-performace thing, if it makes lag too much i'll try this way
i mean if its a phone thing. you can also just have a delay and display something like "calling"
then you could use some of the concepts in here https://www.spigotmc.org/threads/guide-on-workload-distribution-or-how-to-handle-heavy-splittable-tasks.409003/
And then do an async check. 2-3 players per tick or something
cool, never heard about that
i'll use that
thanks for the help
guys, why cant i import TextComponent???
i have installed this module
(spigot-api-1.19-R0.1-20220710.051022-43.jar)
Are spigot libraries shared between plugins? What if a plugin wants to use API of another plugin which has some of the libraries
am confused. are we talking about plugin.yml libraries?
Yes
My understanding is they are limited to your plugin class loader
i mean, yes. it would download all the necessary dependencies of that API and if they we’re referenced specifically they would be loaded by the plugin classloader
I looked in source code and looks like plugins can see libraries of other plugins only in the case the one depends on the other
Which makes sense
yes
any 1?????
U need the md5 chat API
where can i find it?
Its included in teh Spigot-api
its not
yes it is
what ide do u use
intellij
import net.md_5.bungee.api.chat.TextComponent;
when u type TextComponent won't it come up to import itself?
it normally does for me
Yes
aint working
literally type TextComponent.
unless its java.awt
<dependency>
<groupId>net.md-5</groupId>
<artifactId>bungeecord-chat</artifactId>
<version>1.19-R0.1-SNAPSHOT</version>
</dependency>
i think
no, that ain't it, try the solution from elgar
no its not java.awt
ik lol
import net.md_5.bungee.api.chat.TextComponent;
doesnt work
?paste your pom
i aint using gradle
Maven pom
i use external jars 😛
but its not included in this??
i use plain
what is plain?
like default
you mean manual imports and exporting final jars?
(not maven or gradle)
yes lol
im oldschool
why would you for gods sake do that
What jar are you importing?
this
You linked to the repo but not the specific jar
this
You mean old school as in 1999?
and where do i find it?
replace with the old?
yes
also, how do u send a message to the player if they clicked the message?
does it have to be a command?
Yeah
isnt there an easier way?
