#help-archived
1 messages ยท Page 225 of 1
essentials/cmi have this command, so you can specify world name btw
If it's not possible without any plugins, I'll better write my own ๐
If someone got the answer just mention me (or pm) ๐ Thanks
If someone got the answer just mention me (or pm) ๐ Thanks
why you not take a look at worldedit shapes? ๐ค
or what
Yeah that's what I'm looking for
But not sure about how to proceed correctly
then do that in another thread
CompletableFuture.supplyAsync(() -> {
Thread.sleep(5);
}
can i do that using a scheduler?
I want to count with ticks
then use scheduler
1 sec = 20 ticks
So 1 tick = 1/20 seconds
1 seconds = 1000ms
Simple conversion
Hey guys how do I set sign rotation?
There is a Sign BlockData type
Got it
getBlockData(), cast to sign, modify, setBlockData()
Note there are 3 different Sign types in Bukkit eh? You want the org.bukkit.block.data.type.Sign one ;P
I know ahaha, its a bit of a pain
I need help
Here's hoping we get rid of MaterialData in the near future
Maybe 1.17, I'll bring it up to md
This help isn't really bukkit related, but it requires some decent amount of thinking and I can't get it right idk why
I always liked the vanilla DIrtBlock extends Block
Why isnt this working? ```java
BukkitScheduler scheduler = getServer().getScheduler();
scheduler.scheduleSyncRepeatingTask(this, new Runnable() {
@Override
public void run() {
nowAir.setType(Material.AIR);
return;
}
},1000,1000);```
Its setting the block to air but without delay
Use the runTaskTimer() method instead
scheduleSyncRepeatingTask() is old and discouraged
ew OLD STUFF
Should work fine though
k ill do that
Whats the best option for checking when someone opens a container?
InventoryOpenEvent
TY
Is that called on the player inventory opening?
Yes, though if you just want containers you can check for the InventoryHolder
Ok ty
The thing is, I have different arrays with about hundreds of values.
But the thing is, I need to pass in these values in 3 pairs.
Now what I want to do is create a list containing an array and this array will contain the 3 pairs.
So that I can iterate over this list, and pass in each of the 3 pairs.
I want to end up with this->
List<Float[]> vertexes = new ArrayList<>();
for(Float[] vertex : vertexes) {
passInThePairsOfThree(vertex[0], vertex[1], vertex[2]);
}
Okay so what's the issue?
^
Aside from the fact that you don't create a Vector3f object or something
arrays are icky in this case lol
yep
its just
every tutorial uses a large array
or every doc
instead of a class called Vertex as I did in my old project
btw I just switched over to cpp
so i recoded everything
btw and sometimes i hardcode some objects with their vertices (quite simple objects like cubes)
so it would be annoying always creating another class
for example this is what i wrote
static float cube_vertices[] = {
-0.5f, 0.5f, 0.0f,
-0.5f, -0.5f, 0.0f,
0.5f, -0.5f, 0.0f,
0.5f, 0.5f, 00.0f,
-0.5f, 0.5f, 0.5f,
-0.5f, -0.5f, 0.5f,
0.5f, -0.5f, 0.5f,
0.5f, 0.5f, 0.5f,
0.5f, 0.5f, -0.5f,
0.5f, -0.5f, -0.5f,
0.5f, -0.5f, 0.5f,
0.5f, 0.5f, 0.5f,
-0.5f, 0.5f, -0.5f,
-0.5f, -0.5f, -0.5f,
-0.5f, -0.5f, 0.5f,
-0.5f, 0.5f, 0.5f,
-0.5f, 0.5f, 0.5f,
-0.5f, 0.5f, -0.5f,
0.5f, 0.5f, -0.5f,
0.5f, 0.5f, 0.5f,
-0.5f, -0.5f, 0.5f,
-0.5f, -0.5f, -0.5f,
0.5f, -0.5f, -0.5f,
0.5f, -0.5f, 0.5f
};```
Should definitely not be loading model data from source
that's one way to make you hate yourself
just some basic things
im too lazy to already start importing some .obj or .fbx
what i can do is
on application startup, i can store a list containing arrays of the values
so I don't calculate every frame(would be dumb)
if you already picked up
yep its game
actually a game library, but ye
i'd figured as much. the vertex buffering gave that away in your first snippet
ok
so can we do this
or do i have to rewrite each array making a vertex class manually
for every 3 values
atleast for now
its in cpp
i can show u what i tried
but it failed miserably
//A 3D vertex contains 3 floats(x, y, z)
std::vector<float*> vertexes = std::vector<float*>(_model._mesh.get_vertex_count());
int vertex_index = 0;
for (int i = 0; i < _model._mesh.vertices_length; i++) {
//1st
if (i == 0 || i + 1 % 3) {
float vertex[3];
vertex[0] = _model._mesh.vertices[i];
vertexes.push_back(vertex);
if (i != 0) {
vertex_index++;
}
}
//2nd
else if (i - 1 % 3) {
vertexes[vertex_index][1] = _model._mesh.vertices[i];
}
//3rd
else if (i - 2 % 3) {
vertexes[vertex_index][2] = _model._mesh.vertices[i];
}
}
for (float* vertex : vertexes) {
std::cout << "vertex 0: " << vertex[0] << ", vertex 1: " << vertex[1] << ", vertex 2: " << vertex[2] << std::endl;
}```
a vector is a list in c++
and the float* is an array
i mean if it makes you feel any better, c++ has a tuple class lol. though you're probably fine to stay with float arrays if you really want
what about it isn't working? you're giving snippets of code saying it doesn't work but aren't saying what about it isn't working
People think we are some kind of wizards who can solve isues without any explanation

it spams some random numbers lmao
the first number seems legit
the next one is 0
the 3rd is some very small
decimal
what about if (i % 3 == 0) {
i just want to know how to code such a method
i want to do every third
i started i as 0
maybe i should start as 1
i don't know why you're iterating every one element when you should be certain you have a vector of elements that should be a multiple of three
for (int i = 0; i < length / 3; i += 3)
firstElement = elements[i];
secondElement = elements[i + 1];
thirdElement = elements[i + 2];
do your processing
i want to have it like this:
for(float[] array : vertexes) {
dosomething(array[0], array[1], array[2]);
}
ok
I have a List implementation for elements with a given id and owner
I want to ensure all elements have a unique id and the same owner
how do I implement Collection#replaceAll(UnaryOperator)
isn't that a default method?
I want to ensure all elements have a unique id and the same owner
ah, can't insert if it's not unique, got ya
You would have to iterate across all elements in the list and apply that unary operator. perform your checks before assigning it to the underlying data structure
throw an exception if any of your conditions are not met
then I'd have to store the result in a new list, check conditions there and then replace all elements in my list
not necessarily. you would do that in the loop
choco, does this look good?
int count = 0;
for (int i = 0; i < _mesh.vertices_length; i+= 3) {
float arr[3];
arr[0] = _mesh.vertices[i];
arr[1] = _mesh.vertices[i + 1];
arr[2] = _mesh.vertices[i + 2];
vertexes[count++] = arr;
}
whats the best way to filter out all the legacy materials in materials.values()?
for (int i = 0; i < elements.size; i++) {
T newElement = unary.apply(elements[i]);
if (newElement.isInvalid()) {
throw new IllegalArgumentException("NO! BAD >:((");
}
elements[i] = newElement;
}```
obviously oversimplified but you get the gist of it
Atin, legacy materials aren't present at runtime. They won't be part of values() if your api-version is set to 1.13
Would be O(n) would it not?
Which you kind of have to have if you're performing a unary operation on n elements
So to me this seems like an inappropriate use of a List
A Set implementation would likely be better
Ohh okay @subtle blade i havent set an api version but will do thanks
oh I completely forgot about that xd
I need to perserve insertion order so I went with a list but ig LinkedHashSet can be used
mesh _mesh = _model._mesh;
//A 3D vertex contains 3 floats(x, y, z)
std::vector<float*> vertexes = std::vector<float*>(_mesh.get_vertex_count());
for (int i = 0; i < _mesh.vertices_length; i+= 3) {
float arr[3];//needs to be initiated
arr[0] = _mesh.vertices[i];
arr[1] = _mesh.vertices[i + 1];
arr[2] = _mesh.vertices[i + 2];
vertexes.push_back(arr);
}
for (float* vertex : vertexes) {
std::cout << "vertex 0: " << vertex[0] << ", vertex 1: " << vertex[1] << ", vertex 2: " << vertex[2] << std::endl;
}```
i got this
I see
Yeah a LinkedHashSet is probably what you want so it's doubly-linked
you should definitely throw an exception if your vector size isn't a multiple of 3 though, retrooper
but yeah that would be fine as far as i can tell
it seems to only be printing the first 3
im not sure
i was doing it on render method
let me do it once
so i can see
yep it only prints the first 3
hmm
i think i got it
how would i go about getting a Black Leather Helmet with a material of LEATHER_HELMET im not sure if the plugin supports colored leather so im testing it but im not sure how to add the specifics to dyed leather
It does. LeatherArmorMeta
I have to remove a part of List<Data> which stores List<String> for lore out of the hashmap
im storinng lore as a list bcz it will be too long to read when its not a list
TextComponent msg = new TextComponent("Helpop " + String.join(" ", args));
msg.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new ComponentBuilder(applyCC("&aRight Click To Mark As Done!")).create()));
msg.setClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/RemoveUUIDCMD"));
//In the RemoveUUIDCMD
guiInformation.remove(player.getUniqueId(), new Data(msg.getText()));```
but this doesnt work
since getting the msg wont get a list<String> of text
but just the String
What
Which part of the code you've posted doesn't work?
You've mentioned lists but there aren't any there
__ guiInformation.remove(player.getUniqueId(), new Data(msg.getText()));__
Thatโs a new object
private final HashMap<UUID, List<Data>> guiInformation = new HashMap<>();```
Can you put the full code into a hastebin or pastebin?
yea
Use an ArrayListMultiMap for proper arraylist map support
Choco let me rephrase im using a mobs plugin that has custom armor im just not sure how to add the meta
https://paste.md-5.net/uxoqejuvim.java <- Data.class
whats this
guiInformation.remove(player.getUniqueId(), new Data(msg.getText()));
You've made a new class intance of Data
@surreal trail Via config or via code? and which plugin?
thats makes no sense
ups
remove the new Data thing from remove method, and only use one player.getUniqueId
HashMap can find the saved data if you give the corresponding key
config and elitemobs currently all i know is that it uses the Material.NAME but not sure if it uses the meta
but that will still return string
wat
im saving multiple List<String> for each player
and I have to get the right one
to remove from the hashmap
Then why you not use the Map#get method to get the list of players?
Choco let me rephrase im using a mobs plugin that has custom armor im just not sure how to add the meta
oh you're trying to configure one?
yea i can do LEATHER_HELMET to get a leather helm but im trying to see if we can dye them aswell
I have to remove the one from one player, just said it stores that for multiple players
lol
why would I get it when I have to get the correct one out of 5? for example
i asked a 2nd question there aswell hes busy atm
i honestly don't know how to configure elite mobs lol. I'm sure he can respond when next available
import java.util.logging.Handler;
final Handler myHandler = new Handler (myConfig, levelCost);
Cannot instantiate the type Handler
how to fix this ? ^^
he's generally pretty on top of that kinda stuff
Oh, i thought you responded to some server admin who was a dumdum
Logging handler what
why would I get it when I have to get the correct one out of 5? for example
guiInformation.remove(player.getUniqueId());
is good enough to remove from memory
What are you instantiating a Handler for? o.O
to get config file
A YAML configuration?
Config what?
yes he is but right now i know hes busy
Or a logging configuration?
I only need to remove a part of the info
yml file
and choco this is the only info we have on material
material sets the item material. All material names are derived from the spigot API. You can find the list of valid material names here.
and it links to spigot
ohh ok
Yeah, I'm sure he has a way to load dye colours, just don't know how he does it
Somebody on the EliteMobs discord might have better insight
while its storing a list of info
List<Data> oldList = guiInformation.get(player.getUniqueId());
for (Data data : oldList) {
data.setList(Arrays.asList("y1"));
}
guiInformation.remove(player.getUniqueId());
@frigid ember
from data, also this is an example, you should configure it yourself how you want
ohh ok
im thinging when custom models was added it broke dyes
Pretty sure theres a get amount method
There isn't, but you can use the result of #all(Material)
Nvm then
double count = all(Material.GOLD_NUGGET).values().stream().mapToDouble(ItemStack::getAmount);
(that obviously doesn't remove them, you can remove with #remove(Material))
Hey choco! I was wondering if im allowed to dm you really quick i need to ask you smth regarding premium resources. May i?
most questions should be covered by the guidelines
hey can anyone help me, ive got my own spigot server for my brothers and when i try to do (/rg flags global) it brings up (page 1 of 6 >>>) but i have no idea how to get the the other pages ive tried everything i could think of and searched everywhere but no luck just need some help please
click the arrows in chat with your mouse ;P
That whole chat flag message is interactable
ive read that it is, thing is it dosnt work
Which version are you using?
1.16.1
Spigot? Or CraftBukkit?
spigot
Then it should definitely be interactable wot

its the (>>>) right
yes
yeah dosnt work
Well, your alternative is to use /rg flags global -p 2 to go to page 2
(and so on and so forth)
Uh, sorry, /rg flags -p 2 global
I think order matters
OOH thanks haha
i tried doing /rg flags global page 2 but that didnt work, had no idea it was -p
thanks so much been stuck on that for hours
o/
is there also a way to make a pvp area where you lose your items if you die in the region or do i need to get another plugin
don't know why the message isn't clickable for you though
there's probably a flag for item drops
Yeah, item-drop
yeah im not too sure i thought it wouldve been a mod or texture pack but my brother couldnt do it and his got plain vanila
okay thanks
the item-drop dosnt work
it would better to ask in enginehub discord
Downloads and builds for many EngineHub projects. WorldEdit, WorldGuard, CraftBook, CommandHelper, and more!
okay ill try thanks
how can i disable advancements for specific Player?
Hey! I want to send a custom payload packet using player#sendPluginMessage but it doesn't get sent to the player, any idea?
What's your plugin code and your mod code to receive it?
target.sendPluginMessage(getHandler(), getChannel(), buffer.getBuffer().array());
its heavily abstracted on mod side, but I can guarantee that it's not recieved
please paste the full code: https://paste.md-5.net/
Did you register the channels?
No errors, but i think the message is not being sent
guys i have a ffa server. (1.9+) but critical hits and normal hits they take the same heart. how can i fix it ?
This doesn't happen on vanilla, maybe check your current plugins?
@sturdy oar I applied and a couple years ago
ฤฐ can ss if you Want
phoenix616 do you think I can become resource staff as well
apply when md is looking for new staff and find out
we wont know until there is an application
Oh ok so at the moment there are no recruitment open
there's always an announcement on the forums when md looks for new staff
Ty I'll just wait I guess
I guess nobody can stop anyone from just applying xD
Do the resource staff decompile every plugin to check for malicious code
Well
Or do you have a method to narrow it down to ones that may be suspect
it is mainly based on user reports like it is on the rest of the site.
no, lol
๐บ ๐บ ๐บ Rip I will actually have to become staff and see myself
it's just your basic list of reported stuff xD
50% of it is probably this plugin bad plz delete
"anticheat no work on 1.4.7, author scam me!!!1"
Then ask for a refund lol
gUyS wIlL tHiS cOdE wOrK ?
public class Main extends JavaPlugin {
@Override
public void onEnable() {
Bukkit.shutdown();
}
}
will at least prevent hackers
What for?
To start the server again
smart
hey guys, is there a plugin for random % drops on commands?
Is it possible to get the numeric id of an enchantment?
https://www.digminecraft.com/generators/give_enchanted_book.php @orchid badger ?
Enchantment#getId() should be there, though there's no real reason to use it
why do people still use IDs
you shouldn't ;P
yeah, they dont make sense
oh there isn't a getId. probably for good reason lol
modern versions don't use that id. it's internal
guys i dont now how to get my progect working on my server
this is the code
package me.eamonn.Heal;
import org.bukkit.Material;
import org.bukkit.entity.Creeper;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.Zombie;
import org.bukkit.event.entity.CreatureSpawnEvent;
import org.bukkit.inventory.ItemStack;
import org.bukkit.plugin.java.JavaPlugin;
public class Main extends JavaPlugin {
public void creaturespawn(CreatureSpawnEvent event) {
if(event.getEntityType() == EntityType.CREEPER) {
Creeper creeper = (Creeper) event.getEntity();
creeper.setPowered(true);
}
}
public void creaturespawn1(CreatureSpawnEvent event) {
if(event.getEntityType() == EntityType.ZOMBIE) {
Zombie zombie = (Zombie) event.getEntity();
zombie.getEquipment().setHelmet(new ItemStack(Material.NETHERITE_HELMET));
zombie.getEquipment().setChestplate(new ItemStack(Material.NETHERITE_CHESTPLATE));
zombie.getEquipment().setLeggings(new ItemStack(Material.NETHERITE_LEGGINGS));
zombie.getEquipment().setBoots(new ItemStack(Material.NETHERITE_BOOTS));
zombie.getEquipment().setItemInMainHand(new ItemStack(Material.NETHERITE_SWORD));
zombie.getEquipment().setItemInOffHand(new ItemStack(Material.NETHERITE_SWORD));
}
}
}
please
No, there's Enchantment#getByKey(NamespacedKey)
oh so there is
Hell, there's even an Enchantment#getByName(), though that's deprecated and not super accurate. Uses the poorly named values
emister, event listeners should be public and static and need to also be annotated with @EventHandler
Additionally, you need to register them
Hey. How can I make a nice invisibility for arena spectators? So they are not visible on TAB and don't interfere with players or shooting arrows?
Player#hidePlayer() should work just fine
Well, no. Player#hidePlayer(thePlayerYouWantToHide)
it seems to easy
Anyone ever played with smoothing map?
Event handlers don't really need to be static tbh.
Is the listener instance passed to the invocation? Last I recall it wasn't
Just leads to static abuse down the line
Pretty sure it is, how else would it call the method if its not static?
are they called if not static?
executor.execute(listener, event);
well I'll be damned
i've gone 6 years thinking listeners had to be static
They are eveb called if private
how do I check if player is hidden? xd
try {
Method[] publicMethods = listener.getClass().getMethods();
Method[] privateMethods = listener.getClass().getDeclaredMethods();
methods = new HashSet<Method>(publicMethods.length + privateMethods.length, 1.0f);
for (Method method : publicMethods) {
methods.add(method);
}
for (Method method : privateMethods) {
methods.add(method);
}
}
[...]
for (final Method method : methods) {```
well I'll be fucked...
TIL
I try to serialize an enchantment and it won't let me use the key as the map key in yaml because of the colon.
I'll use an array then I guess
Yes it works when I manually type it
But the library is trash lol
Doesn't allow me to put : rip
;D
oh okay I've never declared them as static, so idk where out of my ass I pulled that
though the private thing is new
lol
i'm upsetti spaghetti
making them private would probably be the best to stop other plugins from interfering with it but I've never actually seen a case where that would've been an issue so ๐คท
100% and that was always my concern
it doesn't happen often but they most definitely should be private to avoid it at all
Hello
can someone help me
?
When i install worldedit newest version on my server, then file schematics will not create
And i want to just add one schematic on my server thats all
If someone help me with this i will be so happy guys ๐
I think you manually have to create /schematics folder
Inside the WorldEdit plugin directory
okay but then when i try to load that schematic i cant
it will write doesnt exit
exist*
but i can see that schematic in that list
what i have to do?
Idk
like command?
don't threaten me with a good time
It's not a threat, it's a promise
hell yeah
ok so now i officially made it so the player cannot get rid of the item
except 2 ways
- you can't hotkey an item in place of it anymore but you can hotkey air
wait so nvm
maybe i can cancel air
but then that would mess up anything else hotkeying air
and 2. is death but ill figure out later
ik there is a check for which item
is hotkeyed
but is there a check for which item it replaces
Guys i Want to make Clear inventory when players do /hub. How can i make it?
is here way how do i can load schematic in singeplayer?
@cerulean musk when they execute hub just clear their inventory?
@vast jungle I know paper generates asm code to call them if they are public so making them private there is prolly not a good idea
sounds like a bug imo
i have the
if (event.getHotbarButton() == 8) { event.setCancelled(true); }
but it only works if it's an item trying to be hotkeyed to slot 9
not air
making it possible for someone to press 9 on their keyboard while over a slot with no items and it will switch
@balmy sentinel yes
@bold anchor this is spigot, sir
Idk if spigot does it
@balmy sentinel hub and Clear inventory :D
So i just mentioned it
so whatโs the problem?
i am trying to make it impossible to make an item at hot bar slot 8 (9) to not leave no matter WHAT
ฤฐf i do /hub i just go hub. ฤฐ Want to Clear inventory too
i have it so they can't place the block
or throw it
and they can't hotkey an item in it's place
but it's still possible to hotkey air
you are going to have to block all click and drag events with that and hope it catches everything
@cerulean musk just add player.getInventory().clear();
@vast jungle think the problem is it sees that it's air so it let's the event stay not realizing the air messed with the bedrock
because im replacing air with the bedrock
@balmy sentinel i will TRy it thanks
@wary ledge sounds like a bug with your code tbh.
Hey guys, probably dumb question - what are scoreboard tags?
What are they useful for?
sorry it's so compressed i have the worst internet in the world it would take forever to upload it
also my recorder names everything badlion after i recorded with it once
here is the code
@EventHandler
public void keepItemsClick(InventoryClickEvent event) {
final ItemStack item = event.getCurrentItem();
if (item == null) return;
final ItemMeta meta = item.getItemMeta();
if (meta == null) return;
if (event.getCurrentItem().getItemMeta().getLore() != null && event.getCurrentItem().getItemMeta().getLore().contains("ยง6Click to get moon gravity for 10s")) {
event.setCancelled(true);
}
if (event.getHotbarButton() == 8) {
event.setCancelled(true);
}
}```
@frigid ember adding tags to entities in order to query by them at a later date
gotchya
it's mainly for command block contraptions though, for plugins I would just use the PDC to store that date (or a database that stores the uuid)
what do servers do
you are returning when the meta is null which will be the case if its air, don't
(or maybe the clicked item itself is null, dunno)
you have to check the target item of the switch too, not just the clicked item
does this event have the target though?
yes, it gives you the target number if it's a switch click with a number key
what is it
event.get....
i havent't found it
nothing is showing that would make sense to be it
oh apparently I was thinking of getHotbarButton which you already use
so yeah, just make sure it's always cancelled, not just when clicking a non-air item
yes, that's why you need to cancel it if it would modify your item
so just cancel all hotkeys
well i mean
why doesn't the hotkey thing work if it's air
like it fixed the item to item switch
because you return when its air
and no, as I said: simply only cancel when your hotkey is targetting the slot that your custom item is in
it's the number of getHotbarButton
as I already said multiple times: your code only cancels when you click an item, if you click air it returns at the start of your listener method
So I need to out the hotbar thing over the returns
yeah
at me.Lorenzo0111.Souls.Souls.onCommand(Souls.java:36) ~[?:?]```
Line 36, of Souls.java
By repl.
Currently i'm working on an SMP Server for 1.14.4, but for some reason there's a bug where your own skin appears as a steve, but other people look normal. For example, you in F5 would look like a steve, but to other people you have your normal skin. Any known solutions?
I went through my plugins that could mess with skins, but I also tried to look for plugins to solve this as well
however if I use a skin plugin to change my skin, it just resets when I rejoin
Don't play 1.14.4 why are you doing this to yourself?
Hello guys , how i can check if an entity with custom name is already spawn in my world ?
get all entities and loop over them and check for the name
is there is a way to create a function in onCommand thing? ๐ค ๐ง
answer is :"idts" right? :/
what do you mean ?
ok thx
suppose I have a lot of implementations of a single event, say EntityDamageEvent. Is it better to listen to this one time in a single class, or listen to it multiple times (around 20) in different classes?
does anyone know much about luckperms plugin?
what do you mean ?
@pseudo crown https://pastebin.com/HvR7A4Hk for example here i want to create a function to call the target name to use it in other class
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.
Ayush, most likely one time since events are fired with reflection which might lead to a small performance decrease if you listen to it 20 times when you can just listen to it once.
so a single class with ~500 lines of code rather than 20 classes with few lines of code
right?
You know you can parse the events around right?
can you explain?
Hmm sec
sure, thanks a lot!
i need some help with luckperms anyone able to help?
Go ask on the luckperms discord jackie.
ok
@hardy cedar do you know what contructors are ?
As i download buildtools 1.15.2?
@hardy cedar do you know what contructors are ?
@pseudo crown no lol
Help plis :c
Whats the issue
https://www.spigotmc.org/wiki/buildtools/ @shy valve
The home of Spigot a high performance, no lag customized CraftBukkit Minecraft server API, and BungeeCord, the cloud server proxy.
Thanks @pseudo crown
@hardy cedar you can't just create a method to get your player object in onCommand class because every time a player types the command there's a new instance of the class (so all the variables are different)
what exactly are you trying to do
i want to ban the player when the admin clicks on a specific Item
public void onClick(InventoryClickEvent e) {
Player p = (Player) e.getWhoClicked();
if (e.getInventory().getName().contains("Reaping") && p.hasPermission("GraveMC.Punish")) {
e.setCancelled(true);
if (e.getCurrentItem().getType() != Material.AIR) {
if (e.getCurrentItem().isSimilar(SevenDaysBan)) {
p.performCommand("ban ");
p.closeInventory();
} else if (e.getCurrentItem().isSimilar(MonthBan)){
p.closeInventory();
} else if (e.getCurrentItem().isSimilar(YearBan)){
p.closeInventory();
}
}
}
}```
i need to perform ban command with the target name
you can use Bukkit.getPlayer(name) and check if it's not null, if it isn't then you can store it; example: ```Java
Player playerToBan = Bukkit.getPlayer(Notch);
if (playerToBan != null) {
// ban the player
}
and if the player types /ban <player> the <player> would be on args[1] which means you can just do Bukkit.getPlayer(args[1]);
Constructors
can u give a example code pls :/
@nova badge Idk, i guess something like this https://gist.github.com/JanTuck/23c2631c0e84f10959c23c5fe8541989
โOnshitโ and โonPoopโ ๐๐คฃ Dead and I donโt code
@bold anchor, thanks I will take a look.
@bold anchor i lost brain cells reading that example
Thx โค๏ธ
@hardy cedar you need to use constructors
it creates a new instance (version) of the class every time the command is run so having a function to "get the name" from the class will return nothing.
what would i do to put the first arg on a command into a verial
You would type String argZero = args[0];
i can not spell
computers count from 0, and the arguments are stored in an array, so array[0] gets the first argument (if there are any).
i understand that
In most languages that is
why does it put a 1 In front of it?
?
ow shit i just put a one an accident
https://www.youtube.com/watch?v=hKLhxI21sh0 help would be apprecaited ๐
@ me if you respond
Hi there, sorry if this is a common topic but do vanilla chunk loaders not work in spigot? Moved my world over to a spigot server and now it seems there are certain things that dont work. Had a chunk loader at the bottom of map below my villager farms that are on surface area, the loader is still running when i come back, but never any production from the villagers.
Or do chunk loaders also have a limit in the vertical range of what they would affect?
Is this something I would need to adjust in Spigot.yml?
@vast arch try update shopgui+. You're nearly 2 years out of date.
@vast arch I'd assume the plugin failed to load something from the config and did not get enabled and therefore just completed fucked itself.
Idk anything about the issue tho i'm just guessing
@odd knoll not the problem
@bold anchor I don't think that's the problem as it worked once then failed the next, but maybe.
https://www.youtube.com/watch?v=hKLhxI21sh0 help would be apprecaited ๐
@ me if you respond
anyone have any clue where the sorting code for the playerlist is located?
im looking in nms
specifically the playerlist class i cant seem to find anything that orders them by name.
[iiAhmedYT: Banned player CraftPlayer{name=iiAhmedYT}] shit :/
I have a server which tries to replicate "Tekkit" stuff, like conveyors, batteries, drills and some other technic stuff.
But I came to a problem. Chunks would have to be loaded whenever player places some block which has to tick every n-th ticks. Chunks being loaded takes away a lot of resources. I need to somehow disable some stuff.
What kind of solution would be the best? I have some ideas:
- Disable those machines/blocks when player leaves.
- Disable machines/blocks if the distance is too big. Might be problematic to implement if one chunk would transfer items to other chunk in a loop, one chunk loading other chunk and etc.
- Force player to click on a block (like power generator/battery) to make it continue working, for example those blocks could be broken unless fixed with a wrench.
Anyone got any other ideas? o_o
https://www.youtube.com/watch?v=hKLhxI21sh0 help would be apprecaited ๐
@ me if you respond
@frigid ember Normal modded machines turn off when the chunk is being unloaded. As for transfering items I'm not sure. Forcibly making people click on a generator to make it keep working is also quite easy if you listen to the PlayerInteractEvent and force an arm swing animation.
I have a argument that i want to make sure is set what would i do to make it check
that will never be null
if you're talking about a command's argument array that is
Is there any way to make players in spectator mode appear as normal players in the tab list?
why doesnt my essentials nickname show up on my player tag? it comes up in chat and in tab but not tag :(
i think name above the head..
If you mean above your head you need another plugin
that shit is hard to do honestly
the nametag
i the TAB plugin
and this is in the config
OTHER:
tabprefix: '%luckperms_prefix%'
tagprefix: '%luckperms_prefix%'
tabsuffix: '%afk%'
tagsuffix: '%afk%'
customtabname: '%essentialsnick%'
customtagname: '%essentialsnick%'
how i can download the 1.15.2?
Use buildtools
me?
no
ok
That's not a valid PAPI placeholder. Is it a valid TAB plugin one?
how can I use buildtools to download 1.15.2 is for a server
If you mean above your head you need another plugin
@mellow wave what plugin
???
@shy valve first link on google https://www.spigotmc.org/wiki/buildtools/
The home of Spigot a high performance, no lag customized CraftBukkit Minecraft server API, and BungeeCord, the cloud server proxy.
yes but tag doesnt
I already downloaded this but I don't know how to use it
the customtagname: '%essentialsnick%' doesnt work
then i can't help someone who isn't willing to read what i posted
:c
@shy valve Read what the link says :/
Sorry but I'm new to this, I have no idea of โโanything
@frigid ember What version of spigot and essentials are you using?
1.16
You're new to reading? jk...
.__.
And the essentials version?
Is that essentialsx or some other fork
permissions.yml is a native spigot/bukkit thing right? Where is the documentation for it, cause I can't find anything "new"?
yes
It will get it for you
Just run the command in a bat file
o thanks
(if you're on windows)
Yes i use windows
Yes
I think it can show ram
Not sure
That sounds like CPU not ram
But it can be caused by ram too
Alright send your timings
?
I am trying to check if an arg is set. My code is: if (args[0] != null){
But it only works if i put null how do i fix this?
Do this: if (args.length > 1)
Length?
I think you should do what Olivo said. Args.length should show how many arguments
You know what
Imma stop talking
thanks
is there anything in bukkit/spigot that prevents enable-query/query.port from working? I set it true, changed the port, enabled my firewall, but every tool i try can't read it
no
did you portforward that port ?
I'm trying it locally
there's no portforward needed anyway it's on an ubuntu server in a datacenter
How can I check a player's village reputation? I have tried using NBTExplorer but I don't know what file it is stored in.
?paste
!paste
um
what is the command?
oh ok
weird
i have a issue with my custom config manager. Why does it only remove the last key and not all before? https://paste.md-5.net/eribepadup.cpp
It gets fromyaml test: test: test: text
to yaml test: test: {}
the resource config doesn't contain any of this keys
can someone please help me?
I assume you are passing test.test.test to the set method? If so it will only remove that key, you need to set the parent keys null too if you want to remove them
yes
im iterating through them
Ah i think you need to console log too
[22:10:48 INFO] [BungeeStatus]: [motd.text, motd.activated, motd, icons.activated, icons, protocol.text, protocol.activated, protocol, max, overridemax, online, overrideonline, playercounter.text, playercounter.activated, playercounter]
[22:10:48 INFO] [BungeeStatus]: [test.test.test, test.test, test, max, motd.text, motd.activated, motd, icons.activated, icons, protocol.text, protocol.activated, protocol, overridemax, online, overrideonline, playercounter.text, playercounter.activated, playercounter]
[22:10:48 INFO] [BungeeStatus]: The template config doesn't contain test.test.test
[22:10:48 INFO] [BungeeStatus]: Setting it to null```
then the other on enable stuff happens
not related
i reversed the list because it started with test
and then iterated through test.test
and the other stuff
what
weird behaviour
i logged all entries
and i got this:
[22:36:12 INFO] [BungeeStatus]: The template config doesn't contain test.test
[22:36:12 INFO] [BungeeStatus]: Setting it to null
[22:36:12 INFO] [BungeeStatus]: test```
why does it think test is included in the temolate?
How can I check a player's village reputation? I have tried using NBTExplorer but I don't know what file it is stored in. This is on a server, not singleplayer
should potioneffecttype use .equals or ==
What's the best way to define a default config.yml and have it in plugins/plugin/?
by creating a config.yml ๐
Well duh. But I see a lot of plugins that when used first time automatically drop a default config.yml into their plugin data folder.
Where does it pull the data from?
the config.yml you made in your plugin
in resources?
oh, that explains a lot
Hey, I've coded a factions plugin for the 1.15. But now I've decided to make it support 1.8-1.16. Its already a huge plugin. Is there anyone who can explain me how I can do this? Please DM me :))
?paste
I just did try{//new method}catch (MethodNotFound e){//Do deprecated method}
Yet again
i cant seem to get the package in the package
@nova kite no. Your Main class just has errors
and you need to adress them
Does anyone have an idea on how to prevent an enderman from teleporting except if the teleport is caused by the plugin itself?
@nova kite read it
ok
it says what the issue is
declaration: package: org.bukkit.event.entity, class: EntityTeleportEvent
@mellow wave , it doesn't have a teleport cause
Yeah no other event
https://prnt.sc/twdvz6 but it does contain it..
ok
@nova kite , put it in the src folder instead
oh
@peak marten A work around for this is to store the entity UUID and ignore the next teleport event with it
@mellow wave , thats the issue. I need to detect if the teleport was done by the plugin
hmm
no, because I still can't see when to cancel it
the enderman may not naturally teleport away, but will be teleported by the plugin
Why don't you want it to teleport?
If you don't want it to do anything disable it's AI
I don't want to disable the AI? it still has to wander around, just preventing the teleport
the natural teleport
@nova kite as far as ik it needs to be in the project folder and not in the src or a package
@mellow wave , I wish it was, but unfortunately, if the teleport event is also triggered when the plugin teleports the entity, then it won't work
unless.... it doesn't trigger when the plugin teleports the entity, then there never was a problem at all lol
I don't think you understand my use case. If I cancel it when I teleport it, that will result in nothing at all
anyhow, most likely, there is no issue
becaue the documentation say's:
Thrown when a non-player entity is teleported from one location to another.
This may be as a result of natural causes (Enderman, Shulker), pathfinding (Wolf), or commands (/teleport).
i didnt capitalise my thing
No that's not what I mean. I understand that you want to cancel all non plugin teleportation
You can detect if your plugin caused the teleportation by storing the UUID and not cancelling the event if it matches that UUID
It's not hard
Not if the event is not making a differencation between teleports done by the plugin, and by natural
Anyhow
I don't think there was a problem at all
As I just noticed, the event will only trigger for the below mentioned:
Thrown when a non-player entity is teleported from one location to another.
This may be as a result of natural causes (Enderman, Shulker), pathfinding (Wolf), or commands (/teleport).
It doesn't mention other plugins
You don't seem to understand what I'm saying
It doesn't matter if the event makes any difference between natural or plugin teleportation
nevermind lol
it does, because if the plugin is teleporting it, even though I know if it is that specific entity, it (might) still execute the EntityTeleportEvent
if that is not the case, then I don't have an issue
If it does, then there is NO way to prevent this
Why do you need to prevent the event
because I want to cancel the teleportation
but ONLY if the teleport is caused by natural behavior
Yeah and I see no issues with my method. Would you please explain the problem that you're seeing with it?
Okay, explain the code then how you would do it
Because I don't know how you would solve that
I'm very familair with events
most likely there is no issue, but I'm curious now
- Add the entities UUID to a list
- Force the teleportation
- The EntityTeleportationEvent will now fire (I'm asuming it does, I have no way of testing it atm)
- In your listener class you can do nothing if the entity has it's UUID in the list
- Remove the UUID from the list
If a natural teleportation occurs it will not have the entity UUID in the list allowing you to cancel the event
I'm still missing your logic
Let's say the following:
Enderman is stored in hashmap with UUID
Yeah I'm really tierd and I'm probably missing something then
The enderman is naturally teleporting
what do you do?
the event fires
you cancel right?
It will never be in the list if it's natural
It's all handled on a single thread meaning that it will be executed in order
Which means that it can't be in the list unless you add it just before you force teleport
And then you remove it after the event is fired
Lol, you mean to add the UUID to the list right before you teleport the entity?
then check if it is in the list
if it is, don't cancel
then remove
Probably not the best approach but that's what I could think of
Okay lol, something I really didn't think about, goes very far, but would indeed be a solution
But most likely, the event won't fire
Well, thank you for keeping up, for just a slight moment, I thought you had no idea what you were talking about :p
But then you mentioned the It's all in synchronous order
Then I understood
So my apologies for that
Yeah sorry for confusing you
Well, really something I wouldn't even use, but definitely a solution
Interesting though
It's almost mid night and I should get some sleep :/
Yeah I'm used to thinking about weird work arounds
I want to open the windows
They usually work but may cause unintended issues
ah well, I'll let you know in private if you want if the teleport thing worked
Alright send me a dm and I'll respond as soon as I can
Most likely not for today, or I might actually, you'll see
I mean it's 15 minutes left of today here so if you want to make it you need to hurry up
oh okay lol
Yeah dw it doesn't matter when
perfect ๐
So for all of you to know. and @mellow wave , the EntityTeleportEvent is not getting triggered when caused by the plugin
so just perfect ๐
the enerman is no longer teleporting
Alright that's perfect :)
Just tested with some water
could some one help me think something through in a vc?
What is your question about?
a plugin i am coding
If people were not sleeping here, I could help you in vc, now it has to be text
i am struggling with some code and it not compiling my code https://paste.md-5.net/lobahafofa.js it is not liking my }
If people were not sleeping here, I could help you in vc, now it has to be text
@peak marten Wdym?
@empty seal , it's mid night here. I can't speak in voice chat
Oh I see. @ionic hound , what does your debugger say?
your IDE
java: missing return statement
Ah. I thought you meant in the server.
Okay, so you got a method that returns something. And in that method , you are missing the return
i understand that i have been staring at this for 10 min trying to find the missing the return
Okay, but it should mention the line number
yes 305
now i feel dumb
Hello, i am having a problem on my server where my members who are not op cannot destroy or place blocks, use items, eat, and chat only shows up in dynmap not on the server chat.
Is anyone else having this problem? btw I have Essentials, Towny, Luckperms, and dynmap installed
?paste
player.addPotionEffect(new PotionEffect(PotionEffectType.INCREASE_DAMAGE, 200, 2, true));
}```
Line 42 is the if statement. What's the issue with it?
Caused by: java.lang.IllegalArgumentException: Cannot make player fly if getAllowFlight() is false
How to make this true?
Caused by: java.lang.IllegalArgumentException: Cannot make player fly if getAllowFlight() is falseHow to make this true?
@lapis plinth player.setAllowFlight(true);
kk
How would i see if a arg has a permission. I have tried
if (args.hasPermission ) {
//Code stuffs
}```
that what I use for mine lmao
change the perm to pluginname.perm
i want to see if arg0 (player) has a permission
Bukkit.getPlayer()
what would i put if (this spot> .hasPermission("Gui.punish") {
Bukkit.getPlayer()
@lone fog
Look up the syntax on the java docs
Though itโs pretty self explanatory
im currently making a hard decision
should my plugin version on maven be 0.1.0-SNAPSHOT or 1.0.0b1-SNAPSHOT
They mean the same thing, but they imply very different things
1.0.0b1 means I'm not making very many non backwards compatible changes
once I release 1.0.0b1 there's no going back for b2
0.1.0 says hey anythingcould change at this point
and of course it is SNAPSHOT
but I'm just not sure
@spare tiger please help
Host a Website using Bukkit! is this will work on my spiggot server?
i already downloaded the git and export to jar
when i run the server it doesnt generate a folder
im gonna behonest
i have no idea
never used that plugin before
wait you downloaded the git and export to jar?
what does that mean
@hoary cove did you build the jar or did you just make it into a zip file and rename it to .jar
you have to actually build it
@frigid ember this would still apply if I was using gradle
hmpf
if i don't register a command can i still run it?
how would i hide a command so you can still see it but you still can run it?
how would i run a command as op i know it is not the best thing to do
Heyo! So I got a weird scenario going on here. I'm running a Discord bot on a plugin making it so I can run commands from discord as the console. This works all the way from 1.8 to 1.12.2 but as soon as I go to 1.13 or higher it doesn't work. I can confirm that there is still a connection from discord to the server with the bot but for some reason I'm not able to dispatch any command. Any idea what the issue here might be? Google doesn't seem to be helping much
@Override
public void onMessageReceived(MessageReceivedEvent e) {
if(e.getAuthor().isBot()) {
return;
}
fm.loadConfigFile();
if(fm.getConfig().getLong("Important.ChannelID") == e.getChannel().getIdLong()) {
Bukkit.getServer().dispatchCommand(Bukkit.getConsoleSender(), e.getMessage().getContentRaw());
}
}
Also, no errors. It's as if it reaches dispatchCommand and absolutely nothing happens. The code simply stops there. I tried putting a debug message in the lines above and below that and only the top one got sent in the console
technically you can run a command without registering it
by using AsyncPlayerChatEvent
but that's just dumb
just register the commands
anyone knwo a plugin like staff essentials but for 1.16
how would i run a command as op i know it is not the best thing to do
idk
@ionic hound The only real way to do that is to give the user that permission, run the command, and then remove it
Or op the player, run the command, and deop
which is HIGHLY unsafe
sudo?
what?
that's an essentials command and all it does is force the player to run a command
it does not ignore permissions
k
is there like some kind of event when a hopper tries pulling a item from a block?
is anyone good with my command?https://dev.bukkit.org/projects/mycommand/pages/pre-created-commands-or-just-take-them-as-a-more
I haven't looked at that plugin's code
@hybrid path Think there's one maybe called InventoryMoveEvent
let me check
https://hub.spigotmc.org/javadocs/spigot/org/bukkit/event/inventory/InventoryMoveItemEvent.html @hybrid path
declaration: package: org.bukkit.event.inventory, class: InventoryMoveItemEvent
Hmm thanks
I'll look if that works here.
I don't know, I haven't looked at it. I think it's unsafe.
I'm not looking at it right now
Sure, but not now
But I think the only way it's possible at all, if the command requires a permission the player doesn't have, it is unsafe
If it just forces the player to run a command for a permission they have, then no it's not unsafe
Oh, that's nothing dangerous
If it's just making the console run commands, no, it's not dangerous
if it's forcing a player to run the command as themself
then it's dangerous
what would i do to check if a player is op?
Player.isOp()
Bukkit.dispatchCommand(u, input); is all it does to execute the command @tranquil edge
@keen compass
I don't have my IDE opened up, but it is under the permissable stuff @ionic hound
Yes, I decompiled it. That's for you to decide, that's the method it uses. I've never really messed with forcing players to dispatch commands so maybe read the documentation for that method
but you spelt it wrong
it is
Player.isOp()
it does exist as well
just looked at the javadocs
declaration: package: org.bukkit.permissions, interface: ServerOperator
player is a subinterface of that
I don't see why it isn't safe
So I would assume it's safe
It doesn't appear to op the player or manipulate permissions
dispatch command depending which sender you choose to use, doesn't add permissions. It runs the command as that player or object
so if the player doesn't have perms it will fail
That's what I assumed.
conversely you can run the command as console instead in which case it should succeed unless there is something wrong with the command being ran
also the command has to be a registered command as well
or something listening to intercept said command if not registered
I recommend sticking with running the command as the player instead however
this prevents a way to circumvent some protections by exploiting your bot from discord side ๐
Are we talking to the same person? lol
yes, just we happen to be discussing the idea albeit without that person responding ๐
at leat I am pretty sure we are
only person I recall asking about running commands was the one who needed help with their discord bot not running commands? o.O
in either case I am sure for anyone else it might answer their questions to XD
I was talking in response to the non dev guy about how a particular sudo plugin works but I guess it's on the same topic lol
I just got confused there haha
ah right the sudo command from essentials
sudo command operates on the same principles since it uses strictly the API
the exception is if you force the sudo command to run as console which is highly not recommended
that plugin works the same way as well
hardly expect a 6kb plugin to be using some kind of reflection
Why can i not compare a player to an arg:
Player player = (Player) sender;
if(player = args[1])
Because one's not a player ๐
because player is a reference to the Player object, and args[1] is a string reference to an argument in the command
what you need to do is get the player name from the player object which is a string
so how would i make it work?
player.getName().equalsIgnoreCase(args[1]) { }
might want to make sure args[1] exists first though
otherwise you end up with an NPE
or just guess 
maybe it'll throw an exception, maybe it won't
that's just part of the fun!
lol
exceptions just show that the code is working
exactly! at least you know it's getting called
or not getting called if its the wrong exception then what you were expecting
Shhh
you know those funny exceptions that obscure everything because they don't really point to what exactly is the problem only that there is one XD
hey so i have both java 11 and 14 on my path-
how do i specify which version to use for javac (ping plz)
hello i have a question
hello person who has a question
so i know you can make a custom item but are you able to make like custom blocks ? just wonder i have been trying to make a custom block based off Diamond Block
yes, but there are setbacks
@low citrus you can only have one java home set, if some how you managed to have 2, then its which ever directory is first
-
160 unused mushroom block states
Potentially the best one, but problem with them is some other plugins may be already using them, so conflicts can happen -
Armor stand custom blocks
The problem with them is the server has to do more stuff, because they are entities -
Spawner custom block
The problem with them is the client has to render the spawner, reducing frames for the players that are near them
you could make the spawners invisible
hello paper server used spiggot plugins is allowed?
yes, but the amount of nms is very minimal
ooh
basically just need to hide it from the client
How does that work

