#help-development
1 messages · Page 245 of 1
I wonder if its not my ram causing issues but my hdd
could be your hdd
hard drives are slow
thats honestly probably it
Intellij and pycharm were slow when I had a hard drive
Depends which version. Studio pro does
Visual studio takes like 100gb if you install everything.
Looks like im buying a ssd
there is this youtube series camp minecraft season 4 and they have some stuff in their server i believe are plugins
I am trying to find them
do you guys know any era mods like a villager where u do quests to upgrade the age
wood age stone age etc etc
hey so uh
@EventHandler
public void onPlayerJoin(PlayerJoinEvent event) {
try {
wait(2000);
} catch (InterruptedException e) {
throw new RuntimeException(e);
}
load();
event.getPlayer().sendMessage("debug");
if (motdConfig.getBoolean("JoinGame-MOTD.Enabled")) {
int size = motdConfig.getStringList("JoinGame-MOTD.Messages").size();
int get = 0;
while (size > 0) {
event.getPlayer().sendMessage((motdConfig.getStringList("JoinGame-MOTD.Messages").get(get).replace('&', '§')));
get++;
size--;
}
}
It's not even sending the debug message and I can't figure out what's wrong.
Also before you ask it didnt work when I removed the "wait"
Delay the debug a tick and you will get it
bro what the fuck
what the actual fuck
???
why in gods name are you using wait
bro's pausing the main thread for 2 seconds casually
I could crash your server easily with a clean sweep bot attack with a plugin like that in
i removed it but it still didnt work
oh your right
ill try scehduling though
Use runTaskLater
@EventHandler
public void onPlayerJoin(PlayerJoinEvent event) throws InterruptedException {
Thread.sleep(1_000L);
..
bro im not a troller
since when has anybody trolled 😕
BukkitScheduler scheduler = Bukkit.getScheduler();
scheduler.runTaskLater(plugin, () -> {
Bukkit.broadcastMessage("Mooooo!");
}, 20L * 30L /*<-- the delay */);
thanks
?basics
Here are some links to get you started on learning Java:
- https://www.codecademy.com/learn/learn-java
- https://www.sololearn.com/learning/1068
- https://www.learnjavaonline.org/
- https://programmingbydoing.com/
- https://docs.oracle.com/javase/tutorial/java/index.html
The last one is the only official one, however some of those concepts assume that you already know a bit about programming.
dont "?learnjava me
He didnt technically
@EventHandler
public void onPlayerJoin(PlayerJoinEvent event) {
BukkitScheduler scheduler = Bukkit.getScheduler();
scheduler.runTaskLater(plugin, ( ) -> {
load();
event.getPlayer().sendMessage("debug");
if (motdConfig.getBoolean("JoinGame-MOTD.Enabled")) {
int size = motdConfig.getStringList("JoinGame-MOTD.Messages").size();
int get = 0;
while (size > 0) {
event.getPlayer().sendMessage((motdConfig.getStringList("JoinGame-MOTD.Messages").get(get).replace('&', '§')));
get++;
size--;
}
}
}, 20L * 30L /*<-- the delay */);
}
is that 1 tick?
1 should be fine
didnt work when I did 1L
what did the full line look like
wait I think I have an idea.
How do I make this stop after a given amount of time?
finalPlayer.sendMessage(GetRandomText());}, 20, 20);```
add a break statement
thats intellij for you
this is crazy meta, but use a scheduler.
Save the bukkit task to a var and invoke a cancellation
ignore the last 2 lines
????????????????????????????????????????
if you only need it to run once, and once only runTaskLater
I want it to run repetitively for 10 seconds and then stop
BukkitScheduler scheduler = Bukkit.getScheduler();
scheduler.runTaskLater(plugin, ( ) -> {
}, 1L <- Amount of tickets);
?scheduler
?scheduler
when my pc decides to load ill check the code
ok
i dont see anything wrong with that code
any errors in console
Bukkit tasks don't use another thread therefore your code is flawed and will cause main thread to sleep and you also don't have a check in place to ensure such isn't ran on main thread
Not sure how that is relevant to making main thread sleep
If you want a cool down you don't need to make main thread sleep
Nor is it accurate time wise
you sure frostalf when I make cooldowns everyone on the server has to stop what they are doing to wait. Its only logical
Lol
your trying to tell me that I shouldn't pause the entire server
You could but server isn't going to be happy
send size to console and see what happens
shouldnt be
public void load( ) {
^
Is it this?
cant lie the method does seem a little weird, one sec
or maybe its the playerjoinevent?
theres too versions, playerloginevent and payerjoinevent
whats the login one
replace java File motdConfigFile = new File(plugin.getDataFolder(), "motd.yml"); try { motdConfig.save(motdConfigFile); } catch (IOException e) { Bukkit.getConsoleSender().sendMessage("§4§lCould not save the file, is it being used by something?"); } try { motdConfig.load(motdConfigFile); } catch (IOException | InvalidConfigurationException e) { Bukkit.getConsoleSender().sendMessage("§4§lAn error occurred while reading your motd.yml file, if you need help just join our discord with /betterserver help!"); } with ```java
File motdConfigFile = new File(plugin.getDataFolder(), "motd.yml");
if (!motdConfigFile.exists()) {
motdConfigFile.getParentFile().mkdirs();
plugin.saveResource("motd.yml", false);
Bukkit.getConsoleSender().sendMessage("§4§lCould not save the file, is it being used by something?");
}
try {
motdConfig.load(motdConfigFile);
} catch (IOException | InvalidConfigurationException e) {
e.printStackTrace();
Bukkit.getConsoleSender().sendMessage("§4§lAn error occurred while reading your motd.yml file, if you need help just join our discord with /betterserver help!");
}
alr
done ill load the server
didnt work :C
omg
bro im so fucking stupid
i didnt register the fucking events
sorry man ;c ill check if it works now
it works 😛
thank you so much for helping me
next time ill pay m ore attention to my code
anyone have an idea why this wont work? I'm trying to add functionality to an item but when i rightclick nothing happens ``` public void onbellUse(PlayerInteractEvent pie){
if(pie.getAction() == Action.RIGHT_CLICK_AIR){
if(pie.getItem() != null){
if(pie.getItem().getItemMeta().equals(ItemManager.gong_of_weakening)){
Player player = pie.getPlayer();
Player nearplayer = (Player) player.getNearbyEntities(6,6,6);
nearplayer.addPotionEffect((new PotionEffect(PotionEffectType.SLOW, 800, 2)));
nearplayer.addPotionEffect((new PotionEffect(PotionEffectType.WEAKNESS, 800, 2)));
nearplayer.addPotionEffect((new PotionEffect(PotionEffectType.LEVITATION, 20, 30)));
nearplayer.addPotionEffect((new PotionEffect(PotionEffectType.GLOWING, 800, 1)));
nearplayer.addPotionEffect((new PotionEffect(PotionEffectType.DARKNESS, 800, 1)));
nearplayer.addPotionEffect((new PotionEffect(PotionEffectType.HUNGER, 800, 1)));
player.addPotionEffect((new PotionEffect(PotionEffectType.DAMAGE_RESISTANCE, 100 , 2)));
}
}
}
}```
are you running paper
spigot
ItemManager?
add debug statements
the effects you give have some nulls
in what way?
levitation is named different
I think
error?
none
we need to see that other class
ok
Should probably debug the item meta to see it is being set or what it is being set to.
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.Material;
import org.bukkit.NamespacedKey;
import org.bukkit.enchantments.Enchantment;
import org.bukkit.entity.Item;
import org.bukkit.inventory.ItemFlag;
import java.util.ArrayList;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.ShapedRecipe;
import org.bukkit.inventory.meta.ItemMeta;
import java.util.List;
public class ItemManager {
public static ItemStack gong_of_weakening;
public static void init(){
creategongofWeakening();
}
private static void creategongofWeakening() {
ItemStack gong = new ItemStack(Material.CYAN_DYE, 1);
ItemMeta gongmeta = gong.getItemMeta();
gongmeta.setDisplayName(ChatColor.AQUA + "The Bell Of Weakening");
List<String> gongmetalore = new ArrayList<>();
gongmetalore.add(ChatColor.GRAY + "This item is a powerful");
gongmetalore.add(ChatColor.GRAY + "relic of what was left");
gongmetalore.add(ChatColor.GRAY + "of the Ancient Builders...");
gongmeta.setLore(gongmetalore);
gongmeta.addEnchant(Enchantment.LUCK, 1, false);
gongmeta.addItemFlags(ItemFlag.HIDE_ENCHANTS);
gong.setItemMeta(gongmeta);
gong_of_weakening = gong;
}
}
i might be static abusing though im not sure
Indeed you are and that is the problem in fact
wtf is all the new lines for lol
i thought so
yeah that was an acciedent mind me
oh alr
You are obtaining an item stack via static but it's most likely not initialized therefore null
ohh
You never assigned it a value at the top in item manager. Unless you have a method that auto initializes when you access class statically it will always be null when accessed via static like that
oh ok
Guide to dependency injection: https://www.spigotmc.org/wiki/using-dependency-injection/
oh ok thanks so much for the help
player.getWorld().getTime()
Is there a thing where it returns "Sunny" or "Rainy" or do I have to manually make that.
alr one more question and ima go to bed, how can I set the server motd?
nvm i figured it out
it has a #setMotd method
import org.bukkit.event.server.ServerListPingEvent;
yeah
Hey uh...
File motdConfigImage = new File(plugin.getDataFolder(), "server-icon.png");
if (! motdConfigImage.exists()) {
motdConfigImage.getParentFile().mkdirs();
plugin.saveResource("server-icon.png", false);
}
event.setServerIcon(motdConfigImage);
How would I convert the file to a image?
Try using Bukkit#loadServerIcon(File file) as your input.
I did try that.
Didn't work
'setServerIcon(org.bukkit.util.CachedServerIcon)' in 'org.bukkit.event.server.ServerListPingEvent' cannot be applied to '(java.io.File)'
?jd-s
declaration: package: org.bukkit, interface: Server
this returns a CachedServerIcon
Not sure how you're doing it, but this is what I meant.
i hate that sysout
#!/bin/bash
while true;
do
screen -dmS "bungee" java -Xms3G -Xmx3G -jar FlameCord.jar
for x in 3 2 1
do
echo "Restarting.. $x"
sleep 1
done
echo "Starting up.."
done
i have this code i want if the server down for any reason restart again but when i start the file
it make a while loop every 3 seconds and start a new screen instance how can i make it correct?
By not using a while loop. Just write the script like you would for a normal server startup.
but if the server stopped i have manually restart it again
i made one before, but i forget how..
so if i use the command: /stop or /end (bungee) the server will count to 3 and relaunch
Why do you do ItemMeta.equals(ItemStack)
It will always be false
In your 3rd if statement
And also when you do (Player) nearplayer = player.getNearbyEntities(6, 6, 6)
You need to check if the entity that is returned is an instance of Player before you cast it to Player
Already pointed this out
Send error
Can someone tell me wich event is called when this message comes up in bungeecord?
Could not connect to a default or fallback server. Incorrectly configured address/port/firewall?
Mb
Hey there, my buildtools are failing due to some sort of security issue...
Exception in thread "main" javax.net.ssl.SSLHandshakeException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
What can I do?
Nevermind that, it was an issue with my school's WIFI security measures. I've switched to mobile data and it's working again
can someone help me devlop my lifrsteal minecraft server please join genral 1
I can take him as a devloper
how to add a hub in another world
help me please
@dense heron
@quaint mantle
@gray merlin
Don't do that please :/
please help me sir
I have a hub of .zip file
I have added multiverse plugin also
but the .zip file is not being created in a world
You could quite easily google that up
please help
i am not getting
can u help me please
I mean.. You are Minecraft and java developer according to your bio, I'm sure you can figure out what channel you should use
Sure how much you pay
how much u need I am poor so i can pay 1$ to 5 $
@onyx fjord
Per hour?
for 2 hours
5$ for two hours?
yes
I can do 8
?
8$/2
ok
come vc
I'm at work rn
bruhh
Hop in dm
i cant text so much
I'll be home in like hour chill
would it be possible to change player game mode with packets to client side
to get working middle click in gui menues?
You're aware that you can just set the cursor to the item they middle clicked using the InventoryClickEvent right?
middle click not working at 1.18+
it work only in creative
Hmm, would it be problematic to set the player gamemode to creative when they are viewing the inventory? Then set them back when it closes.
I think packet would be better there is no any risk some one would stuck in creative
if server crash
and they where for example in gui
I see, but I'm worried you're going to run into some potential desync or other weird behavior if you use packets. I'm also wondering if the server would accept it without player permission.
In theory, you could send a PacketPlayOutGameStateChange with the proper gamemode, but I'm not too experienced with that specific packet.
Also, I believe that is the old class name. I have no clue what it would be with the remappings.
Need a mc devloper I pay him 5 dollar / hour
Need a mc devloper I pay him 5 dollar / hour
join genral 1
?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/
Actually, the packet you want for 1.19+ is ClientboundGameEventPacket
can u help me devloping
i am uploading spawn for a lifesteal server but it is not getting converted into world help please
Use multiverse and import the world
Probably due to the use of static.
i am useing multiverse
And?
still the world is not getting converted it is still in .rar
You need to unrar it
how
Worlds are a folder
spawn
?
yeah it is a spawn in zip
join vc
I cant
Takena screenshot of the spawn file/folder in the server folder and send it
Also send it in #help-server
@wary harness Yea, something like this should work.
ClientboundGameEventPacket packet = new ClientboundGameEventPacket(new Type(3), 1F);
The problem is that I don't know what the second parameter should be. Maybe the protocol lib wiki could help with that, but the Type(3) is the value tied to the CHANGE_GAME_MODE field.
thanks
will check it out
Oh wait
lmao
The second parameter should be the value
I'm dumb
The value in this case representing the gamemode you want to change to.
And looking at the wiki, it looks like I accidentally got the second value right
You should also do some checks to see if it's a client side packet change or if the server recognizes it as a legitimate gamemode change.
yeah I will see
no u
cuz your code is kinda cringe
and you need to rewrite it without statics
also with more OOP
FREE JAVA LESSONS(call me)
(checkmybio)
whats wrong about it?
false positiving is not a good advertising for your free java lessons
the code is improvable, but a good approach
Hey, is there a way to check if something happened before a given event? I'm trying to find out if a player had flight enabled before switching dimensions and I can't figure out how I should go about this, any help is greatly appreciated 8)
most of the events are called before it actually happens
the cancellable ones f.e.
also the entity you are targeting can move
so you need to update the compass target
cuz it points to location, not entity
afair
gotcha, I'm looking at the spigot docs and can't seem to find any info on when the event is triggered, looking at PlayerChangedWorldEvent
also why are you both seting lodestone on compass and compasstarget on player
compasstarget should be just enough
also you mentioned error in console, but didn't attach stack trace
thanks!
it is understandable
cringe who can not read
no errors in console
How do I make it in the plugin.yml file so that a command has 2 permissions that either of them allow the usage of the command?
by using an array probably
how
is that even possible
isn't permission mapped as string
it is
you can try checking for permission in your onCommand() method
if (player.hasPerm(perm1) || player.hasPerm(perm2))
yeah that's what I thought but it would take me some time because I have many commands in the plugin
either by permission: [x,y] or by manually checking it
lemme google rq
nah i don't think so
don't say things if they are not true
that's literally one-liner
The home of Spigot a high performance, no lag customized CraftBukkit Minecraft server API, and BungeeCord, the cloud server proxy.
this might help
i guess
one line in like 10 files
you think something like this ?
permissions:
restful.*:
children:
- "restful.admin"
- "restful.default"
- "restful.base"
- "restful.delete"
- "restful.count.99"
- "restful.list.*"
restful.list.*:
children:
- "restful.list.self"
- "restful.list.other"
restful.base:
description: "Allows the user to use base RestfulSpigot commands"
default: true
restful.default:
description: "Allows the user to create default API key"
default: true
he needs two permissions for command
assuming plugin.* and plugin.command ?
commands:
hi:
permission1: foo.bar
premission2: bar.foo```
Do people even use the permissions section in the plugin.yml? I thought you'd just need to check permissions with Player#hasPermission()
and if player has at least one of these, command would be processed
yeah, same
why can't you just ask for some help
i once made a plugin
which allowed you to chase entities
Please DO use the permission section in plugin.yml. If you do not your permission nodes will be invisible to permission plugins.
Yes
i can share it, if you want(and if it's still somewhere on my pc)
with my example, if command requires restful.admin and user have restful.*, he will be able to execute command
I just did this
i mean, permissions are changing dynamically
isnt children string array ?
I did it as it is shown here
he did and you treated him down to promote your "free java lessons"
i helped him anyways
doesnt matter
stop harassing people unnecessarily
and then detailed
This still isn't technically what he wanted.
thats in fact "cringe"
thinking of everything as harassment moment
@hazy parrot is this not good?
wdym by "he"? I was the one who asked for the help
hehe
My bad. I lost track of who originally asked.
happens
yeah
tho, are you actually so lazy to write this oneliner
to destroy a newbies confidence when he asked nicely is harassment and disgusting
I prefer to use permission in the yml file instead of the OnCommand method
Well, as I was saying, I don't think it's possible to assign two permissions to act as an exclusive or. You can make children, but those are really like permission "packs" in a way.
.
So I'd just create the permissions in your plugin.yml like normal, then just check to see if the player has either permission.
wdym, i never used this section, but luckperms worked fine
or you mean tab-completion?
Probably for tab-completion.
If a permission is directly on a command it will be registered by Bukkit and visible. Any other permission (if not added to the plugin.yml) will not be visible.
All permissions add in the permissions section are registered and visible
Not what I was saying
what's the point of visibility
eg, you add a permission plugin.*
except tabcompletion
If you don;t have all your permissions in your yml * as a wildcard will not know what perms to grant
look at this destroyed human being, who actually used my help and who i literally talked nice to
after pointing to mistakes

maybe i prefer talking this way, and prefer getting comments on my actions, even if they are not nice
ya know, might be a cultural difference
noted
if the guy don't like my manners, he can say it himself
and you are like coming out of nowhere trying to defend the guy who is not even insulted
maven/gradle?
Did you set your scope to provided on the spigot dependency?
<scope>provided</scope> on your spigot dependency
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
here my pom file
im not defending anyone, im just condemning your action
What things specifically is it including?
ok good luck with that
but if thats how you treaten your "students", i wouldnt recommend your "java lesson"
he is not my student
??? It's a passive action, he's already accomplishing it. lol
also idk if he is a newbie
when I remove <classifier>remapped-mojang</classifier> and compile new jar it is not included
dont worry he's just cringe
i mean i didn't end my phrase yet
i'm not as scared of people as imllusion so i won't block you anyways
but still can just ignore
someone cant handle critism
Try updating your specialsource-maven-plugin version to 1.2.4
i can accept when people criticise my code
anyways, since you're ignoring me from now on we can move on
and i don't need defenders
who actaully blame guys for talking to me
in manner they prefer
also well, i accepted your criticism
I solved it
I have some modules with nms
so it was pulling files from there
because they were missing "provided "
and middel click is working
Is it a fake gamemode or did the server recognize it as a legit gamemode change?
Noice
yeah
Probably little Tomy had idea of fixing bugs
by removing feature of MIDDLE click
🤣
hey guys
can somebody benchmark
sqrt(7)
sqrt(6)
sqrt(2) * sqrt(3)
what is faster
hi morice
??
What new font?
I literally can't notice new font
Time to get it then lmao
i guss
update
I use linux so I'm stuck on an old ass electron version that probably won't support it for another year.
heh
i just didn't update it yet i guess
or maybe russians are not allowed to get updates 🙂
Also, wdym it looks like ass? It hardly looks different from what it was.
but nobody asked for that
alr i lied
it looks weird
build a new country
build economic system
make it independent
WHAT DOES THAT LOOK LIKE
Ez.
Step 1) Make it
now you can have independet convertable currency
nah the caps is actually sick
Step 2) Print it
depends on whether you call that a benchmark
Step 3) Spread it amongst the pouplace
now run it like 5 times in a row
Step 4) Get in trouble with the existing government for creating a separate currency that isn't recognized by them.
get to jail
how to create a currency in minceraft
bascially the same but make transactions only possible via minecraft
100 ns?
minecraft the new paypal
idk if i can do maths
nanosecond..?
yes
but i had the same with my parser when running the same expression a few thousand times
System.nanoTime()
i meant
run it without loop
then run again
for like 5 times
and get the middle nanoseconds value
and then same for 6
and sqrt(2) * sqrt(3)
is 6 actually faster than 7
and well are perfect squares faster than other numbers
like 16 faster than 15
sqrt(6)
74400ns
188100ns
70400ns
72200ns
68900ns
sqrt(7)
82300ns
59900ns
83100ns
59500ns
55800ns```
average of first is 94800ns
bruuuuh
double d = 289358932.0;
double sqrt = Double.longBitsToDouble( ( ( Double.doubleToLongBits( d )-(1l<<52) )>>1 ) + ( 1l<<61 ) );
wtf is this sqrt
bit shifting
?
native method
what does what change
that sqrt is native
native methods don't always necessarily mean c++, it just means it makes use of methods that are either native to the OS or native to the hardware or both
how to create scoreboard send me docs
i meant we are not comparing OS or hardware or c++ with java
native methods in most cases are generally far more optimal then what you could create in software
we can't go to lower level
?scoreboard
c++ i just highest of lower levels
just write sqrt in assembly
what do you mean can't go to lower level?
what was even the point of that benchmark
and just testing on windows
java has JNA and JNI for native method access
in general, most things in the java api makes use of native method calls and the sorts implementation wise
that was just random idea that came up to my mind
is sqrt(6) actually faster than sqrt(7)
cuz 6 can be represented by 2 * 3
so sqrt(6) is sqrt(2 * 3)
or sqrt(2) * sqrt(3)
hello, who change
exchange
<dependency>
<groupId>org.spigotmc</groupId>
<artifactId>spigot</artifactId>
<version>1.8.8-R0.1-SNAPSHOT</version>
</dependency>
?outdated
thanks for the lesson i guess
Too old! (Click the link to get the exact time)
?1.8
Too old! (Click the link to get the exact time)
hehe
smh
sad
never seen it
oh
<dependency>
<groupId>org.spigotmc</groupId>
<artifactId>spigot</artifactId>
<version>1.19-R0.1-SNAPSHOT</version>
</dependency>
shouldn't that be spigot-api tho
but craftplayer
?bootstrap
Bootstrap Jar
The main spigot-1.18.jar is now a bootstrap jar which contains all libraries. You cannot directly depend on this jar. You should depend on Spigot/Spigot-API/target/spigot-api-1.18-R0.1-SNAPSHOT-shaded.jar, or the entire contents of the bundler directory from your server, or use a dependency manager such as Maven or Gradle to handle this automatically.
Please read the release notes for further information: https://www.spigotmc.org/threads/9-years-of-spigotmc-spigot-bungeecord-1-18-1-18-1-release.534760/#post-4305163
oh well
spigot-api is normal spigot api, spigot is spigot-api + nms
yeah yeah
Yesterday was bad
what's this
me trying to fix my solving algorithm
looks like bit shifting/shuffling
quality doesn't let me read letters
maybe i dont want that
😭
is that your maths thing
removed the old gh repo and created a new one cuz i fucked up so badly
again
lemme push it and see if you understand anything of it lmao
hehe
removed a bunch of outdated code so should be a lil more readable
lez dive
look in Expression for entry point
TokenList contains old algorithm and TokenChain contains new
yes
im planning to add predefined and custom functions
is it possible to add parent module as dependency and automatically all its sub modules
so in my core pom.xml file I currently have all of them added
So I was thinking is there a way to add "hooks" only as dependancy
PARENTHESIS
?
first time i googled it's meaning
didnt know the word either
implemented them with only 5 lines
is what working
that works yes
so square root is already included
pow is double, double yes
kinda weird but
ill probably add a predefined function sqrt()
so i guess everything works now, and you are optimizing
this aint working (should be 720)
its saying 240 instead of 120
hmm
gl lmao
people wont believe how fast a switch is lol
90% faster than a if else if else with an int
and saves battery on your phone 
Can someone tell me wich event is called when this message comes up in bungeecord?
Could not connect to a default or fallback server. Incorrectly configured address/port/firewall?
why should that be an event
I want to check if someone is trying to connect to an server thats offline
ServerSwitchEvent then maybe?
Hello so I wanted to create a new world generator. I found on internet few examples but very old and any of them don't want to work and idk why;/ Can someone help?
Chunk Generator Class:
package me.bially.midgardworldgenerator;
import org.bukkit.Material;
import org.bukkit.World;
import org.bukkit.generator.ChunkGenerator;
import java.util.Random;
public class MidgardChunkGenerator extends ChunkGenerator {
@Override
public ChunkData generateChunkData(World world, Random random, int x, int z, BiomeGrid biome) {
ChunkData chunk = createChunkData(world);
for (int X = 0; X < 16; X++) {
for (int Z = 0; Z < 16; Z++) {
for (int Y = 0; Y <= 5; Y++) {
chunk.setBlock(X, Y, Z, Material.BEDROCK);
}
}
}
return chunk;
}
}
Main Class:
package me.bially.midgardworldgenerator;
import org.bukkit.generator.ChunkGenerator;
import org.bukkit.plugin.java.JavaPlugin;
import java.util.logging.Logger;
public final class Main extends JavaPlugin {
Logger logger = Logger.getLogger("Midgard World Generator");
@Override
public void onEnable() {
logger.info("Midgard World Generator has been Enabled");
}
@Override
public ChunkGenerator getDefaultWorldGenerator(String world, String id) {
return new MidgardChunkGenerator();
}
}
my one
guys in comments fixed it
Nope :/
you are correct on this and if else is more optimal for booleans AKA conditionals
??
somebody uses switch for boolean
switch (b) {
case true -> {}
default -> {}
}```
you can if you want to
in terms of optimal performance however it would be best not to
however most people won't really notice the difference except in benchmarks and edge cases
boolean a = b || switch (c) {
case d, e -> true;
default -> false
};```
believe i forgot to put mention off
...
thank you very much, now plugin work without problems i think, so now to create the world with this Generator i need to delete old world folders and andd in bukkit.yml
worlds:
world:
generator: MWGGenerator
And it's should create world with void yes?
my generator is generating void
you don't need a custom ChunkGenerator tho
you can just use
wc.generator(new ChunkGenerator() {});
yeah, you need to delete old world folder
plugin will recreate it with no blocks
hmm do i need @Overrides ?
oh okay i learned something new
wc.generator(new MWGGenerator()); // let's create a class for generator of void
This is name of Generator that I need to put in bukkit or im wrong?
worlds:
world:
generator: MWGGenerator
because after run up i have still normal world
Hi, anyone can help me with this error? I don't know why i get this as the class exists!
idk if my generator is supposed to work with default bukkit worlds tho
oh okay it's work im just put old copy of jar haha
full stack trace @midnight shore
cool
?paste
thank you very much ❤️
why are you hiding plugin name
nobody gives a fuck
if you are too scared send me in dms
i'm not scared but i don't want to have some of my friends find what project i'm working on
anyway
dm me
SmartInvs is?
are they both installed and running
yeah
this error fires whenever i try to access Prompts.enum values
kinda like it doesn't exist
but the class is there
this class is for getting player inputs
so you access after init
yeah
wdym?
maven iguess
yeah maven
https://github.com/WesJD/AnvilGUI this is the Anvil thing
this is my pom https://paste.md-5.net/iqulaciqub.xml
if you want to access class from another plugin
you need to depend on it with maven
and add a scope
what scope do i add?
still same error
Could not pass event InventoryClickEvent to SmartInvs v1.2.7
SmartInvs is erroring
plugin which you depend on
not the one you are coding
https://paste.md-5.net/udepiwizix.nginx actually it is weird cause the first time i get this error and then the other times the other one
this one says ClassNotFoundException with the Anvil stuff
yeah
then i guess you need to set the scope on anvilgui
I did that
<dependency>
<groupId>net.wesjd</groupId>
<artifactId>anvilgui</artifactId>
<version>1.6.0-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
Does somebody know how to use PluginManager#registerEvent(Class<? extends Event>, Listener, EventPriority, EventExecutor)? Particularly the event EventExecutor
scope has nothing to do with that error
isnt the EventExecutor a lambda
An interface, yes. I'm curious what it does
cool
First off, you obviously missed an exception check that you should have been catching. When you are depending on other plugins you have to ensure they are not null or that classes don't magically disappear especially since versions can vary
(listener, event) -> doSomething()
That still doesn't tell me what it's purpose it though
If you are doing your initializing in the onEnable() what is most likely happening is your plugin is enabling before the plugin you depend on
that isn't relevant
isnt it like an observer or smth?
anyways if you have depend:
guys, AnvilGUI isn't a plugin
as you have to pass in a listener
aren't your plugin loading after
shade then
is it a library?
i guess
Well depends on the type of library it is
some people think library plugins are not plugins when in fact most actually are just don't do anything itself
https://github.com/WesJD/AnvilGUI no mentions of a plugin
yes it is
Then shade and relocate it
im fucking up again
sad ness
probably an if at the wrong position
does deploy in the <phase> part matter?
might be
something tells me this is setup like a plugin
One question more Nuker, so your plugin as normal was created to work with WorldCreator plugin yes? and how did you create the custom one?
hehehe
which plugin
WorldCreator no?
WorldCreator is a Bukkit class
the fact is that i already used this resource and it doesn't need to be added in the plugin part
not a plugin
ohh okay
alright shading is most likely not going to work for this
that project is coded for 1.8 java, and if you have a jar then its 1.8
not really going to work
wait
so what you need to do, is clone the repo locally, update the pom or poms and then build it
my project is on java 17
your project is, but libraries don't automatically get compiled with that version just because you are shading
yea i know
ok I am telling you how to fix it, basically you need to compile the project yourself for the java version you are needing
but my other project is on 17 as well and it works
then its just a matter of using your self compiled library as the dependency instead
how can i do this?
without writing everything
well you are also not following the suggested solutions either and assuming it should just magically work because you used it elsewhere
git clone the repo, update the pom to whatever java version
tell maven to compile it
how does the git clone part work?
it downloads the repo?
git clone
address
how to do it from within the IDE there should be some menu option for it
so i'll run git clone in the terminal part
yes with the web address at the end of course, note that wherever the terminal is at directory wise is where it will clone it to
unless you further specify a directory
other then the one the terminal is displaying
so i make a new intellij project and use git clone right?
if you are not certain you can go read up on git
but do i have to make a new project or not?
you could if you want to, not necessary
I am not here to hold your hand every step of the way, if you have no idea what you are doing you probably should step back and maybe do some research into these pieces of software
well thank you and goodbye : D
or maybe actually learn what your IDE is able to do if you are using IntelliJ or Netbeans
wondering why my toString is fucked up in the debug thing
where do those three numbers come from lol
The better question is where is {
If left.getValue() is an int, then yeah - that is the cause
why are you mixing character literals and quotations?
just surround the brackets with quotations like you do everything else o.O
looks better
I personally prefer using char literals when possible
Should be a bit faster to run, so doing that doesn't hurt
i always try to use '{' and '}'
well they are wanting a string and " " is for string literals
;{
character literals are more appropriate for things like escape sequences
Hi, When i try to create a file it actually creates a folder so when i try and read it with Yaml i obviously get an error... I'm currently using File.mkdirs(); and File.createNewFile(); How can i create a file instead?
show your code
check if it exists
by code
i guess
getDirectory(), getFileName() + ".yml"
you need to call mkdirs() on the parent file
file.getParentFile().mkdirs()
this will create the folder it is in
otherwise it will create the folder it is in but the file itself will be created as a directory first as well
it works! thank you
what happens when you call file::createNewFile() on a file object that has a parent that does not exist on disk?
will the parent be created?
these errors look pretty clean
i wanted to do smth too
but bro setting the location for every error is annoying
because you got to like set the location for every token
and then every node
what if u try 4*3*2+1
the problems happen when i put an operator with lower priority in front of one with higher
i just came to the conclusion my way can never work
yeah u need AST
also the new font 7 and K look so goofy
idk if im even calculating it correctly
first calculation was 17ns
or im just bad at math
no thats correct
you mean the time
ye
thought you were talking about that yours was slower
hmm looks that i was wrong and i better keep a list of calculations which couldnt been executed yet and execute them whenever i come accross one with a lower or the same priority
is that microseconds?
nah nanoseconds
first one is nearly a mc tick then
oof
infinite loop or smth
me a week ago
also function calls were slow as fuck
it kept looping but it didnt throw
so im rewriting it
why everyone writing math parsers suddenly?
for fun also i want it to be like a script language
less only math expressions
simple scripts
i mean using a switch instead of an if else if else reduced execution time with 200 microseconds
had 250 before, now around 50
damn
@EventHandler
public void onKill(EntityDeathEvent e) {
Player victim = (Player) e.getEntity();
Player attacker = (Player) victim.getKiller();
if (victim instanceof Player) {
if (attacker == null) {
Bukkit.getServer().getConsoleSender().sendMessage("§cA támadó null");
}
if (attacker instanceof Player) {
why is killer null?
read the javadoc
bruh
i shall use static when i will only have one instance of that object right?
depends
for example my messaging utils
stateless so one in which i dont take any input in?
stateless is when there is nothing stored in the class which can change, ie fields
how can I check if I can place the snow layer in a block?
something like Material.SNOW.canPlace(otherMaterial)
Do somebody know maybe how to add something to spawn via plugin? e.g let me say i want to spawn diamond blocks like coal ores.
oh very good I searched the Javadocs and EntityDeathEvent does not contains that.
Thanks
but seriously
-.-
Even PlayerDeathEvent does not works lol
"Does not working" is a useless statement. Please describe what exactly is not working, what you expect it to do, and what actually happens. If you get any console errors, also ?paste the entire stacktrace.
getKiller
@Nullable
Player getKiller()
Gets the player identified as the killer of the living entity.
May be null.
Returns:
killer player, or null if none found
Looks fairly clear to me
did you shoot it with a bow?
no, it will be null if you kill it with a bow
thats... weird...
if you physically kill them Entity you will be listed as the killer
for some reason it broadcasts that I killed X - while killed it with a bow -
What do i do to stop nether portal being lit up? one of my attempts:
public void netherPortalLighting(BlockIgniteEvent event){
if (event.getBlock().getType().equals(Material.OBSIDIAN)){
event.setCancelled(true);
}
}
if it dies to a projectile or any other means of death it will be null
but the other event cannot work?
they may have fixed projectile kills then
1.18.2 so idk
https://hub.spigotmc.org/javadocs/spigot/org/bukkit/event/world/PortalCreateEvent.html
if (getReason().equals(PortalCreateEvent.CreateReason.FIRE)
declaration: package: org.bukkit.event.world, class: PortalCreateEvent
Even using a TNT will kill the player and broadcast it that I killed them - only if I damaged them at least once -.
yeah that was my mistake i broke the rule of only casting when you are certain you CAN cast it, now i added an if condition to check if the nearby entites are instance of player
hello guys im trying to make a project with intellij (gradle) with more than one module, how could i achieve that?
i am trying to make 3 modules
common, spigot and bungee
when compiling either the spigot or the bungee i want their result to include the common module. (modificato)
[18:55]
like a local dependency
Invia un messaggio in #paper-dev