#help-development
1 messages Β· Page 1738 of 1
Then how can you put a helmet on mobs that were created like this? How to do it when mobs are created normally is known to me. but not if i create a mob like that:
public class Soldat extends EntityZombie {
public Soldat(Location loc) {
super(EntityTypes.ZOMBIE, ((CraftWorld) loc.getWorld()).getHandle());
this.setPosition(loc.getX(), loc.getY(), loc.getZ());
are there any good API's that simplify banning stuff?
wdym by stuff
s t u f f. no but seriously, a good api that manages bans
players
ah
punishment api
Hello i am in need of some help with config files.
yes helo
what you need
i dont knwo how to explain it through text tho...
dont really know of one, but shouldn't be real complicated
π€£
just try
vc? come to general-1
how can i block players that they cannot switch the items in the 0ffhand?
bruh i cant find any
either outdated stuff or straight up a plugin
thx
Guys
player.spigot().sendMessage() is not working for my friend
it works fine for me
but not for my friend
he has lunar client
uhh
send a message
when a certain discord command is triggered
its ok with that part
it works for me
yeah
i know
i use components
TextComponent extra = new TextComponent(generatedString);
extra.setColor(ChatColor.WHITE);
extra.setBold(true);
extra.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new ComponentBuilder("Click me to copy!").create()));
extra.setClickEvent(new ClickEvent(ClickEvent.Action.COPY_TO_CLIPBOARD, generatedString));
message.addExtra(extra);
p.spigot().sendMessage(message);```
so?
the message
is not
getting sent
he is on lunar client
and i am on vanilla
i also got another friend on vanilla to test
it worked for them
i know its getting triggered
because i am sending a message
to the discord server
via a bot
when that happens
?paste
this is the whole
code
umm
the problem
isnt about jda
i would have
posted in the jda discord server
if it was
i am not an idiot, so please.
also, this.
Anyone knows how to add cooldown to a command?
I did some debugging, the player name gets printed before and after printing
it works...
just need to know
why the hell
the message
is not getting sent to the player
that exact message is not getting sent
others are
that says getOwningPlayer does not accept a String
hover over it and see what the error says
is this skullMeta?
then it takes no parameter
exactly. It takes no args
the skullMeta already has an owner
you either set teh owner, or you get the owner
thats wrong
there will be no owner as you havn't set one
setOwningPlayer(OfflinePlayer)
Why doesn't
EntityZombie
and all
exist in Spigot 1.17.1
net.minecraft.world.entity.Entity does exist thogh
Yes
which is
How can I make a custom entity in 1.17.1 NMS
So, I have an API and made a Test Plugin for it. But now I want to add commands, when my API Plugin is started. It can send over methods things to the API. It executes the method, but how can I add commands by code?
how do i completely seize someones ability to move in spigot 1.16.5?
cancel PlayerMoveEvent if x/y/z change
?
what
public void OnPlayerMove(PlayerMoveEvent e) {
if (FrozenPlayers.containsKey(e.getPlayer())) {
e.setCancelled(true);
}
}```
that won't work for me
if that's what your trying to suggest
yes it will
Also you can alternatively set their walk speed to 0 and give them jump boost > 128
and just use a set
and you only need a Set
but then
public HashMap<Player, Location> FrozenPlayers = new HashMap<>();
what would the player be
UUID?
or
UniquePlayerID
UUID is the type
if (frozen.contains(e.getPlayer().getUniqueId()) { check getFrom() and getTo() }
Storing player instances should be fine, as long as it's not meant to be persisted across sessions
I prefer the walk speed method because it isnβt as jumpy
Sure, but you gotta clear them on disconnect
And there is no need in this case
true
neither on a Set
Just contains
then you havn't changed it to a Set
that's giving errors
?
wdym?
Set<UUID> frozenPlayers = new HashSet<>();
you store the players UUID
java
isn't correct
Hello?
So, I have an API and made a Test Plugin for it. But now I want to add commands, when my API Plugin is started. It can send over methods things to the API. It executes the method, but how can I add commands by code?
Can someone please answer me?
The home of Spigot a high performance, no lag customized CraftBukkit Minecraft server API, and BungeeCord, the cloud server proxy.
I want to make it over code, not manually
Elaborate
I have, but it dont work, because spigot dont like that. I need to save it, but I need a writer
how do i add a potion effect without effect particles
like removing the visual particles
There is a boolean that determines if particles are shown
e.getPlayer().addPotionEffect(new PotionEffect(PotionEffectType.JUMP, 1000000, 128),true);
wait is it that one
at the end
true, false
the , true
Also they go inside the brackets
e.getPlayer().addPotionEffect(new PotionEffect(PotionEffectType.JUMP, 1000000, 128, true, false)
quick question
declaration: package: org.bukkit.potion, class: PotionEffect
e.getPlayer().addPotionEffect(new PotionEffect(PotionEffectType.JUMP, 1000000, 128, true));
kk
egg: true```
if I were to `getConfigurationSection("egg")` on this file configuration, would that actually give me back a configurationsection?
even an empty one
It will probably be null or throw an exception.
alright, good to know. i'll leave my check in place, thanks
hate that you can't do this in java lmao
oh you can, but you have to declare the variable beforehand
You'll want both booleans
what?
You could do:
Optional.ofNullable(config.getConfigurationSection("path")).ifPresent(section -> {
// Do something
});
that's true, and it looks cleaner
how do i set maxwalking speed spigot
You mean for the faulty movement detection?
yh
d'you know offhand if there's chaining available here? basically, in descending order, I'm checking for a static deserialize method via reflection, then if that returns null, checking if the class implements ISerializable and calling its deserialize(ConfigurationSection method, then finally just trying to flat out assign the config value to the field lmao
https://pastebin.com/bbcUYjAB Instead of it being only for chicken or beef it gives me the effect for all foods, anyone know how to fix that?
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.
and then if none of that works, writing the object's value to config instead
i've already got the code in place, it's just old and i'm trying to clean it up because it's hideous
tl;dr if those "ofnullable"s could chain that'd be great
actually nvm, I have an idea
?paste
That sounds like Jackson or Gson with extra steps...
probably
how do i set maxwalking speed spigot
let me think about this for a sec
You can let Jackson serialize objects into yml
hold up, lemme take a look at Jackson and see how it works
i've only used it for xml
if I can serialize things according to my own definitions then great
spigot.yml -> moved-wrongly-threshold
And moved-too-quickly-multiplier
is it possible to add an entirely new item with its own texture in 1.17 rather than replacing the texture of an already existing item?
under ItemMeta, you should be able to set a custom texture index
you cannot add new items to the game
but you can effectively do so by modifying an item's nbt and attributes
for example, every weapon in my plugin is actually just a stick.
First:
Use the
PlayerItemConsumeEvent#getItem()
method to retrieve the item eaten,
but players won't know this unless they have debug mode on
ah, exactly what i needed, thanks
and this existed after what version?
Yes. Items now have a property called custom-model-data which can be used to add 32k textures per item type.
I think 1.13
I'll be honest, I really just want to use JSON for my configs lmao
shame spigot's stuck on yml
thanks for lmk, ill look into it
yml and json are translatable into each other π
tbh, I might just forsake the default config.yml and move entirely into json config
default config.yml can eat an egg
Yeah. Ive also abandoned default yml
i dislike that yml types objects for some reason. let me read and interpret everything as either a string, array of strings, or dictionary of strings/arrays
i need consistent behavior lmao
I will handle the conversions
@rugged topaz https://hub.spigotmc.org/javadocs/spigot/org/bukkit/inventory/meta/ItemMeta.html#getCustomModelData()
declaration: package: org.bukkit.inventory.meta, interface: ItemMeta
here
I tried this but that does not work in an if statement
what are you trying?
Me?
I dont know what that means but this works:
@EventHandler
public void onEat(final PlayerItemConsumeEvent event) {
final Player player = event.getPlayer();
final ItemStack eatenItem = event.getItem();
final Material material = eatenItem.getType();
if (material == Material.COOKED_BEEF) {
player.sendMessage("You have eaten cooked beef.");
} else if (material == Material.COOKED_CHICKEN) {
player.sendMessage("You have eaten cooked chicken.");
}
}
Btw this would be the propper approach:
private static final Set<Material> CARNIVORE_FOOD = EnumSet.of(
Material.COOKED_BEEF,
Material.COOKED_CHICKEN,
Material.COOKED_COD,
Material.COOKED_MUTTON,
Material.COOKED_RABBIT,
Material.BEEF
... and so on
);
private boolean isVegan(final ItemStack foodItem) {
return foodItem != null && !CARNIVORE_FOOD.contains(foodItem.getType());
}
private void punishVeganPlayer(final Player player) {
final PotionEffect effect = new PotionEffect(PotionEffectType.WITHER, 10000, 10000);
player.addPotionEffect(effect);
player.sendMessage("Β§cYou are a Vegan!");
}
@EventHandler
public void onEat(final PlayerItemConsumeEvent event) {
final Player player = event.getPlayer();
final ItemStack eatenItem = event.getItem();
if (this.isVegan(eatenItem)) {
this.punishVeganPlayer(player);
}
}
You should split your code into meaningfully named smaller methods.
This way your code gets really readable
Thanks for reminding me to switch those to enum sets
Yay for efficient bitvector sets 
is it possible for all entities to open doors if you add the opendoor pathfinder goal? Cuz I've added it to a Stray but it ain't opening the door.
Yes
No
Yes. Yes its possible. I think.
Priority
add version: 1.0.0 to ur plugin.yml
You are trying to get a value from a Map that is not present
Ah i see and version is missing the the plugin.yml
priority seems to be right? igues
How
do
i make
it list all the args?
im making a staffchat
so /sc e e e
would send
e e e
Stop spamming for 1
or whatever
And second. Use a string builder.
String.join(" ", args)
Join the last N elements of your String[] with whitespaces to a single String.
You are creating an anonymous instance of OpenDoorGoal. Cant you just look at the villager entity to see how they init their goals?
@lost matrix I am both grateful and immensely frustrated that you reminded me that Jackson exists.
grateful because it'll make things so much easier for me in the long run (including storing player data as SQL, since JSON becomes strings more cleanly than YAML), but frustrated because I have a lot of code to rewrite LOL
I think what I might do to save myself a headache is just save the API structure and delete the actual logic in the methods so nothing changes on the surface but I also don't have the mental clutter of existing code
If you want to convert into json then i would recommend Gson over Jackson. I find the custom serialisation of Gson superior.
Jackson is better for yml and enterprise stuff.
hmm. I'll look at gson instead, thanks
hit me with info on this
i require it
what did they do?
yeah but
download the buildtool
i am still confused
i am downloading the buildtool
please...please tell me I don't have to update obfuscated shit with each version...
misery
i try to avoid using nms as much as possible for this reason
and I do use maven
imagine not using dependency management in 2021 π
i dont know how to use it
Hey, i have a question about placeholder, here the %% would be %plugin_maxHealth% %mainclass__maxHealth% or just %maxHealth% ?
public String onPlaceholderRequest(Player player, @NotNull String params) {
if (player == null) {
return "";
}
if (params.equals("maxHealth")) {
AttributeInstance maxHealth = player.getAttribute(Attribute.GENERIC_MAX_HEALTH);
}
return null;
}```
ikr
but like Gradle works differently so
for papi, it's only t he thing after the plugin identifier. so maxHealth
god, please, help me
waitt
only that?
java -jar BuildTools.jar --rev 1.17.1 -mapped execute this with the buildtools
and that thing will return me the max_health of a player?
you have to return a string with the value of the player's health in your case
still hunting for a good method/api that manages your punishments.
litebans?
hmm, how? π
litebeans
just return the max health as string..
confusion
pretty sure it isnt a thing i can use to code with
i doubt it
litebans is a p l u g i n
?
ye but doesn't it have an API?
pretty sure it doesnt
no idea what you mean
wait
i mean, why people use papi?
https://gitlab.com/ruany/LiteBansAPI/-/wikis/home then what is this hah?
Official LiteBans API repo, wiki and issue tracker. https://ruany.gitlab.io/LiteBansAPI/
people use PlaceholderAPI to offer placeholders with data from their plugin to other plugins and/or text strings.
but if i'm creating a plugin for my use, is it necessary?
for example, to put a string from other class to the actionbar
Depends. Do you use other plugins as well?
wdym
If you do everything yourself then you dont need papi
in a server?
it really depends where you want to display the data
imagine you want to have your plugin's data on a HolographicDisplays hologram, you'll need to add a PAPI placeholder in order to display the data
oh
no, the action bar is from my plugin as well
so i don't need it
ok thanks!
Example:
You have a hologram plugin which supports papi and you want your
data in those holograms then papi is a quick way to get that working.
But if you have your own holograms then its def better, performance
and flexibility wise, to just design proper APIs and distribute your data
between your plugins.
ok, Ty!
what mobs besides villagers can open doors?
Then vex may fall under this
Wither
I don't mean they should actually leap through the door lol
Enderdragon...
they should still open it first before entering
wait i have to pay for it to work?
there's a getIdentifier
so it's
%identifier_params%
Hello, I would like to know if there is a way to remove players cursors from a map except the map's holder cursor ?
LiteBans' API is an absolute joke
Case in point,
"There is no need for an API"
"Just execute commands"
Lmao
singletons for EVERYTHING
It's not really an API, you gotta write your own SQL queries
The API is just a mysql connection getter
It's horrible, yeah
So if they add future mongodb support, everyone's fucked
Just that nobody's made a decent replacement for LiteBans
great job π
lmaoo wtf
I could make a litebans replacement except without the web gui stuff
But it'd be extremely overengineered and like a year into development
And I just can't bother
Yeah
If I'd make a litebans clone it'd be hell
"Illusion's ban plugin, has mysql, mongodb, sqlite, .yml, proprietary extension, all as configurable databases, if you're going multi-proxy, use redis or rabbitmq, works on spigot, bungee, velocity, minestom, glowstone and more!"
and then people will just say "doesn't have web gui, not buying"
fancy ban plugin with a web gui
its only unique feature is the web gui
LiteBans is the go-to ban plugin
Used on a majority of servers if they don't write their own
i wonder if the bukkit command api is slow
im sure its 50x faster actually implementing an api
.
spigot is written on top of craftbukkit, written on top of bukkit and NMS
I believe
The amount of layers make it possible that the command system is slow
Imagine if spigot allowed you to disable major functions of it π€
It's not a matter of speed, it's a matter of "Don't hi-jack the command system as a plugin API"
Just having a lobby server with no achievement system, everyone is set to adventure so block breaking is not tracked
items would not be ticked, worlds wouldn't need to recalc light all the time π€
Maybe I should compete with litebans π
I dont believe in you
prove me wrong
π΅βπ«
wrong emoji
this was supposed to be motivation ^
I think the biggest feature that litebans misses is incremental ban lengths without having to specific the time yourself
Players can get banned for different reasons, so maybe a preset ban message depending on a list of configurable reasons
And custom mobs with a pathfinder to hunt for red flowers
Lol
https://cdn.discordapp.com/attachments/536476746686398494/900129615824179246/Lunar_Client_1.17.1-44c40d4_master_2021-10-19_23-12-58.mp4 alright so it does look like he's trying to open the door but it's not doing anything
i realized earlier that i'd accidentally recreated json for yml on a smaller scale and i hate myself
Hey, does any one know how to hide players cursors from map render except the holder's one ?
What version is this made for?
From what I just tested
ItemStack item = new ItemStack(Material.PLAYER_HEAD);
SkullMeta meta = (SkullMeta) item.getItemMeta();
OfflinePlayer pl = Bukkit.getOfflinePlayer("IDK");
meta.setOwningPlayer(pl);
item.setItemMeta(meta);
this worked for me
spigot still doesn't allow any kind of licensing system for plugins, do they
Yea sorry I am not good at coding, I started about a month ago
Also this gives the same error, when eating other items it still kills you
:( IS THIS PLUGIN IMPLYING THAT VEGANISM IS BAD?!?! HOW DARE THEY, SHAME ON THEM!!!
- Said every Twitter Vegan.
(this is a joke, if you couldn't tell)
Oh hey fun fact about EnumSet!
There's two implementations of it internally.
RegularEnumSet, which stores enums as a long and can only keep 64 enum values.
i dont think veganism will ever cause a lack of produce
im never eating leaves for my entire life
And then JumboEnumSet, which stores enums as a long[], and can keep way more than 64 values.
eating less meat is a good thing for both the environment and your body
Chances of you having a JumboEnumSet are slim though, since it automatically selects either of the two depending on how many enums you configure for that set.
And... most people don't have more than 64 enum constants lol.
just eat raw red meat
π
I do not care.
Warning: Poisoning effect
- The environment is already dying because of everyone else, me deciding not to eat a hamburger will not fix that.
- I like meat :p (yes homo)
and when i cant eat what i want, i go for the 2nd best thing
a good burger is a good burger
Also, meat is much more natural than shit like protein shakes if we wanna get real.
protein shake burgir
The world was designed as a wasteland where things eat each other all day.
frozen protein shake as the beef
This is why forcing your pets into veganism should be considered a form of animal abuse.
yep
I mean yeah but the connotation is that we're talking about carnivores.
ill make my parrot eat a 5 star steak
i feed my cat birds that landed in my yard (cleaned ofc)
you cant stop me
she loves meat, and if i were a cat the same food everyday would get boring
own chickens ?
good point
does that help with anything?
Nahh, animals have decent memory.
I treat my cat as if she had a conciousness
tearing your skin apart is a choice
That is true.
a wise choice
Also, I believe the whole "memory of a goldfish" thing is actually untrue.
the goldfishes could just be trolling science
the rats are lieing
Damn, y'know if I were a goldfish I'd totally fuckin' do that.
decided to not follow instructions
lying*
Confuses my brain cells for waits in a for loop.
That's because """ is actually not a comment
It's a block string
You can split it across multiple lines
I didnt ask
It's quite stupid that you add docs to a function by just putting a string on the first line of it
Im sorry redempt.
Then what was your point in posting those
I thought you were posting them to point out how one errored and the other didn't
So I was explaining why that happens
yes it dumb
How does one wait a couple miliseconds in a for loop?
What's your use case?
You should basically never be waiting
You should be using the scheduler
Waiting in general not using the wait functionβ¦
Waits in a for loop are only acceptable if you're doing it async on crucial timing
outside of minecraft
?scheduling
Keep in mind Minecraft runs on intervals of 50ms
not always
Well, ideally
If it is lagging it may run slower, and if it is trying to catch up it man run slightly faster
I am making a plugin which once a "crop" is placed it spawns in two Armor stands on the position of that Armor stand a "Name" and "Progress" Armor stand I tried storing these in both hashmaps and config files but A) I cant find a way to store hashmap before a server reload then import it back in B) Configs are a mess and iterating through thousands of placed crops would be very bad
any recommendations on what i could do?
I have been suggested i should use a DataBase but no clue on how i would go about doing so
Use SQL or sqlite. It's not too hard to learn.
@vocal cloud Any recommended tutorials?
I used this but no idea if it's still good. https://www.sqlitetutorial.net/sqlite-java/
This SQLite Java section teaches you step by step how to interact with SQLite using Java JDBC API.
That's for lite but you can use the knowledge elsewhere
noted
thousands of mysql tutorials ill check those out too
Does MySql or any other type of database work like a dependency?
Hello, is there a way to remove the actual life bar of a rided entity ? (NPC to be exact)
@opal sluice what do you mean by that? as in if youre riding the Entity the hearts do not show?
I guess so ^^'
ahah, I'll give it a shot, rq
A custom texture pack could albeit that's not through plugins
^^^
Yeah, but that would remove it from any entity
if nothing works texture pack is your best bet
So not really a solution ^^'
if you also have an idea on how to put an EntityPlayer invisible that would also be helpful (already tried to get the bukkit entity and make it invisible)
And, setHealth() doesn't seem to work on an EntityPlayer also π₯²
Hey guys! I am looking for some guidance- I am interviewing some developers and I have no prior experience or in-depth understanding of development. I have drafted some questions to ask during an interview, and I want to know if there is anything else I should cover or ask.
If you're an experienced developer and can help me out, please give me a DM so I can show the questions. Thanks a lot, I really appreciate it!
?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/
no, not services haha
just ask here
I just don't like to publicly display my interview questions
I'd prefer to do it 1-on-1
most of the time people dont want to do some dm tho...
I understand that, that is why you guys have the option to DM me
Nobody is forced π€·ββοΈ
No problem
how can i Fix collisions false flag Β« speed Prediction Β» on my anticheat?
?ask
If you have a question, please just ask it. Don't look for staff or topic experts. Don't ask to ask or ask if people are awake or available. Just ask the question to the channel straight out, and wait patiently for a reply. Create a thread in case the help channel you are using is already in use!
Is it possible to "redirect" a player to a link? Like what happens if you were to click one in chat
its shows a warning
no only way is to get a player to click on a link
if (gui.getItem(i) == null) {
gui.setItem(i, Material.BLACK_STAINED_GLASS_PANE);
}
}```
error: incompatible types: org.bukkit.Material cannot be converted to org.bukkit.inventory.ItemStack
you are setting an ItemStack as a Material
what to do then
ItemStack Black = new ItemStack(Material.BLACK_STAINED_GLASS_PANE);
i already defined this too
worked
Also the variable should be lowerCamelCase
is there anyone who can help me code player data with morphia?
i have been always using mysql so i need some help please
?ask
If you have a question, please just ask it. Don't look for staff or topic experts. Don't ask to ask or ask if people are awake or available. Just ask the question to the channel straight out, and wait patiently for a reply. Create a thread in case the help channel you are using is already in use!
?ask
If you have a question, please just ask it. Don't look for staff or topic experts. Don't ask to ask or ask if people are awake or available. Just ask the question to the channel straight out, and wait patiently for a reply. Create a thread in case the help channel you are using is already in use!
ok
does getInventory.getTitle exist in 1.17.1?
Why don't you check?
Well Im wondering the replacement if it doesnt
because if it does im not able to use it
well, check if it exists or not :)
.
Well, if you try , you'll understand
Oh interesting
It was replaced with getView
No, get view returns InventoryView
Not title
Yiu can use getView().getTittle()
For 1.17.1, you just == the inventories
Ya
The InventoryView was never meant to be for what you need
Thanks
so in theory
if (e.getView().getTitle().equals(ChatColor.stripColor(config.getString("string")))) {
//do something
}
``` should work?
The InventoryView was never meant to be for what you need
Well what am I todo then?
I just use InventoryHolders which works fine π
It's not a supported feature, proper way would be == or .equals with an Inventory object
to check for a name?
thats interesting
never thought that would work
I learned something new today
I mean i do every day but
that wouldnt work
that won't work
lol
WTF
Listen I got confused ok
Id rather know im wrong
lmao
Anyway
back to "development"
thats how it should beβ’οΈ
At least thats what ive seen everywhere else
Fair
You'd want something along the lines of
private static final Inventory INVENTORY = ...;
if(playerInventory.equals(INVENTORY)){//codehere}
Either compare inventories directly
Or compare the view from the event with the view returned by OpenInventory
ah okay
better to just compare directly, i believe even the view method is discouraged
Ah, wasn't sure.
Hard to keep track when you don't code plugins much π
if (!livesConfig.contains(uuid)) {
livesconfig is yamlconfiguration
and uuid is player's uuid to string
it does exist
but it still returns true...
Shouldnβt you remove the !
i want to check if it doesnt exist
if (!livesConfig.contains(uuid)) {
livesConfig.set(uuid + ".lives", 3);
livesConfig.set(uuid + ".spectator-time", -1);
}
this is joinevent
Is the file blank?
no
Like before you trigger the join event did you check if the file was blank?
no but i won't ever need to
this is for a personal smp
the file will never be blank again
If it doesnβt trigger it means that it found the uuid in the file
it does trigger
i don't want their lives to be set to 3 every time they join
its a semi-hardcore smp
would that be soft core or hardsoft
no idea
Is livesConfig like a configuration file?
Then you should livesConfig.save()
Try if(livesConfig.get().get(uuid+β.livesβ)==null)
mayhaps you needs to make the UUID a string
ahem
He said uuid is already a string
this
Did you try this
an int can't be null iirc
it'd return 0
but people can be on 0 lives
Basically
If itβll return null it means there isnβt their uuid on it and will proceed at setting it to 3. The other times there will ne their uuid and so it wonβt do anything
And it wonβt set again their lives to 3
If you have per player data then its often a good idea to maintain one file per player.
If you have one config for all players then you can also just load all data when the server starts
into memory as the FileConfiguration has to be in memory anyways. For scalability reasons per
player files are cleaner.
or use something like SQLite
there are 2 entries
"lives"
and "spectator-time"
im not making an individiual files for each player
also this is for a personal smp
max of 20 unique ppl
i'm not making an sql database for a small friend smp
Then i would def just load all data when the server starts and save all data when the server stops.
And during runtime i would just use a class and never tinker with the config files.
hi, dr. don, here, how can i help?
Heh
Idk about older version but right now at java 16 u can just use uuid as it already like a string
hmm
ik custom models are possible with resource packs, but only to the extent of modifying a current existing block texture. is there any way to do with without losing a vanilla block in spigot or an alternative for packs?
Hello i'm new at java development and trying my first gradle plugin.
I don't understand why when I run my task "setupDevServer" the task "cleanSpigotBuild" is running too ? I dont have any dependencies
https://pastebin.com/jDTpUrQE
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.
well, it depends on buildSpigot, which depends on cleanSpigotBuild
buildSpigot
}``` this part is called even i just run a task ? if yes but where do you see cleanSpigotBuild depends on buildSpigot ?
hasSpigot() = true
I'm trying to understand where exactly
may be this
tasks.register('setupWorkspace'){
dependsOn 'buildSpigot'
}
but not sure why either
I tried to put a debug in the buildspigot task, nothing comes here
or this?
tasks.register('prepareDevServer') { dependsOn 'buildSpigot', 'setupDevServer', 'copyPluginToTestserver' }
tasks.register('startDevServer', JavaExec) {
dependsOn 'prepareDevServer'
i'm running setupDevServer
^
depends on setupDevServer
prepareDevServer depends on setuoDevServer
and startDevServer depends on prepareDevServer
tasks.register('buildSpigot', JavaExec) {
if (hasSpigot()) {
enabled = false;
dependsOn = [];
} else {
dependsOn = ['cleanSpigotBuild', 'downloadBuildTool']
}
hmm yeah startDevServer depend on setupDevServer, but only if i call startDevServer right ??
task.register, is there suppose be be something after the 'prepareDevServer"
like Copy or JavaExec?
dude are you like 40+
What do you mean
If we assume he was between the age of 15-19 at that time, then it's highly likely.
I mean you legally have to be over 16 to use weed
- Weed was not legal back in 1997.
- That stops no one.
yes
i wasn't even born in 1994
Dunno where you got that date from.
deitz nuts
i lose weeks on a daily basis
i win weeks
impurity since 1546! :D
i'm older than ElgarL so be kind
rae u 50
i once lost a week in the 80's
I've lost an entire day before from sleep deprivation.
yes, how did you think you got all these wonderful games?
if it were not for folks modding adventure in Basic-80, well...
those of us trying to hack Apple Pascal to understand Wizardry: Proving Grounds of the Mad Overlord..
those of us, hand coding games in basic from Byte magazine...
i lost an entire day in a family event
I lost a day to inebriation.
fanatical is a nice one too.
I gained a day flying to Japan.
so it washes out
but i got inebriated drinking sake so, well
i lost a day researching how someone has a big nut and has to buy a hoodie for the nut
are hoodie nuts a thing? dayum, i'm so far behind.
ok, i'mma gonna open an AMA for my old ass.
back in my day we didn't have sublime, we had edlin
i use vim
poke was something us used to put a byte at a memory location, not to light up others on a game
nah, we had nothing like it, java wasn't even a thing
import com.destroystokyo.paper.event.entity.CreeperIgniteEvent;
import org.bukkit.entity.Creeper;
import org.bukkit.entity.Entity;
import org.bukkit.entity.EntityType;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.entity.EntityDeathEvent;
public class CreeperDeathEvent implements Listener {
@EventHandler
public void onDeath(CreeperIgniteEvent event){
if(event.getEntity() instanceof Creeper){
Creeper creeper = (Creeper) event.getEntity();
creeper.getWorld().spawnEntity(creeper.getLocation(), EntityType.ZOMBIE);
}
}
}
why does this dont work?
did u register
yes
show
getServer().getPluginManager().registerEvents(new CreeperDeathEvent(), this);
pascal was the fancy language, although all the big bois programed in c and asm__
if not machine language
cobol was passe, as well as fortran
borland still existed and facebook, google and twitter didn't exist.
why is it creeperignite event
plus if its creeper ignite event
i tried death too
the entity is 100% creeper
not to knock the guys writing fortan, ffs, they sent folks to the moon
wha
or maybe it was algol
EntityDeathEvent
leme see if it works
i bet non of you understand how computers actually work
doesnt work
if ur doing entitydeathevent
import com.destroystokyo.paper.event.entity.CreeperIgniteEvent;
import org.bukkit.entity.Creeper;
import org.bukkit.entity.Entity;
import org.bukkit.entity.EntityType;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.entity.EntityDeathEvent;
public class CreeperDeathEvent implements Listener {
@EventHandler
public void onDeath(EntityDeathEvent event){
if(event.getEntity() instanceof Creeper){
Creeper creeper = (Creeper) event.getEntity();
creeper.getWorld().spawnEntity(creeper.getLocation(), EntityType.ZOMBIE);
}
}
}
pls spoilers
no error
when creeper dies, it should spawn zombie
and?
i am making Boss Mob
no lol i will spawn wither skel ig
but its not working
idk why
pls look upon the code and say if there is any errors
is creeper.getLocation() null?
wherever the creeper dies
break that out, check it's not null
it gets the exact location
There is no problem with your code, did you check if the plugin is enabled
hello i have a question
how to controll an entity if you are riding it
for example if setRiding player for ender dragon.
how to controll it
except this creeper death thing
did you add debug code
your code is where?
if you add debug after the spawn line, then its probably a configuration issue
CreeperDeathEvent
no?
did you register that class?
yes
where's your main code with registering?
Get an instance of your plugin in that class and after the spawn line put
plugin.getLogger().log("This code runs, therefore its a problem with either configuration or another listener on the server stopping zombies spawning")
Howdy yall what we helping with today
please don't make me open my code
uh i am not sure is it like this: ?
INSTANCE = this;
}
public static BossMobs getInstance() {
return INSTANCE;
}
@last ledge you need to register the listener CreeperDeathEven in your main plugin code, is this happening with something like registerEvents(this, CreeperDeathEvent(), plugin);
i have already registered in main class
getServer().getPluginManager().registerEvents(new CreeperDeathEvent(), this);
ok, and you are sure it is "hitting" that class, by putting some log messages?
doing that wait
i always find that putting in some debug log messages will help to find where the problem is
if you put log code in where the method/function starrts, you know that your are reaching that code
put some log messages in on the event to see that the event is fireing
this is how we "debug"
k
log mesages are like breakpoints,but we dont' have that luxury
just need to logger.log(Level.SEVERE, "Whatever");
assuming you have got a static variable to the logger for your plugin
just public static Logger logger; in your main
and assign logger = plugin.getLogger();
ok
plugin = this in onEnable()
public void onEnable() {
// logic to be performed when the plugin is enabled
plugin = this;
logger = plugin.getLogger();```
and in your main class
public static Logger logger;
If he already has an instance of his plugin (He has getInstance()) he doesn't necessarily need to have a logger method to get his logged unless you just want it for simplicity sakes
import frolic.bossmobs.events.CreeperBlow;
import frolic.bossmobs.events.CreeperDeathEvent;
import org.bukkit.plugin.java.JavaPlugin;
import java.util.logging.Logger;
public final class BossMobs extends JavaPlugin {
private static BossMobs INSTANCE;
public BossMobs() {
INSTANCE = this;
}
public static BossMobs getInstance() {
return INSTANCE;
}
public static Logger logger;
@Override
public void onEnable() {
plugin = this;
logger = plugin.getLogger();
getServer().getPluginManager().registerEvents(new CreeperBlow(), this);
getServer().getPluginManager().registerEvents(new CreeperDeathEvent(), this);
// Plugin startup logic
}
@Override
public void onDisable() {
// Plugin shutdown logic
}
}
this way?
can anyone help? i'm making a rules command thingie and in this section, it seems that one of the lines (kissing) is a bit off. does anyone know why?
player.spigot().sendMessage(new ComponentBuilder()
.append(ChatColor.translateAlternateColorCodes('&', "&8Β» &7You may not do / say anything inappropriate. &8Β» "))
.event(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new Text
(ChatColor.translateAlternateColorCodes('&', "&b&lINAPPROPRIACY"
+ "\n" + "&8Β» &7Page 1, Section A" + "\n\n"
+ "&b&lTHIS INCLUDES" + "\n"
+ " &8Β» &7Kissing" + "\n"
+ " &8Β» &7Anything NSFW&7" + "\n"
+ " &8Β» &7Inappropriate Skins" + "\n\n"
+ "&7[WARN]"))))
.create());```
https://i.imgur.com/yCogXMy.png
you can put log messages in to help you debug
do i put this on my event class?
like "logger.logLevel.INFO, "test point 1");
how to make a player ride an entity
oh, have to have your plugin in the main too
setPassenger, found it
Tbh not sure why it would do that, if you remove a space before kissing does it align it correctly?
like public static BossMobs plugin;
nope, i tried
ok
then when you do logger= plugin.getLogger(); it should work
i mean i tried removing it before the double arrow symbol
public static AuctionHouse plugin;
public static PluginManager pm;
//public static Permission perm = null;
public static Chat chat = null;
public static Economy econ = null;
public static HeadDatabaseAPI hdb = null;
public static TokenEnchantAPI te = null;
public static boolean discord = false;
public static Connection conn = null;
public static DiscordSRVListener discordSRVListener = new DiscordSRVListener();
public static NMS nms;
public static Config config;
public static Logger logger;
public static String version;
public static int mcVersion;
public static String servername;
public static String levelname;
public static Listings listings = new Listings();
public static final MenuManager menuManager = new MenuManager();
public static Map<UUID, Long> playerCooldowns = new HashMap<>();
public static int tickEventId;
public static int dropEventId;
public static int cleanupEventId;
public static final Map<String, TreeMap<String, String>> locales = new HashMap<>();
@SuppressWarnings("EmptyMethod")
public static void main(final String[] args) {
// main entry point
}
@Override
public void onEnable() {
// logic to be performed when the plugin is enabled
plugin = this;
logger = plugin.getLogger();```
i know lots of static
logger.log(Level.SEVERE, "this is bs"); this in event class right?
Maybe try putting the \n without the +
EG put them all in one string context?
i'll try it, but i don't want it to stay like that cause then it will be hard to understand what's going on in code
never use spigot's logger
I constructed an API with my team. https://github.com/Lcraft-Developers/Lcraft-APIs. This works as a plugin and runs fine, but we have a problem. The problem is that when we add commands to a test plugin that has only imported the API, it cannot add commands. It has its own detection system for the modules and the module system has nothing to do with Spigot. Now I want to add commands in my test plugin. Until now I have only:
plugin.getDescription().getCommands().put(command, options);
plugin.getDescription().save();
plugin.getCommand(command).setExecutor(executor);
But, with the "save()" method it still needs a file to save to and genneral it throws an exception that says you can't interfere with the plugin.yml of the API like that. So how can I now have commands automatically registred via the code of Minecraft without specifying any command in the "plugin.yml"? Or is it not possible?
Code: https://pastebin.com/sPb5tzTU
Error: https://pastebin.com/mAZsbM6T
File: https://pastebin.com/b1rRL0Xf
How do I fix this?
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.
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.
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.
Check and make sure whatever your Casting List to is actually a List first
Also why ItemStack[] instead of List<ItemStack>?
It is an ItemStack[] first
public void onEnable() {
plugin = this;
logger = plugin.getLogger();
getServer().getPluginManager().registerEvents(new CreeperBlow(), this);
getServer().getPluginManager().registerEvents(new CreeperDeathEvent(), this);
// Plugin startup logic
}
now do i run it?
crap, i might have to actually make updates to my code...
i should leave b4 i hasve to do this
Because getContents return an ItemStack Array
dayum. i really don't want to deal with all the folks trying to hack and expoit my mod
i mean my plugin
@noble lantern Did you look at the files?
new ItemStack<>(contentArray) will create a new ArrayList with the Array content
now what do i do sir?
Should I do that in saveInventory?
no, will not do
Yes
ItemStack[] content = ((List<ItemStack>) c.get(this.guild.getGuildName() + ".inventory" + "." + type)).toArray(new ItemStack[0]);
Your casting a singular ItemStack to a List
are you able to get log output?
i tried it, didn't work
public void onDeath(EntityDeathEvent event){
if(event.getEntity() instanceof Creeper){
Creeper creeper = (Creeper) event.getEntity();
creeper.getWorld().spawnEntity(creeper.getLocation(), EntityType.ZOMBIE);
logger.log(Level.SEVERE, "this is bs");```
still like 2 pixels off or smth
new ArrayList<>(c.get())
like this in event class right?
Adds Commands without using the plugin.yml - Lcraft API
so the thing about using the logger is that you can put text to the logger when you hit parts of your code
but you can also send formatted text
as in something like
logger.info(String.format("Registered Service Provider %s for Vault's Economy API", rsp_econ.getPlugin().getName()));
Wait. This doesn't make any sense. Why in saveInventory?
so, you can print out variables and such
This is the exact same thing as in loadInventory.
and use String.format
i just want to print the log message
public void onDeath(EntityDeathEvent event){
if(event.getEntity() instanceof Creeper){
Creeper creeper = (Creeper) event.getEntity();
creeper.getWorld().spawnEntity(creeper.getLocation(), EntityType.ZOMBIE);
logger.log(Level.SEVERE, "this is bs");
}```
is this correct?
yes, if you setup logger as a static
as I mentioned
then you can use anywhere in your code
this is a good use case for static variable
all other uses are evil according to OOP purists
Your error is in loadInventory not saveInventory
GuildInventoryManager.java:58 specifically
Yes. I know. But why you said I should edit saveInventory.
so sir, logger is coming in red in my event class, what do i do?
The line of code is posted is in loadInventory
would need to see the code
Yes.
ItemStack[] content = ((List<ItemStack>) c.get(this.guild.getGuildName() + ".inventory" + "." + type)).toArray(new ItemStack[0]);
This is in loadInventory, and your getting an error because c.get is a singular itemStack
And your casting List to a ItemStack
in your main you have the public static Logger logger;
in onEnable, you asssign it the plugins logger with logger = plugin.loger()
ItemStack[] content = new ArrayList<ItemStack>(c.get(this.guild.getGuildName() + ".inventory" + "." + type)));
``` @noble lantern This doesn't work.
In loadInventory
ItemStack[] -> List<ItemStack>
pluigin is basically this : plugin = this in onEnable()
Why do people put ... = null on a field?
Unexpected token
logger = plugin.getLogger();
logger = plugin.loger();
getServer().getPluginManager().registerEvents(new CreeperBlow(), this);```
Wym, can you show me what you mean? and error?
like this?
Also, why are you creating an array for a singular item @rigid hazel ?
Please tell me first: What should I do?! I'm so confused. You sent me like 5 pieces of code
and its also defined in main as public static BossMobs plugin;
can someone please help with this?
Why are you making an array though for a singular ItemStack?
Can you just inventory.addItem(c.get(stuff))
nt in chat
I don't know what you mean. I just copied the code from the internet, because mine didn't work. https://www.spigotmc.org/threads/save-inventory-and-then-load-it.43907/
to the paste site, copy it there and save, then copy the link to chat
ah, i am so confused what to do
Please @noble lantern. Perhaps you sent it earlier, but please show the code I have to use.
the URL will change
Or explain it easy.
copy the URL and paste here in chat
Klugemonkey, so is my main wrong?
look
open main
then copy your code to that site
afterwards, in the upper right corner click on the icon
copy that url and paste here in chat
@echo saddle
I see now, what your doing you need to do it a little bit differently because your c.get() needs to be a (Right now your actually just pulling a string from config)
FileConfiguration#getItemStack(configPath)
As of right now your just loading strings and not the actual ItemStack from the YAML config, you need to actually loop through the YAML Paths and load each ItemStack with that method and save them into a List
Also since your saving empty Inventories (Your just creating empty inventories in the constructor) in your program you actually wont have any ItemStacks unless your calling saveInventory during runtime, if your doing that you need to loop through all the keys in your config path, and then getItemStack on each config key
you just made a big step forward in getting support
yay!!
π
if you paste your code this way, devs and moderators can help you
wow, i am so excited to get the support π₯³
Thanks. I will try with for-loops.