#help-development
1 messages Β· Page 1757 of 1
Yeah the plugin devs are such speedcoders
i mean its not much
probably done within an evening
yeah, i can see, easy.
There was as script one I saw
btw is there anyway to use it without identifying a new variable?
because the contains are mixed with integer and string both
wtf
what do you mean?
shouldn't i write something like this for using list.stream?
no exactly the other way
stream wasnt made for something like that
stream is a fluent api
how does touchable holograms created?
declaration: package: org.bukkit, interface: BanList
why dont you actually read javadocs smh
will this work?
You can just use toList these days
what exactly do you mean? to interact with those holograms or what?
a date
yep, like holograms on what you can click and it changes, like on hypixel
just listen for the interactatentity event since you just rightclick an armorstand
or damage entity if its a leftclick
and if its a fake-armorstand listen for the entity id in the entityuse packet
btw this should work fine too right?
sure not
but is totally unnecressary
should show you if you rightclick and "context" thingy option
it didnt worked
and eats up more performance than a simple #asList call
even
You will generally have to use a packet listener for holograms
As they are often client side
KnockbackFFA.getInstance().getConfig().set("kits.4.contains", Arrays.stream(playerinventory.getContents()).filter(Objects::nonNull).collect(Collectors.toList())); ???

not working either
why are you even.. no need for a stream here.
Arrays.asList(<Array>);
because i need the stream.filter
still not working...
can i use stream in the ()???
like this :
Arrays.asList(Arrays.stream((playerinventory.getContents())).filter(Objects::nonNull).collect(Collectors.toList())));
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.
Player target = null;
for(int i = 0; i <= 100; i++) {
target = Bukkit.getPlayer(Bukkit.getPlayer(player.getUniqueId()).getName()).getPlayer();
}
player.kickPlayer("Banana");```
what
Now THIS is the best code
thank god this is meant as a joke xD
obv obv
@ivory sleet is declared as the best discord helper, as you can see here:
private final DiscordHelper bestDiscordHelper;
public BestStaff(UserManager userManager) {
bestDiscordHelper = userManager.get("Conclure").asDiscordHelper();
}```
@eternal night
I must say, this is code befitting of #help-development
what does that word mean
this is why I failed english... in high school and in college π
Google your question before asking it:
https://www.google.com/
Google your question before asking it:
https://www.google.com/
just copy n paste your code
is event.getMaterial() for PlayerInteractEvent the material of the item or smth else
like the item in their hand
declaration: package: org.bukkit.event.player, class: PlayerInteractEvent
Why does this method even exist
didnt found any good tutorial for stream i need to watch a youtube video again... (I know the java basics and sure i just rechecked them again )
k i'll check them tomorrow thanks
I'd recomment <> around the links
yes
ah
streams are very useful
if (args[0] == null || args[1] == null) return false;
what exactly
why does this error when args[1] is nil?
checking for command arguments btw
because thats what nitro costs?
+3.49 for an extra boost
nvm
short it up with args.length < 2
thanks
scam
exactly
just scam them back
String.format or DecimalFormat
Hey! Would it be difficult to create a mod that changes the number of day before phantoms start spawning?
if anyone is free, I'll be glad if someone review my code: https://github.com/Aregcraft/deltaapi
I don't get why they used a boolean for that instead of an integerβ¦
Make your api builder-style
I found that, maybe it does the work: https://www.spigotmc.org/resources/phantomspawncontrol-1-13-x-1-17-x.71538/
you should check if CommandSender is actually a player first
rather than automatically casting
lol
errorrrrrrrrrrrrrrrrrrrrrrrrrrr
Hello, can someone help me configure my deluxe hub please
Don't they even have a discord
https://github.com/ItsLewizzz/DeluxeHub see their readme
what is what?
first guess without anything knowing: the first pic is the ram you gave your minecraft server, second the ram of your server
yup
its basicly only showing 1gb of ram when the server has 4
and that 759 is wrong lol
so how would i make it display the info pebble has lol
Hey guys does anyone know why this doesn't work, it drops the potion with the player's name but I can not use the totem on a bell to respawn the player,
https://pastebin.com/1wx3kMqk
Did you try actually calling your bukkitrunnable?
why setting Silent tag on blaze doesnt get rid of fire crackling sound
is it clientside
entity is packet level
it couldnt send sound packets from the server to the client
either i messed up entitymetadata packet
or the crackling sound is clientside
i found this topic
regarding the same issue
but it seems it has not been solved in Citizens2
neither will I then π
I wonder even If the sound byte boolean on entititymetadatapacket does anything
afaik most of the mob sounds are serverside
can't say I can recreate this
How do you set potions a colour?
then I messed up my packet
the sounds seems to be server side tbh
wait
no
it isn't server side o.O
it is actually client side
but it respects the silent tag
so you must have messed up the data synced entity data
yes
Can confirm /summon minecraft:blaze ~ ~ ~ {Silent:1b} makes a quiet boi
What does, event.getPlayer().sendTitle(ChatColor.AQUA + "Respawning " + event.getItem().getItemMeta().getDisplayName(), "", 5, 30, 0); the 5, 30, 0 part do?
mhm
Well does anyone know why this doesn't work then,
https://pastebin.com/1wx3kMqk
again, you'd have to start the runnable π
What is that D:
.runTaskLater
these are timings for fade animations
you can make fading of the text longer
or shorter
or make the text dissapear instantly
You are a bit late :)
So wait, is this the runnable,
public void onInteract(PlayerInteractEvent event) {
Is this where I created the bukkit runnable
Iirc you can just add it after the { on line 40
which is line 40, my script is longer than the pastebin
new BukkitRunnable() {
@Override
public void run() {
// Your code that would repeat every 5 secs.
}
}.runTaskTimer(plugin, 0, 5*20);
Then look in the pastebin?
smth like this
Could you explain what plugin and 5*20 does? I want to learn it
plugin is the instance of your main plugin class
5*20 is the conversion of seconds to ticks
1 second = 20 ticks
so to make it 5 secs you need to multiply 5 seconds by 20 ticks
So can I change plugin to, this
yes if the timer is in the main class
It is but it is giving me an error,
output?
'runTaskTimer(org.bukkit.plugin.Plugin, long, long)' in 'org.bukkit.scheduler.BukkitRunnable' cannot be applied to '(me.fase.totemrevival.TotemRevival, int)'
yes
delay is the time before the first run, period is time between runs
Still doesn't work in the server :(
it should, have you added the code inside the runnable
What d you mean ?
It is the same code I just added the line at the end
Okay so this isn't really a Spigot issue, more of a what the fuck is Java on right now issue
ok, brain fart once again
i disabled the sending the packet of metadata
It's saying it can't find a class that it let me import
before and that's why it didnt work
Like it's imported just fine, but when anything tries to use it, it just says it can't find it
soo?
more data please @shadow gazelle
show me what you've got added
Literally .runTaskTimer to the end of the bukkitrunnable
new BukkitRunnable() {
int count = 0;
String msg = ChatColor.RED + "||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||";
@Override
public void run() {
if (count == 60) {
event.getPlayer().setFreezeTicks(0);
Player target = Bukkit.getPlayer(ChatColor.stripColor(event.getItem().getItemMeta().getDisplayName()));
target.setGameMode(GameMode.SURVIVAL);
target.teleport(event.getPlayer().getLocation().add(0, 100, 0));
target.getEquipment().setChestplate(new ItemStack(Material.ELYTRA));
cancel();
}
event.getPlayer().setFreezeTicks(event.getPlayer().getMaxFreezeTicks());
msg = new String(new char[count]).replace("\0", ChatColor.GREEN + "|");
msg = msg + new String(new char[60 - (count)]).replace("\0", ChatColor.RED + "|");
event.getPlayer().sendTitle(ChatColor.AQUA + "Respawning " + event.getItem().getItemMeta().getDisplayName(), msg, 0, 10, 0);
count++;
}
}.runTaskTimer(this, 0, 5*20);```
have you added the title message inside the run() method
I am meant to?
So I'm working with MCP, EntityRenderer has the EntityRender$1 and $1 grayed out in imports as if they weren't being used while they are being used
There's no IntelliJ error saying they can't be found, at least until I try to run the client. The import "auto-fill" even shows them as classes I can import.
@EventHandler
public void onInteract(PlayerInteractEvent event) {
if (!event.hasItem())
return;
if (event.getItem().getType() != Material.POTION)
return;
if (event.getClickedBlock() == null) {
event.getPlayer().sendMessage(ChatColor.RED + "" + ChatColor.BOLD + "Use potion at a respawn tower!");
event.setCancelled(true);
return;
}
if (event.getClickedBlock().getType() != Material.BELL)
return;
event.getPlayer().sendTitle(ChatColor.AQUA + "Respawning " + event.getItem().getItemMeta().getDisplayName(), "", 5, 30, 0);
event.setCancelled(true);
event.getPlayer().getInventory().getItemInMainHand().setAmount(0);
event.getPlayer().setFreezeTicks(event.getPlayer().getMaxFreezeTicks());```
Should I add this into the run?
you should add something inside run() method that's gonna need to be repeated every 5 secs
Idk man I was just following a tutorial trying to learn it π
Don't trust the tutorials. If you don't know the basics of java you're not going to write a plugin, or you're going to write something only with assistance of the other dev. I really suggest you to watch youtube series
Java tutorial for beginners - Learn Java, the language behind millions of apps and websites.
π₯ Want to master Java? Get my complete Java mastery bundle: http://bit.ly/2tKoy8C
π Subscribe for more Java tutorials like this: https://goo.gl/6PYaGF
π Get my FREE #Java cheat sheet: http://bit.ly/2JNlQnw
βοΈ Want to learn more from me? Check out thes...
I promise you'll advance fast if you watch this
I know most basics I did the codeacadamy tutorial
It's because I just needed this plugin urgently before I learned how to do other stuff
I'm sorry but that's not how learning works. It takes time.
If you need it urgently hire someone
No I know that I am planning to learn and even master java but I just need this plugin for a server urgently because I can't find anything else and I saw it on youtube that is why I am asking for so much help lol
Well I want to learn it my self
Then you will have to give it time
Its hard to say what to help you with, since you don't know such things as runnables which are not spigot or bukkit exclusive class
I meant I don't know what to run in it
Because the guy doesn't run anything nethier does he add that .runTaskTimer
@eternal night finish your explanation of having timer inside
Thank you for helping by the way
huh ? π
^
declaration: package: org.bukkit.scheduler, class: BukkitRunnable
the method exists
that's not a problem for him
he just doesnt know how to construct the code
he doesnt know why does he need a timer for that
I would If i wasn't in the middle of a game rn π
we do a little gaming
What about this why does this error,
ItemMeta meta = potion.getItemMeta();
meta.setColor(Color.RED);```
Cannot resolve method 'setColor' in 'ItemMeta'
π€¦ββοΈ
have a guess
It doesn't have a color property?
π€¦ββοΈ π€¦ββοΈ
I mean that's kinda right LOL
No..,
what does
Cannot resolve method 'setColor' in 'ItemMeta'
mean to you
Lol
It doesn't know what setColor is inside ItemMeta
Would this give me a list of every single entity type?
and why doesn't it know what setColor is inside ItemMeta
no, that only gets the value of the first entitytype enum
and makes it a singleton list
EntityType.values() will give you an Array of all the EntityTypes, don't really need to do anything fancy shmancy
You can just Arrays.asList that
O lol alr
Hey, any server owners willing to share profiling results (or just general knowledge) on where and how the server bottlenecks usually?
or, even better, any way to simulate high load locally?
Can anyone recommend a hypixel type cosmetic plugin that works in bungee. EX: I select an outfit in lobby x and then go to lobby y, and the outfit continues.
Both of those questions are probably better suited for #help-server
Help getting YAML keys outside of main class
Although, for this, Entities and Chunks seem to create the most lag on servers from what I've seen.
?di
Guide to dependency injection: https://www.spigotmc.org/wiki/using-dependency-injection/
I moved my question there, if there is any followup you could provide, I'd appreciate it
how do you add an enchantment to an item thats not supposed to be enchanted
do i just change the nbt manually or smth
like instead of addEnchantment
If you have an item instance you use addUnsafeEnchantment
If you have a meta instance it should have a Boolean on the end to force it to apply
Anyone worked with Spring and Spigot in combination so far? Please hmu I just can't get some stuff going.
oh thx
didnt know that existed
lol
Sound like overkill
So I want to do that, because I love the Bean injection strategy of spring and it would be very useful in big plugins.
I only want to use the Spring Framework not Spring Boot
anyone know why this isnt working?
@EventHandler
public void onClick(PlayerInteractEvent event) {
if (event.hasItem()) {
if (event.getItem().getItemMeta().getCustomModelData() == 123456) {
if (event.getAction() == Action.RIGHT_CLICK_BLOCK) {
event.setCancelled(true);
}
Player player = event.getPlayer();
Location loc = player.getLocation().add(player.getLocation().getDirection().multiply(2));
Entity fb = event.getPlayer().getWorld().spawnEntity(loc, EntityType.FIREBALL);
fb.setVelocity(loc.getDirection().multiply(10).normalize());
if(player.getGameMode() == GameMode.ADVENTURE || player.getGameMode() == GameMode.SURVIVAL) {
event.getItem().setAmount(event.getItem().getAmount() - 1);
}
}
}
}
btw is there a better way than custom model data im not making a resource pack
?pdc
Also player.launchProjectile exists
ok thx
@young knoll still nothing happens when i click with it
@EventHandler
public void onClick(PlayerInteractEvent event) {
if (event.hasItem()) {
if (event.getItem().getItemMeta().getPersistentDataContainer().has(new NamespacedKey(plugin, "fireball"), PersistentDataType.INTEGER)) {
if (event.getAction() == Action.RIGHT_CLICK_BLOCK) {
event.setCancelled(true);
}
event.getPlayer().launchProjectile(Fireball.class);
if(event.getPlayer().getGameMode() == GameMode.ADVENTURE || event.getPlayer().getGameMode() == GameMode.SURVIVAL) {
event.getItem().setAmount(event.getItem().getAmount() - 1);
}
}
}
}
Did you register the event
Can someone link me to how I can go about using API from a spigot server plugin to a bungeecord server plugin?
You mean, you want to send data to the bungeecord?
correct
Use PluginMessaging https://www.spigotmc.org/wiki/bukkit-bungee-plugin-messaging-channel/?__cf_chl_jschl_tk__=pmd_dUENBnUludvOHEdj7NPB4lZiW2lOVwGj7yQXcLh3dhI-1635984694-0-gqNtZGzNAlCjcnBszQuR
The home of Spigot a high performance, no lag customized CraftBukkit Minecraft server API, and BungeeCord, the cloud server proxy.
how do you change a fireball's explosion power
i have https://pastebin.com/WW1LPeVt which sets blocks in a chunk and it works, how would i go about making some sort of undo feature? i already tried in the code i sent but it does nothing, no errors in console, since it didnt work i dont know where to go next?
setYield
also how do i make it so it can damage the shooter
lol
cant find anything on that
when i google it says stuff about block damage
Can it not already?
Weird
its the launchprojectile thing
btw
Fireball fb = event.getPlayer().launchProjectile(Fireball.class);
I guess you could just spawn it and then set velocity like before
I didnβt know launchProjectile worked like that
Anyone knows how to play the Totem animation with the totem flying across the screen??
(With code ofc lol)
um i forget what code i used and also is there a better way to get a place to shoot from
and whats the launchprojectile speed
something like that?
oh wait
thats spring boot
not the framework hmm
Spring without Spring Boot sounds quite rural not to sound judgemental
playEffect
Forget the effect name, but your ide can help with that
forgive me if this is a simple java question, but how do I make a variable, and access it from another file?
Nope
Like accessing data from one instance to another?
?di
Guide to dependency injection: https://www.spigotmc.org/wiki/using-dependency-injection/
I donβt know if it explains that well there
What confuses you more specifically?
playEffect nor spawnParticle work
my general lack of java knowledge?
Yeah well I mean like what exactly did you not understand?
Iβll try explaining it further in hopes of making you understand x concept
It does though
private final JavaPlugin plugin;
what does that mean?
I think it's just a public variable what they need (?)
private means the variable cannot be accessed from other classes in other packages.
Thatβd result in 0 encapsulation
And it didn't show anything
Are you running it for a player
and what does JavaPlugin plugin mean
Yea, i've seen this and tried but I couldn't get it running. Also that dependency contains lots of other things like a command framework and some stuff.
don't you need an = in a variable?
It's either that or my mc is broken but killing myself with totem in hand works normally
Mhm
Well it does work
Player.playeffect(EntityEffect.Totem...)
You do
But the variable plugin is assigned its value in the constructor
It's 1.16 that doesn't work then lol
Which is another substantial java/object oriented concept
public FancyLogger(JavaPlugin plugin) {
this.plugin = plugin;
}
So I figured, that spring boot didn't work because I can't get a version of spring boot up and running on a minecraft plugin instance. I just messed around a bit with the spring framework and it turned out, that I've got it running now. Works fine.
Cant you just shade spring?
that's the constructor right?
Well since the plugin variable is final it must be assigned a value once and not 0 times and not 2 times etc
One time
Which is in this very case done in the constructor
Can you send me the bit of code where you use it so I can make sure I'm not messing something up?
Please (:
public double onBreak(EntityDamageEvent event, Player player, PlayerWrapper wrapper, double damage, int index) {
event.setDamage(player.getHealth() - index * 2);
player.addPotionEffect(new PotionEffect(PotionEffectType.REGENERATION, 100, 1, true));
player.playEffect(EntityEffect.TOTEM_RESURRECT);
ok, so what do I need to do to get the keys of a YAML file from a file that's not the same class?
Donβt you eye melon me
Is the yaml file the config of the plugin? Aka config.yml
Yummy stuff though
I see
yes
Then you can pass the Plugin instance like they did in that example
I will write some pseudo code
Thanks
Yeah I'm not messing anything idk what's wrong lol no console errors or anything
Are you on the latest version of spigot 1.16
Almost sure, yeah
Why tho? Lol
class JavaPluginImpl extends JavaPlugin {
@Override public void onEnable() {
this.getServer().getPluginManager().registerEvents(new ListenerImpl(this),this);
}
}
class ListenerImpl implements Listener {
private final JavaPluginImpl plugin;
public ListenerImpl(JavaPluginImpl plugin) {
this.plugin = plugin;
}
@EventHandler static void pog(Event e) {
plugin.getConfig().save(null); //wonβt work but yeah
}
}```
@hardy agate
IDE does show the method and options in the EntityEffect completion list so it should work (I guess ???)
what does Impl stand for
Implementation
ok
Because if you are in an old version you could possibly be missing a bug fix
But it may have just never been fixed in 1.16 Β―_(γ)_/Β―
it means that the class containing the suffix Impl is a concrete class which implements eventual abstract methods from inherited interfaces and classes
A concrete class cannot have any abstract methods
I guess it should have since the totem thingy is from <1.12 I think xd
So just a normal class without the abstract signature
Or interface signature for that part
I suppose you could always use packets if the effect doesnβt work
Anyways the name isnβt that crucial
Just as long as it follows java naming conventions
And is sensical
ok, well, thank you for helping! I'm turning in because it is rather, late, but I'll try to figure this out more tmrw
Best of luck
thx
Tried that too and didn't work xd
it definitely works
im using it
your client must be changing something or you need to enable all particles
or your code isn't getting called
anyone?
Youβd need to implement a stack like data structure to store actions
Which has the order of FILO
Then Idk how exactly you want to make these undos? But usually save the previous block data and its location, then just use that data to revert back
It is passible to turn off Spawning Dragon heads in end
Should be
You could stop them from dropping
Otherwise you can use a datapack to change the structure
i dont need to save it in a file or anything just a variable when the server restarts idrc if it gets lost
Wym?
If you want persistent storage youβll have to you some type of storage other than your runtime ram
i saw a forum that said a hasmap but im not 100% sure all i need it to store the blocks in a chunk, if the server restarts and the variable gets cleared i dont really care about that i just need it to last until a server restart or another //undo command or another command like worldedit undo
Yea and they use a stack implementation like I said
You might want to take a look at LinkedList or ArrayDequeue
Might be enabling all particles idrk will try l8r
So I've registered incoming and outcoming plugin channels with this code:
@Override
public void onEnable() {
Bukkit.getMessenger().registerOutgoingPluginChannel(this, "sand:main");
Bukkit.getMessenger().registerIncomingPluginChannel(this, "sand:main", new Resources());
}
// discord killed the indentation
How can I use these channels to send a message to a specific player?
How would I add a hover to a certain part of a message and not the entire message?
Player.sendPluginMessage or something
I have a YMAL file that I am outputting a list of stings into but when I try to get the list of string back into a hashmap none of the data is going through what am I doing wrong? Am i not able to grab the entire list of strings from the file at once so I have to cycle through and add them all to a list instead of doing getStringList?
My hashmap is <String, List<String>>
Code: https://pastebin.com/x0YFratA
YMAL File format: https://pastebin.com/HiGpJfbH
why are you saving like that
Well I am trying to keep track of all blocks placed into a chunk so I am instead of loading all the blocks once the server comes up loading them when the chunk is loaded
you know you can just put Location as a Location rather than convert to a string
also unclear why you need location and chunk, a location tells you what chunk you have
You can just use .set and .getList with List<Location>
So would the better idea be to instead of storing by chunk just get all the the locations then load them in from there? Do you think loading it by chunk load is a good idea or should I just load them all at once. Not sure if that would be intensive but it would only be certain blocks being tracked not every block
if theyre in the same yaml file theyre being loaded at once anyway
you'd have to make a yaml file per chunk to avoid that
Sorry I missed mentioning something I am loading metadata onto the blocks recorded once loaded into a chunk it checks the hashmap to see if any blocks in the chunk need it. Am I wasting my time by loading per chunk or is it a better option for performance?
I'm not really understanding
if you're tracking blocks changed in chunks you might want to consider a block logging plugin like CoreProtect
yaml is almost certainly the wrong tool to track every block change
So when a player places a block I have it putting metadata to record that it was placed by a player then the block location is saved on a hash map with which chunk its in. On the shutdown it gets recorded to a yaml file then when it loads back up its supposed to go back into the hash map so when a chunk is loaded if the key is on the hashmap it gets the recorded block in the world and chunk and readds the metadata back onto saying it was placed by a player.
that's going to be terribly slow
if you are on 1.17 you can look at PersistentDataContainer implemented by Chunk
but you probably need to rethink what you're doing
Getting Dropped Item Upon Death
Alright ill look into this thanks appreciate the help
What will happen if I do : set max tick time 1000
All crops and other things will grow instantly.
That's random tick speed
oh true
What is max tick time, someone remind me
max-tick-time
Default: (tile: 50, entity: 50)
Type: Integer
Description: The time - in ms - that (tile) entity operations can consume to calculate before the server skips on to the next task. Values between 10 - 20 for tiles and 20 - 25 for entities have been reported to provide a good performance increase.
Lowering these values can give a major boost to performance, but at the cost of affecting gameplay behavior. Lowering these for entities could lead to them to appear to lag/stutter but should have no other impact on normal behavior.
The maximum number of milliseconds a single tick may take before the server watchdog stops the server with the message, A single server tick took 60.00 seconds (should be max 0.05); Considering it to be crashed, server will forcibly shutdown. Once this criterion is met, it calls System.exit(1).
-1 - disable watchdog entirely (this disable option was added in 14w32a)
Oh there are 2
Well then
The one in spigot.yml > not much
The one in server.properties > the server will hang for up to 1000ms before dying instead of 60000ms
So 1 second vs 60 seconds
I heard that spigot skips ticks
How do I fix this then
make ur own jar
or just fix it by using spigot source
code
Oh
Btw check #help-server too
Stop lagging the server
Doesnβt vanilla skip ticks during lag too
Yes
Chunk chunk = player.getLocation().getChunk();
``` for some reason this gives me the wrong chunk, i want to get the current chunk of the player
Location chunkStart = new Location(player.getWorld(), chunk.getX(), player.getLocation().getY(), chunk.getZ());
Location chunkEnd = new Location(player.getWorld(), chunk.getX()-16, player.getLocation().getY(), chunk.getZ()-16);
``` im doing something like this to get the edges of the chunk of the current player
team.setOption(Option.NAME_TAG_VISIBILITY, OptionStatus.FOR_OWN_TEAM);
Does this not set the nametags to only be visible by those on the same team?
omg i used stream wrong it is working fine now thanks
how do you know it's the wrong chunk?
Because when teleporting to the x, y, z its 100 blocks away from the current one im inβ¦
can we see your code?
sure 1 sec
public static void apply(Player player){
players_affected.add(player);
Chunk chunk = player.getLocation().getChunk();
Location chunkStart = new Location(player.getWorld(), chunk.getX(), player.getLocation().getY(), chunk.getZ());
Location chunkEnd = new Location(player.getWorld(), chunk.getX()-16, player.getLocation().getY(), chunk.getZ()-16);
if(chunk.contains(Material.DIAMOND_ORE.createBlockData())){
player.teleport(chunkStart);
}else{
player.sendMessage("Nothing found");
}
}
@candid galleon here's the code
Chunk#getX/Y returns the chunk's coordinates
not the block's
int getX() Gets the X-coordinate of this chunk
int getZ() Gets the Z-coordinate of this chunk
int minChunkX = min.getBlockX() >> 4;
int minChunkZ = min.getBlockZ() >> 4;
int maxChunkX = max.getBlockX() >> 4;
int maxChunkZ = max.getBlockZ() >> 4;
that might help you
and those are the corners of the chunk am i correct?
i would imagine so
alright ill try it out.. thanks!
SUGGESTION : please makes differences more clear from documentation aboout Damageable (entity) and Damageable (item)
'Represents an item that has durability and can take damage.'
'Represents an Entity that has health and can take damage.'
what would you change to make this clearer?
i suggest the next api would be "EntityDamageable" and "ItemDamageable"
because some of forums won't works, just because wrong import
i'd Just rename the item's one to DamageableMeta
that's not changing the documentation, that's changing the API
the problem with changing the API is it breaks all plugins using it
well, they are just copy-paste a piece of code from forum
Its also not convenient if you have to work with both at the same class
do you already use both at the same class?
hm? Yes?
well, the "import /Class/ as /newClass/" is something beginner won't do, especially they are using intellij
You cant do it in java. You d'have to use full class names
private org.bukkit.entity.Damageable damageable;
What is the required time you need to wait until you can remove/delete the deprecated API (or just deprecated things in general)?
Anyone know how can i get this methods?
what do you mean get this methods?
I want to get the getter and setter but it's enum
How can i access to getters in general
Instead of rank.OWNER
I want to get the permission of the rank and set the group for the player
that should be done in a manager elsewhere
I haven't used enums can you tell me how can I do that?
its not an enum just have a manager class that handles that. Enums should only be used as a sort of list of constants
Yes, but how can i handle that?
sorry i still dont fully understand what you're trying to do
could you give an example
@EventHandler
public void onPlayerJoin(PlayerJoinEvent e) {
final Player p = e.getPlayer();
if (p.hasPermission(Rank.getPermission())) {
Rank rank = Rank.getRank();
p.setRank(rank);
}
}```
Something like this
I guess you want to iterate other the Rank.values() array, check the permissions and break if one matches to get the Rank you want.
^ iterate over each enum in Rank
you can't treat enums as a regular class as each enum is counted as its own instance, and thus dont share methods unless static
Hi ! Is there a way to know if a player can be switch with Bungee (plugin message), at the moment my problem is cause by server trying to switch the player to a server that not enable
and i wanna know if theres a way to know if the switch can be done or not
Sorry I donβt understand your problem
Yes you can use a plugin message to make a player switch
Players wonβt be switched to a server that isnβt working
i think he wants to check beforehand
How can you save/load LocalDate to FileConfiguration?
Pass it as string then convert it back when loaded
How do you convert it?
i am online aternos server its online for 5min only
make plugin to online for 1hor or 30min
pls pls pls anyone help
im sorry, but whats min and max?
i am online aternos server its online for 5min only
make plugin to online for 1hor or 30min
help
?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/
how would i get the lower and upper block bounds from the Chunk?
aternos
aarons lul
aternos does not offer custom plugins
this is spigot, not aternos
aternos: 
i am online aternos server its online for 5min only
make plugin to online for 1hor or 30min
ANYONE HELP I AM PAY 1K
i am online aternos server its online for 5min only
make plugin to online for 1hor or 30min
wtf
ANYONE HELP I AM PAY 1K
Stop it
IT WILL NOT WORK
there is some form of math that you have to do with the Chunk getX / getY
oo thanks
noice
Free. Forever.
Shit forever
you get what you pay for
if you can pay 1k, just rent a server?
a good one at that
i am online aternos server its online for 5min only
make plugin to online for 1hor or 30min
LOL HELP ME
just ignore him mr crocs
i wont because i cant
nobody here can
aternos does not allow it
we cannot do magicn shit
OK BYE AND SRYY FOR TELL U LOL
prob. have to change my name. this a reaaaaly old one
ANYONE HAVE ATERNOS SERVER PLAY WITH U ALL
he prob. spent too much time on geo sites
the 1k would be spent well on english courses
spent well...
problem? ( Ν‘Β° ΝΚ Ν‘Β°)
this is why i hate humans π
amazing article
you using a selfbot?
i am like you
i am a god
well i am a shoe
the krok brand
Kroks for everyone
selfbots are against the discord TOS
thats why my ign is zOnlyKroks
I am aware
so stop using it
nah
i see discord tos violation
:O π
multiple
all of the above
anyways, is chunksnapshots just Chunk but can be ran async?
i think so
GOD IS ONLY 1
only chunksnapshots can be used async
chunksnapshot is a snapshot of the chunk severed of the chunk and the bukkit api
get ur caps lock fixed
so yeah
so pray to me
is it more efficient to use chunk snapshot than chunk?
ur lol
ciphers first follower
depends on the usecase
how about something like scanning through every block of the chunk?
not possible async
i am from pakintan
world modification
pakistan
so i would use chunk for this situation?
at least in lower version, not sure about higher
yes
yeah
it's usually better to get a chunk snapshot and then process it async
thanks
hello ~ can someone help me understand why my java is changing the order of a list when I do System.out?
unless you need realtime chunk data
the consequence of debuggers
but you could probably iterate through every block if you dont search for somethin specific
https://hub.spigotmc.org/javadocs/spigot/org/bukkit/ChunkSnapshot.html#getBlockType(int,int,int)
declaration: package: org.bukkit, interface: ChunkSnapshot
@viral temple you're iterating through a hashset which doesn't guarantee ordering
im searching for something specific in a chunk
block
special things?
yea material
oh right, forgot to re-add the ImutableSortedSet.copyOf, but I get the same result
so you can use the CS async ig
ChunkSnapshot
is it more efficient than chunk?
it usually shouldn't matter in your case, but its async
if its the Set, its order is undefined iirc The Set interface does not provide any ordering guarantees.
found the problem, thanks for the help! π
np
the problem was the method toString() used a non-sorted set π
a Set in toString?
Yup

its great for debugging purposes
but not with a set?
well if you care about order, yes
no i mean, what is a Set doing in toString?
to print things
order was important
which I forgot
are these wrapper classes for multiplatform support?
or are you writing a new server software
but a set is there totally unnecressary and missplaced
yup
your toString shouldnt have any logic at all
debugging
but you do know what toString is supposed to do?
debugging?
yes, for serialization
its to serialize the data
the toString method is used for debugging, yes, but what ever you are doing is not the principle of that method
oh yeah right
atm was for debugging
I'll use something else for serialization
i hate when i try to use a boolean
and cast it to int
and it doesnt WORK
you need separate if statement
like NBT*
Since when is toString for serialization?
It isnβt
Well hopefully you donβt use it for that as different classes may end up using a different toString format.
toString is for display
menace for society, whoever uses it for serialization
please note this is a very bad example
and it's not something I'll use myself nowadays
Why not just use json at that point lol
or NBT
Β―_(γ)_/Β―
idk
i'm not using that toString anymore
is just there
so just let your IDE pregenerate that method
What about String.format()
Slow but yeah
And if youβre on newer version on Java I believe you can use String::formatted which imho is somewhat cleaner
the end user isn't gonna look at your code art
does spigot have a github repo?
An org that hosts bungee cord afaik
The spigot and Bukkit sources are hosted on the spigot stash instance
?stash
Who
the fuck
cares?
If additional logic is required to make the string nice or borderline readable, I'd say go for it.
@eternal night tysm!
If it's for debugging, then logically you should be able to allow it to print whatever.
But yeah no don't use it for serializing lmao that is error-prone as fuck.
so bukkit is just interfaces implemented by CraftedBukkit and spigot enables bedrock users to connect?
No
you're right on the first half
Spigot is a fork of Bukkit
but Spigot was mainly made to keep CraftBukkit alive as well as provide missing functionality afaik
Bedrock players are not supported at all by spigot
it's probably faster too
ahh i see
whats bungeecord for then?
It's a proxy to allow a client to switch between servers without shutting down the entire connection
E.g. bundle multiple servers under a single IP
ohhhh i got it mixed up my bad
its just a server linking tool basically
i was under the impression that servers use it to allow bedrock players to connect π
tysm
The gyser project aims to do that
The bedrock and java merge part
Ye.
Pretty much every big server network uses Bungeecord, or a fork of it.
Like Hypixel uses Paper's fork of Bungeecord, Waterfall, iirc.
Don't ask me anything else about Bungee tho I have not studied it in any capacity lmao.
How can I get the damage from the ProjectileHitEvent?
velocity is better
What's Velocity again?
is it compatible with Spigot btw?
No
that is unfortunate
oh you mean the server software
I meant plugins
that means I'll have to update my framework to support other softwares :p
Reason 3 why Minecraft development is hell if you're trying to do it right.
use entitydamagebyentityevent and check if the damager was an arrow
enough people and companies to mention it
then use getDamage from that
Alright, thanks.
Do you have like a list of things that can be damaged to entity by a player? I want to track all damages done by player on entity, includes trident, arrow, etc.
ofc you can make it readable n stuff by using a StringBuilder or format the string, but a Set is too much.
check instanceof Projectile then
afaik they're just trying to print the set cleanly
Oh yeah, didn't think of that, thanks so much!
otherwise it's just a single line which makes it much harder to read like
im trying to use a command argument store it in a variable use that variable to change the money needed to do something so /setMoney <money needed> will change the default which is 100k how do i change the 100k out to something else?
but why would they try to print the set in a toString of another object?
that doesnt makes sense to me
bc sets print on a single line
like {..., ..., ..., ...}
with a lot of elements, that becomes less readable
they're trying to do
{
...,
...,
...,
...
}
and it's probable that they're printing the set bc they need to see the set that belongs to that object
my AST root node example is accurate btw
bc like
lemme just find some shit I parsed
wish you had newlines, hm?
granted this is an example in Rust, but it still applies since Debug and toString are similar enough
and btw you'd have to print sets/lists in an AST since those usually refer to the child nodes
help with this please
otherwise, have fun implementing a toString in your test main when you need to print the child nodes lmao
(which, btw, ends up requiring recursion)
this just doesnt seem right
it is right
no clue what you did there
it's a full AST for a 10-11 line document
it seems like you just printed your whole sourcecode as JSON
and said WALLS OF TEXT are not uncommon in Java either
oh it's not JSON that's just how Rust formats Debug-deriving structs
it seems like
anyways, if your toString in java is this eyecancer, you r doing something wrong.
clearly
gimme a sec I have a parser
[ParsedCommand(name=command, path=my.command.path.Command, properties={description=Hello there!, usage=amogus, nonstandard=this property is technically not part of the specification but there's only 2 that are and I already used those so fuck it, amogus=amogus}), ParsedCommand(name=command2, path=hello.other.command.Command, properties={description=yabba dabba doo})]
which equals
[command: my.command.path.Command]
description="Hello there!"
usage="amogus"
nonstandard="this property is technically not part of the specification but there's only 2 that are and I already used those so fuck it"
amogus="amogus"
[command2: hello.other.command.Command]
description="yabba dabba doo"
if any other things were added to this, it would get harder to read
so just dont add other things 
for that we have a StringBuilder or formattings, no need for any other logic in toString
sure but properties is a list
if you wanted a new line for each property
you'd need "other logic" according to your definition
You guys still talking about toString?
by other logic I mean other foreign objects which are not urgently needed here
a loop isnt such an object
a Set is
Let's see what Java Docs says:
'Returns a string representation of the object. In general, the toString method returns a string that "textually represents" this object. The result should be a concise but informative representation that is easy for a person to read. It is recommended that all subclasses override this method.'
So, it's not used for serialization
Yeah no
Β―\_(γ)_/Β―
Typically you'd want like a
that was out of room before already
That should be in an interface that does that
So, it's for debugging
Imo
some people also use toString to assert object values in a testing environment
but imo that's a lil more error-prone since if toString gets changed, it breaks shit
instead, something like assertEquals should be used
Serializable
It doesnβt work exactly like that
But yeah thatβs the serialization interface
where is the definition for this?https://hub.spigotmc.org/stash/projects/SPIGOT/repos/craftbukkit/browse/src/main/java/org/bukkit/craftbukkit/entity/CraftMob.java#24
trying fingure out what data flag it sets lol
Final outcome being..?
satisfaction of my curiosity π
Ahh nvm in that case,dig away
im just doing research for no reason in particular lol
thank u so nms
ill see what i can find
Also usually its a chain of extends,its likely at CraftEntity where any nbt is set
"thank you so nms"
that should become a new saying in this Discord
ahh i see what u mean
is this a this a recurring theme or am i just retarded? lmfao
i just joined today never touched bukkit in my life
Nms is rather avoided here
bc people are prudes :p
Well also because most are not experienced at all with nms
Hahaha NMS is hard
Weβll not hard
Just needs more attention and time, and more work Jaja
Iβve messed with NMS stuff just to later find out Spigot actually has a method for it
Projectile#getShooter can be Player right? So I can just if(projectile.getShooter() instanceof Player)
yes
also you can use pattern variable
instanceof Player player
that sucks lmao
Frs haha
Isn't it just EntityGuardian
tbf i have no idea what im reading but its close enough to php oop that im managing to understand it
looking for entityData
What kind of Entity data
ahhh one sec
i think i got my answer
ty
is there a list of these DATA_ID_ATTACK_TARGET somewhere that i can look at?
is this the right directory?
Wdym a list of them
maybe documentation or a class where all the data constants are declared
NMS isn't documented
oh rip
What are you trying to figure out?
i wanna know the id of that data flag
but also im tryina learn how to navigate this thing
so if my questions are a bit generalized thats why
sorry about that
Seems like the ID is calculated using this
could you please check id of that flag for me? i havent set up a server yet
Looks like 17
Tysm!
why is all players fly while joining my server
how to fix it
please help me!!
please help me this is a major issue pleasee π₯Ί
something with a plugin?
yes
?paste
essentila
?
nvm, it's just a command
what do i need to paste
ohh
why is all players fly while joining my server
how to fix it
please help me!!
please help me this is a major issue pleasee π₯Ί
Plugin list?
you can disable fly on join or something like that in essentials
search in config.yml
or join MOSS for further support
i checked it but it is not
MOSS i did but didnt get any help
please help me this is a major issue pleasee π₯Ί
fly? wut
?
Hello! I want to make the reload command to reload configs, but it doesn't work
public void reloadConfigFiles() {
config = new YamlConfiguration();
dataConfig = new YamlConfiguration();
langConfig = new YamlConfiguration();
try {
config.load(configFile);
dataConfig.load(dataFile);
langConfig.load(langFile);
System.out.println("Successfully reloaded the config files.");
} catch (IOException | InvalidConfigurationException e) {
e.printStackTrace();
}
}
why is all players fly while joining my server
how to fix it
please help me!!
please help me this is a major issue pleasee π₯Ί
stop spamming
ok ssryy
check if you enable flying on server-properties
no i didnt
if people are stuck in air when joining,is on them for having a potato
as a computer
and taking 10 seconds to load the world
that is not the problem they can fly like creative
you enabled flying then
no i didnt
vanillas anti fly is pretty good to detect hacked flying
either that or you gave permission to flying
i removed it but nothing happnd
try to set essentials.fly.safelogin to false
i did the same thing
Issues with the reloading configs
I'm trying to create a plugin for Spigot 1.8. I'm currently using IntelliJ along with the Minecraft development plugin. I've installed Java SDK 1.8 (Java versioning confuses me, I thought I downloaded + installed v8, but IntelliJ says it's 1.8?), but the Minecraft development plugin gives me no option to develop for Spigot 1.8.
If someone could guide me through what I'm doing wrong, or give an alternative to what I'm doing, I'd greatly appreciate it!
good tip.. dont use a development template
