#help-development
1 messages Ā· Page 1479 of 1
He says it doesn't throw any (Which it should)
yeah there is no error in the console
So it spawns the gravel ?
yes
You can;t cast a Block to a FallingBlock
FallingBlock fallingBlock = (FallingBlock) spawnLoc.getBlock();
this line
remove it
How is your console not throwing an error š¤
also your raytrace shoudl use the players Eye location and direction
how do I do that?
yeah weird
Probaby Eclipse.. their compiler is a bit special and capable of removing bad code
using IntelliJ
Probably InteliJ, its a bit special and protects people from learnign the basics š
but if its not a fallingBlock anymore how can I set velocity?
Use World#spawnFallingBlock i think
I will try that thank you all
Is there any way to open an anvil view that isn't an actual anvil (Like won't automatically set the output)? I want to make a custom GUI using the anvil, but overriding the anvil events is getting kind of messy.
yes create an inventory of type Anvil
um perhaps not. I thought Anvil worked the same as Workbench
cancelling PlayerInteractAtEntityEvent does not prevent piglin trading... is there a way to do so?
you mean teh PiglinBarterEvent?
cancelling PiglinBarterEvent literally does nothing, lol
old versions are unsupported
If you have never made a plugin before I recommend you make an up to date one before attempting one on a version you will get little to no help on.
but yeah PiglinBarterEvent cancellation has 0 effect on any method of trading with piglins
Trading as in throwing things on the floor so they pick them up?
it cancels neither, but ive stopped that with cancelling EntityPickupItemEvent
players can still interact with the piglins though
PlayerInteractAtEntityEvent is called but cancellation does nothing
The barter event is only for them picking items off the floor
(doesnt work for that either)
It shoudl, but its possible its broken I guess
in any case, i see no way of stopping piglin trading
other than maybe setting the output to the very same gold
If the barter event is broken for you I'd expect others to be broken for piglins too
So you may be out of luck
oh, it doesn't work cause my version doesnt have PiglinBarterEvent
need to update
ok, so cancelling the barter event stops an item from coming out
@EventHandler
public void on(PiglinBarterEvent evt) {
List<ItemStack> drops = evt.getOutcome();
drops.clear();
drops.add(evt.getInput());
}``` that works, lol
how can i create a spigot and bungeecord plugin ? I mean both of them work with the same jar file.
two main classes, one extends JavaPlugin, the other extends Plugin from Bungee
importing the bungee file and the spigot ?
you add a plugin.yml and a bungee.yml
can they share/access each other's classes though
that's the real question
and the answer is no
hey there what you mean it doesnt work
it should stop the trade but the piglin will still pickup the barter item
does EntityDamageByEntityEvent get called even if the entity being hit is set invulnerable
Pretty sure it doesnāt
Does anyone know how to make custom weapons using a texture pack and NBT files?
I thought it was impossible
??
Is there a way to get the destination slot from InventoryMoveItemEvent
e.g. when a hopper puts an item into a furnace
Whats a minecraft sound that sounds kinda like a forcefeild?
Wolf pup dying noise
lol
??
Or angry villager noise
those are terrible choices
aint there some shield sounds u can use
niceeee
Any devs who need builds done and wanna do dev work for builds lmk, I can also throw in discord phone s3x
Use the nether portal sound
what are you building
Depends what is needed
i don't really need builds
?services you aren't allowed to offer services here šļøšļø
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/
he just wants the phone s3x
but I could maybe do something for a handful of 5 star reviews on my plugin
Lmao maybe if the scale werenāt too large, Iād have to leave a couple thousand reviews to come close to paying
Oof I meant like 2-3 250x 250 builds
just update the plugin with a script 1k times, then have him leave a review for each update with "Very good update. Developer was very quick to make changes, even recoded the plugin 50 times for me"
that requires putting at least 5% effort in the plugin
and thats like a lot of work
True thatās a lot
what are you even looking for dragonze
implying reviews are ever meaningful
"help theres a bug it doesnmt work eror: (300 line error)"
Iām trynna make a game like clash of clans in minecraft. Is how I would put it
Very
Well I can learn how to dev (hopefully before college) myself, and the builds are already done
someone write me a decent crates plugin
Just enemy design and game design left
sounds like a good dev excercise
LMAO
i'll let you write a crates plugin for me
Use CrazyCrates they work fine
in return you can 5 star my plugin
I'll 5 star your plugins for free
crazycrates last i tried was trash
Link your plugins I'll 5 star them rn
i need to be able to give out items with arbitrary pdc tags and shit on them
and most crate plugins i've come across don't let you set the pdc/internal meta contents
looking for PAID developers, requirements below
5 years development
4 in java
3.5 in spigot
deep knowledge with sql
must be a linux master, extremely good with ubuntu
at least 5 hours a day
pay will be offered if the server makes money
thats the real kekw
Don't work with kids and you'll get paid properly
My friend used to get paid $35/h as a plugin Dev for some server
i can offer you my consultation and design services
but i won't have the effort to write any code probably
lmaoo
ur consultation is free
just make it seem like a noob problem and post here
and boom consultation
it's free until you offer to pay something
Ill give you a positive comment on ur non existent mcm profile?
I find all good devs are lazy so they charge 35$ an hour and will take 25 hours making a plug-in that should take 10 tops, and the bad ones all have good commercial practices
ASync sucks
async cannoning
unless you're a dev yourself and you have written it before, it's hard to assume how long something will take
paying by the hour is dumb anyway
then again so is paying per project
i guess capitalism is dumb
then how do you propose payment xd
Paying per hour is easier to convince the client
is the economy dumb next
I like being paid per project so I know how much money I would be getting is fixed
pay per hour and you have a sleeze lazing around half of the time getting nothing done
pay per project and you get a rushed piece of shit
why not both then
Is there a way to use Textcomponents in kick messages?
the meme necromancer
why would you
for links
i don't think click events work there
you can't do that Glub
shit okay thanks
Iāve worked on multiple servers (just me and one other person) who is a dev, and they told me on multiple occasions that usually the building process takes longer and builders get payed less because everyone wants to be a builder and none devs (keep in mind the builds are 150x150) (and the plugins required around 500-600 words each). Although your right I cannot comment on the difficulty of said time spent, the fact that is not only noticeable but so much so that a dev I was paying was willing to admit he did little to no work was odd. Especially because the project seemed huge compared to the asking prices online
plugins require 600 words? what do you mean by that
Maybe itās just me but 150x150 is pretty damn huge... like larger than most small hypixel Skyblock islands (and there were 5 on the server this large)
150 is small
you can walk 150 blocks in like a few seconds or something
i guess it depends on the amount of detail
but seriously what do you mean 600 words per plugin
if you meticulously plan every block for 200 hours yeah it's pretty big
if you're talking about skript development š
also I plan extensively for large plugins, to get the workflow and layout in my head before I start coding
He said on average for the server he wrote like 600 words and tbh I donāt even know either, it just seems like a small period of time
writing the stuff is the easy part
making it work and designing it in a way that doesn't explode later is the hard part
a trained monkey can mash buttons on a keyboard
depending on the stuff you can also run into problems
TF you mean words for plugins
stuff like source lines of code or instruction count or character length or word count are all pretty poor metrics of project complexity
marginally better than filesize though, i suppose
why stop with the api
shade in the server
and the authlib and apache commons
and gson and everything
once saw like a 150mb plugin by some random fuck who was trying to do nms for the first time
what kind of plugins was he making?
And some devs are even shadey enough to price configure edits at $20 a plugin. Something a monkey (like myself) learned on YouTube while doing the dishes
I charge on complexity of the plugin and what I believe the amount of time it would take to create at the beginning
600 words is like 50-180 lines of code lol
maybe they were just really good lines of code but still
i don't do development for money because I already have money and I don't want to tie myself down with promises to keep
One that causes structures to spawn when right clicked, made it so u couldnāt spawn structures out of bounds, or place structures out of a grid. And also caused a invisible entity to spawn there.
I stray away from large projects because fuck that noise
So the first half of the buildings plugin for the clash thingy
the only part about that that seems difficult or annoying is the generating structures part
and that's just because the worldedit api gives me fucking pimples
Second half being the effects of said tower playing where the invisible entities are when being attacked which took more words (around 1000)
all I know is even the most amateur programmers can get paid ridiculous cash for easy projects
It isn't rediculous if the client doesn't know how to program thenselve
anyway, you wanted to learn to dev right
Themselves.
Yes
have a friend who did some work for uni which was like a tiny bit of python (barely knowing python, at that) and got paid like $40 an hour calculated
give me a 1000 by 1000 island and i'll teach you how to dev and write the clash of clans or whatever thing yourself
Yes any computer science not regulated is over priced
I think he using feet
You don't need an island that big
you probably want to do the base of the build with a world editor
and only add details manually
one of my builders has done a few of these but they do take a while
and he has other shit to work on rn
It's possible but unnecessary
have you done any programming before @gritty flame ?
iirc he uses worldpainter, or whatever it was called
If you wanna learn how to dev, YouTube is your friend
I learned how to make maps using command blocks lmao thatās about it
commandblocks are gay
You're gay
it can generate structures and rudimentary details and shit so most of the labor is done by the editor
But to be fair I ended up using like 3000 commands so if itās anything like that then Iāll be fine, if not Iām fucked
what type of map?
did you know f.e that bethesda did not manually design the world map for skyrim
A map
for example
The terrain was not the map itself
wat
Tats what he means nvm lol
so
learning spigot is mostly googling stuff and knowing what questions to ask
when do i get my island
not that I would ever sell or pay for configuration changes. It's easy to learn yaml and json, but the hard part is the application. like getting a whole custom mythicmobs setup or terra world generation pack, or tens of custom crackshot guns or whatever. you arent paying for the skill, you're paying for the work, balancing, etc
learning programming is mostly about writing bad code and realising why its bad later down the line
I just meant to that one asshole charging $25 for feather board edits lmao
Because thatās the majority of the market
exactly
people who think you can learn how to code with top tier skill in a month
and set themselves time limits and all of that
wont ever get far in programming unless they change their view on it
you just need a high tier xp boost
bro I got a few xp bottles in my trunk
they are like the generic kinds that I can choose what skill to boost
Iām carrying a titanic exp bottle in my sack
I just drink them before I go to sleep and boom I improve overnight
the one with the barbarians and balloons and walls and shit
how would that work in minecraft anyway
if you wanna get started writing plugins you should start with a simple hello world program in java, then do something like a bmi calculator, and then either do some small projects to learn more about OOP concepts and such or give spigot a go and start simple
whichever way you go the most important thing is try to get a sense for when you're doing something wrong, that way you know when to try and find a better way to do it
if code becomes manual labour that's a clear sign that there's likely a better option
Player is always in creative cannot spawn items and spawn in a empty lot with a town hall and goes through a tutorial which underlines how to use a item in their hot bar to build buildings and defence. Then after said tutorial a automated attack happens to show the player why they are building a base, before showing the player hoe to attack (there is an npc you must talk to). Then you learn how to attack (first person raid on another players base where punching buildings damage them deals damage represented by a holographic display health bar. Depending on how much u destroy you get a certain amount of currency) the currency can be used to place and upgrade buildings at your base. Repeat the attacking and upgrading process until max level.
right, first
don't use creative
the protocol around creative mode is horrible and opens up massive gates for exploits
Ok
creative mode servers need to use enermous filter and watchdog plugins that consist of like a million lines and set you back like a hundred bucks just so they don't get nuked
how do you attack with a hoe
do you punch shit
or do you spawn in barbarians or whatever
U spawn in stuff
Should have clarified
One of the buildings letās u choose what troops u bring into attacks
just look at hypixel housing, lmao
Actually only two different attack types, ones who target walls and defences, and ones who attack all so having the mobs who attack them use zombie and add an invisible villager
Inside walls and defences
better to use either paper's pathfinder api or mob goals api
former might be more performant but the latter will probably be simpler to set up
well, let's get started then
mister i want to be a developer
i recommend intellij and maven
how u gonna let people build the buildings
Yeah GUI prolly
now to rewrite slimefun energy networks
And all buildings are the same size (1 tile) so u donāt have to outline size or anything
u could be fancy and do preview stuff and let them move around or smth
you could be extra fancy and use a resourcepack with custom models
models can be of unlimited scale afaik
no
so a single item could be used to display an entire building
block models are limited to 3x3x3
no? sad
Sad
well, it'd need more individual models then
and to use a block model u need to replace a block state
Iāll make a discord rn
just make an armorstand wear an item with a model
though u could use item models
do resourcepacks even support block models?
u do need to replace a block state for a custom model though
theres like 160+ if u replace all mushroom block states
800 with noteblocks
im actually writing a plugin for personal use
since the sound is serverside and they all have the same vanilla texture
So that can't work with other bloclz
would automatically generate the resource pack based on assets in a yaml file
but would be a tad limited
is there a size limit on item models?
that I dont know
Probably max int
not everything is limited to 2.14 million
Sorry me jumping in story
seems to have the same limit as block models
Ah u never know
This is #help-development sir
it says i'm in it but i can't find it in my serbur list
there
god i hate slimefun
Weird lmao
i also hate intellij
so i was renaming a package, right
it got the refactor done, so all of my classes now refer to the new package
but then it blew up with an ioexception and didn't actually rename the package
so now all of my classes are fucked
I donāt think Eclipse would do a better job but might wanna try that one then
imagine handling exceptions
import org.bukkit.event.EventHandler;
import org.bukkit.event.player.PlayerJoinEvent;
import org.bukkit.event.Listener;
public class EventsClass implements Listener {
@EventHandler
public void onjoin(PlayerJoinEvent event) {
player player = event.getPlayer();
player.sendMessage("MESSAGE");
}
}``` so i dont understand but the Player in the last one and the player on above that 1 but just the first 1 right is in red why?
Imagine being named NNYaKNpGms0eUVpiSdHx
is there a way to find if a trident landed?
what do you mean
player is a object of Player class right?
you wrote player
Camel text
you need to write Player
and how do i create a class
you don't
with a capital P
you refer to the Player class
The type of that variable is Player iCalling so it should be
Player player
rather than
player player
ok
And types are based of classes
import org.bukkit.event.EventHandler;
import org.bukkit.event.player.PlayerJoinEvent;
import org.bukkit.event.Listener;
public class EventsClass implements Listener {
@EventHandler
public void onjoin(PlayerJoinEvent event) {
Player player = event.getPlayer();
player.sendMessage("MESSAGE");
}
}```
learn java, basically
also the first player in player.sendMessage("MESSAGE"); is red so do i do a big p?
ok
Bruh learn what camel text is
ive looked at a lot of yt vids
Bad ones then
Camel case*
also when i debug it says "non-static method sendMessage(java.lang.String) cannot be referenced from a static context"
Coded red is a great youtuber for spigot tutorials @quaint mantle
learn java
im trying to add and use multiple configs, the configs copy themselves over to the data folder and have the values i put inside them, but I cant access the config information
ok thanks
He needs to learn java before spigot
he doesn't need spigot tutorials
What are you currently doing?
he needs a "what the fuck is java and what do i do with it" tutorial
sololearn is great for jlearning ava if ur doing by urself
thank you so much guys
to my config?
and sorry for wasting time and sucking at java
Itās fine
But learning java will help you avoid pre beginner mistakes
And that will save everyoneās time
Eclipse nightmare fuel
Yeah or how youāre doing it as of now
kk im going to put it in a pastebin
it does it worse actually
lmao
Oh lol
also is intelij good or bad
intellij is good
just choose any ide you just need to learn java smh my head
yea look up an intro to java course there should be plenty online
For a beginner it doesnāt matter at all which ide
intellij is cool
beginners fuss all over about which ide to start with
Word
Yeah I mean you can always switch later
i literally switched from eclipse to intellig in 1 day
you remember that day Conclure
Best IDE is intelliq
right
I did it after a month lol
I did it after 1-2 years
its codeaccademy good like the course i dont know if you have heard of it but is it good for people who have no clue what they are doing
Idk I mean Eclipse is arguably more ram friendly lol
But thatās like the only positive thing imo
Because it doesnt index shit
I heard good opinions about that website
Eclipse is annoying
Yeah true
alright then il do that then
I mean it has a global project overview
good luck!
I would suggest to use a textual tutorial since that will give you the benefit of going back to older references trivially
alright then
@ivory sleet https://pastebin.com/9Zjy38wA
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.
ohhh god
Ok
- Stop using lombok cause you dont know how to use it
you seem to use it only for static fields lmao idk why
and those fields can be put into some manager class
lol pastebin even lagged for me
lol
š
š³
š«
Sir this is help development
Why is this guy mad sus
It's my favourite one, idk how discord allows it
Okay friend what were you trying to do now again
my configs load and copied into my data folder, but i cant access the values
- Stop using lombox
fixed for you
You know i would say that
but then like 100 people
would go after me and get pissed
lmao
xd
yo wtf
@Getter @Setter private static File spawnFile;
@Getter @Setter private static FileConfiguration spawnConfig;
@Getter private static File messagesFile;
@Getter private static FileConfiguration messagesConfig;
@Getter @Setter private static File queueFile;
@Getter @Setter private static FileConfiguration queueConfig;
@Getter private static File scoreboardFile;
@Getter private static FileConfiguration scoreboardConfig;
@Getter private static File serverSelectorFile;
@Getter private static FileConfiguration serverSelectorConfig;
@Getter public static List<Player> buildPlayers = new ArrayList<>();
public void loadConfig() throws IOException {
messagesFile = new File(getInstance().getDataFolder(), "messages.yml");
messagesConfig = YamlConfiguration.loadConfiguration(messagesFile);
scoreboardFile = new File(getInstance().getDataFolder(), "scoreboard.yml");
scoreboardConfig = YamlConfiguration.loadConfiguration(scoreboardFile);
serverSelectorFile = new File(getInstance().getDataFolder(), "server-selector.yml");
serverSelectorConfig = YamlConfiguration.loadConfiguration(serverSelectorFile);
getConfig().options().copyDefaults(true);
messagesConfig.options().copyDefaults(true);
scoreboardConfig.options().copyDefaults(true);
serverSelectorConfig.options().copyDefaults(true);
saveConfig();
saveResource("messages.yml", false);
saveResource("scoreboard.yml", false);
saveResource("server-selector.yml", false);
}
MY EYES!!!!
lol
what do i do tho
at that point just use skript
it cant get any worse than that
fr tho?
poor guy he just wanted to help lmao
so idk why I get null values when i try to get them from the config?
oh no heres the help, learn java and came back after
oh im sorry that was a question
i didint read the edit
hahaha
i mean if it works it works
but it doesnt š
but you might wanna check some tutorials clean it up
ahh
lmao
im sorry
yea maybe you dont have enough experience
or should start with something simple?
how long have you been codign for?
so it copies the configs into the data folder with the values i put in, but whenever i do something like myConfig.getString("scoreboard-title") it doesn't work
show the config.yml
You also have to saveConfig() any time you make a change that needs to be written to disk
did you add it to the config.yml in the resources folder?
oh hi choco
use this
its not always good to just use resources made by others but you can look at how this class works
Well, I'd almost chalk it up to the fact that you're calling loadConfiguration() before you're saving the file
You probably want to saveResource() before you loadConfiguration()
would theoretically work on the second run, but on first run it won't
kk ill try that
Damn thatās a lot of contributions
sheesh
choco make a tutorial on how to be you
Just wake up and program. 'tis my life
sounds like a good life to me
@worldly ingot where do u get the motivation to finish ur projects
lmao you think I finish my projects
I'm extremely bad at that
same
hahahah
I have like tens of projects just sitting in recents
Source:
<#general message>
@kindred dust always makes fun of me for it
dont worry
š„²
i never finish my projects
its because the motivation is gone and you already have what you want so its not new anymore
and now you have 1 idea
and 1 unifnished proyect
its really a catch all
I avoid project disbanding by starting small
does the on inventory close event trigger when the player leaves the game with an inventory open?
Hello, I'm trying to set a string in a custom yml and it keeps showing like this any help thanks
context?
isnt that expected behavior?
^ lmao
lol
no
It is
what do you think its supposed to do
the dots separate between the categories
because thats doing what its meant to do
this bit ain't in "ENTER-YOUR-LICENSE-KEY"
yeah
its not necesary
only for certain situations
It won't read it otherwise
^
It shows errors
and also if you really wanted to you can escape the quotations
but you shouldnt have to
two sec
like do that
java.lang.NullPointerException: null at java.util.regex.Matcher.appendReplacement(Unknown Source) ~[?:1.8.0_291] at java.util.regex.Matcher.replaceAll(Unknown Source) ~[?:1.8.0_291] at java.lang.String.replaceAll(Unknown Source) ~[?:1.8.0_291] at net.milkbowl.vault.Utils.ULicense.requestServer(ULicense.java:72) ~[?:?] at net.milkbowl.vault.Utils.ULicense.isValid(ULicense.java:150) ~[?:?] at net.milkbowl.vault.Utils.ULicense.verify(ULicense.java:42) ~[?:?] at net.milkbowl.vault.Vault$1.run(Vault.java:106) ~[?:?] at org.bukkit.craftbukkit.v1_16_R3.scheduler.CraftTask.run(CraftTask.java:100) ~[patched_1.16.5.jar:git-Paper-753] at org.bukkit.craftbukkit.v1_16_R3.scheduler.CraftAsyncTask.run(CraftAsyncTask.java:54) ~[patched_1.16.5.jar:git-Paper-753] at com.destroystokyo.paper.ServerSchedulerReportingWrapper.run(ServerSchedulerReportingWrapper.java:22) ~[patched_1.16.5.jar:git-Paper-753] at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) ~[?:1.8.0_291] at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) ~[?:1.8.0_291] at java.lang.Thread.run(Unknown Source) [?:1.8.0_291] ```
LMAO
do you even see anything in there that says "yaml"
yes it is because if I put quotations around it, the error gose away.
That means how you are retreiving the value is incorrect
it's erroring because ENTER-YOUR-LICENSE-KEY isnt a valid license key probably
and anyways that too probably
Okay never mind my bad.
Lmfao
Is it even worth making plugins for 1.8 anymore or should I just start making them for 1.12 +?
1.13+*
make them for 1.13+
ok thanks
So I want to have a cow with a name to do something else when milked - should I use the EntityInteract event or what?
Yes
persistent data containers š not gonna deal with that
name tag š not gonna deal with that
I have got a doubt, Does Minecraft generate a UUID algorithm based or do they generate UUIDs according to their database?
ExampleSword:
Material: STONE_SWORD
DisplayName: '&a&lExample Sword'
DiamondSword:
Material: DIAMOND_SWORD
DisplayName: '&a&lDiamond Sword'
``` Lets say I have this in my config file. How would I loop through this and get the names of all the catagories? In this case I would want to get "ExampleSword" and "DiamondSword"
UUID are universally unique - it's in the java UUID package
getConfig().getKeys(false)
i think
or getConfig().getRoot().getKeys(false) if that doesnt work
I'm trying to set the block data tag on spawners in order to save the mob type and stuff, and it works fine when I place them in creative, but when I'm in survival the spawner just places as a pig anyway. Any clue how I can fix this?
This is supposed to cancel the breaking of specific blocks
but it doesnt work, i dont get any errors.
you need breaks on each case
it runs through them all and then runs the default always
.getConfig().getConfigurationSection(section).getKeys(false)
I'm attempting to set the block state manually on the place event, the issue with this is that I can't seem to find the correct way to set the state directly, only modify the one on the block. How can I take this BlockState from the item and set an actual block to that?
BlockStateMeta
I have that BlockStateMeta from an item I created earlier, the issue is that I need to set a block in the world to the state saved there
Is there a way to get the block that the item dropped on?
getLocation.getBlock.getRelative(DOWN) or something like that
nah i figured it out
i just need to figure out why some of the items get lost
Hey guys, so I created a GUI, showed it to player, but now I want them to be unable to take/put stuff in the inventory, I guess I have to use the InventoryClickEvent but how can I know if the items they putted/took is on my GUI and not another plugin's GUI
check if the inventory name is your gui name
Alright thanks
.
wait i didnt update it on my server
oh my gawd
i updated the plugin
the items get duped
instead of getting lost
PDS?
presistent data something I forgot
.
the thing that stores data in NBT
only way would be to make two clones and clear the PDC on each
?paste
how do I clear PDC
there is PDC#getKeys
one it clean without PDC so it's not that complicated fortunatly
Anyone can help me:
https://paste.md-5.net/xolejeriro.makefile
It looks like that the GUI Name isn't the same as my "official" GUI name but it is
Okay thanks again
And btw, how can we know if the click is because he took an items, of if it's because he putted an item
can anyone look at my case?
that returns a InventoryAction
you can read up the javaDocs on that one
where does playItem come from
@quaint mantle
its a hashmap
i were expecting to get stone when cobblestone was thrown into fire, but i didnt get the exact amount. when i insert a stack of cobblestone i get extra 4 stones.
the dupe amount changes
How can we know in which slot the Item was picked in InventoryClickEvent
when i throw it continously
Wym
like adding Bukkit,getLogger.info(String.valueof(item.getItemStavk.getAmount));
inside the second if
typo
but this would tell you how much item is given to the player
everytime something combusts
since youre spamming q it should always be 1
if any result has more than that, there's your problem
when you throw a single stack of 64 cobble into the fire and it burns, you only get one back?
so as a result you get less than 64
Yep
hmm
ok first
Im pretty sure Item's have .getThrower
that returns UUID
so you can just do Bukkit.getPlayer(Item.getThrower)
instead of hashmap
since some items get stack so some never get removed and that would build up
oh no ElgarL is here did I say smth wrong
If you are talking about players dropping items, it would probably be the PlayerDropItemEvent, which has a getPlayer
he's tryna get the owner of the item that's combusting
or the thrower rather
he's currently adding player to hashmap when they throw items and getting then in EntityCombustEvent
if you set the player in the Items meta in the PlayerDropItemEvent they will only combine with items with the same meta.
you can then retrieve the meta in the combust
btw i am using 1.12.2
items have meta in 1.12
in the PlayerDropItemEvent you get the player, put their UUID into the item meta
yeah I was thinking of that
since that's better than hashmapping
as it wouldn't leave some entries
oh also ElgarL, how does one clear PDC from an ItemStack
for loop over keys
ah frick
write your own isSimilar method
I was thinking a StripePDC method
The issue being its possible not all keys are yours
nah it's fine no other plugins are gonna touch these items
probably
Ill deal with it when I get to it ig
If you are only interested in your keys java for (NamespacedKey key : container.getKeys()) { if (key.getNamespace().equalsIgnoreCase(plugin.getName())) {
but the key doesn't necessarily have the same name with the plugin right
what if I want to have modules and different namespacedkey for each
You should always be providing a plugin reference, then identifying your key in key.getKey()
Im confused
key.getNamespace() = your plugin name. key.getKey() = the string you gave the key.
so when I create this NamespacedKey, I did new NamespacedKey(Main,"String")
that's fine right
yes
assuming Main refers to an instance of your main class, yes
yes
but Main is not a valid variable name
yeah it's lower case
final Main main
public Class(Main main)
this.main = main
you get the point
Main is also not a very good main class name
well
I have inventory 1 which opens with the command. This inventory 1 has several buttons that, when pressed, open inventory 2, 3 .... How can I make sure that when I click on a slot (for example, slot 0) in inventory 2, 3 ... the same action that is in inventory 1 is not played?
You compare the getView().getTopInventory() with the instance of the currently open Inventory.
turrets?
pew pew
Translation error?
instead of learning java I'd recommend learning english this time
yeah we're not crackshot support
ask the crackshot people
sorry im new on the server
How did you get the class that you can;t get the type?
this is also not a development issue so you're in the wrong channel to begin with
where is the channel for the crackshot
public ItemStack StripePDC(ItemStack item)
{
if(item.hasItemMeta())
{
PersistentDataContainer container = item.getItemMeta().getPersistentDataContainer();
for (NamespacedKey key : container.getKeys()) {
container.remove(key);
}
}
return item;
}
yep, but remove the e from the method name. It shoudl be Strip not Stripe
You need to setItemMeta
oh right
^
Cause getItemMeta is a clone
consider making the method accept an ItemMeta instance rather than ItemStack
that way you're not forced to clone a new itemmeta just to use this method
.getPersistentDataContainer doesn't get a clone right
no
but how did you get the class
surely you can get the type from wherever you got the class
The returned Entity of the spawn method has a getType()
yes, that is what he is describing
public ItemStack StripPDC(ItemStack stack)
{
if(stack.hasItemMeta())
{
ItemMeta Meta = stack.getItemMeta();
PersistentDataContainer container = Meta.getPersistentDataContainer();
for (NamespacedKey key : container.getKeys()) {
container.remove(key);
}
stack.setItemMeta(Meta);
}
return stack;
}
now?
what
iterate over the entitytype enum and check getEntityClass().isAssignableFrom(clazz)
but there is probably a better way
that involves finding it from wherever you found the class
Why is he trying to get the EntityType from the class? If he's spawning it it returns an Entity you can call getType() on.
You can get the corresponding entity class from the EntityType
Can I somehow get the Material of the Block in the EntityChangeBlockEvent when the Block changes from falling to normal?
Because I tried and I only get Air or Grass if the Block lands on Grass...
but I don't think there's an inbuilt way to get the reverse
getBlock returns the old block and getTo returns the material that its going to change to
oh okay thank you
consequently, you can get the "old" material from getBlock and the new material from getTo
declaration: package: org.bukkit.event.entity, class: EntityChangeBlockEvent
someone knows how I can stop a parrot from moving up and down with NMS?
I tried to override the onTick method and generating a new vector for the navigation but it still follow the default's movements
Since it's NMS you're pretty much on your own. You'll have to dig around the source and override the pathfinding
Can I somehow change the Block after it changed in the EntityChangeBlockEvent because I tried: event.getBlock().setType(...) but it didnt do anything
Ok
So i have a bit of a problem
My plugin depends on a library which is very large
e.g 120MB
What should i do?
is that vehicle plugin yours
the output is >130MB
jeff maybe download it at runtime if u dont want to shade
oh well do you like remove the entity async or something?
Hmmm, how does that work?
I mean you could wrap that with a try catch
ill have a look š
Can I somehow change the Block after it changed in the EntityChangeBlockEvent because I tried: event.getBlock().setType(...) but it didnt do anything
is that the event when an enderman is stealing the block?
Can I see and change the contents of an offline player's ender chest?
uuid
No it gets called when gravel changes from falling into solid block
This one
Ait I got a BlockBreak Event for when chests are broken but one of my things doesn't work unless I use static and I am trying to not use that.
ArenaManager class
public static List<String> testerConfiguration = new ArrayList<>();
public static List<String> chestConfiguration = new ArrayList<>();
private final ArenaConfig arenaConfig;
public ArenaManager(ArenaConfig arenaConfig, TIMV game) {
this.arenaConfig = arenaConfig;
}
BlockBreak Event class: https://paste.md-5.net/ijotoqexuw.cs
Main class for block break event:
pm.registerEvents(new BlockBreak(this, this.arenaManager), this);
Console error: https://paste.md-5.net/sihapepado.bash (line 27: arenaManager.setChestLocation(event.getPlayer(), event.getBlock().getLocation());)
Found out that setChestLocation is not the issue because it can't even be called? Something must be wrong with the BlockBreak event class (arenaManager.setChestLocation(event.getPlayer(), event.getBlock().getLocation());)
pls someone help me I cant find a solution
Get the location of the block?
Try delaying it a tick
How can I delay it
does not work
Use a runnable
okay will tray it thank yo
^^
it is >:(
whats in your setChestLocation method?
and what is "this.arenaManager"?
where do you declare it?
private final ArenaManager arenaManager;
public BlockBreak(TIMV pl, ArenaManager arenaManager) {
super(pl);
this.arenaManager = arenaManager;
}```
i mean this one sorry new BlockBreak(this, **this.arenaManager**)
You mean how I like enable the event
cuz none of that is the issue, it all works but when I use it in a constructor, it doesnt
where you instantiate your arenaManager
you have a nullpointer
and i am trying to figure out where
and because i don't think its the player and neither the block, it have to be either the method setChestLocation or your arenaManager^^
private ArenaManager arenaManager;
@Override
public void onEnable() {
this.saveDefaultConfig();
ArenaConfig.setup();
registerListeners();
ArenaConfig arenaConfig = new ArenaConfig();
this.arenaManager = new ArenaManager(arenaConfig);
}```
setChestLocation ^
trying to make it so that a server operator can save the world using /save-world, and then they can do /reset-world to move the world back to the latest save
Player p = (Player) sender;
World savedWorld = WorldResetterPlugin.getInstance().savedWorld;
World pW = p.getWorld();
WorldResetterPlugin.getInstance().getServer().unloadWorld(pW, false);
pW.getWorldFolder().delete();
WorldCreator wc = new WorldCreator("world");
wc.copy(savedWorld);
WorldResetterPlugin.getInstance().getServer().createWorld(wc);
p.sendMessage(ChatColor.AQUA + "Done.");
return true;
but this doesn't have any input for some reason
no error no input
for what is your super call in your event @quaint mantle
your arenaManager is null. maybe your super(pl) blocks it
Maybe, not quite sure but how would I go on to fix that tho? I do need the super(pl) and I need the constructor to get arenaManager
if I wanna make a custom inventory, is the proper way to make my own class implementing the Inventory interface?
why do you need the super?
more like implementing InventoryHolder
I wanna do
Player.openInventory(customInventory), why would I need to implement InventoryHolder for that?
Looks like the super is not the issue. Tried it and got the same problem https://paste.md-5.net/ihebexabac.cs (arenaManager.setChestLocation(event.getPlayer(), event.getBlock().getLocation());)
trying to make it so that a server operator can save the world using /save-world, and then they can do /reset-world to move the world back to the latest save
but this doesn't have any input for some reason
no error no input
Player p = (Player) sender;
World savedWorld = WorldResetterPlugin.getInstance().savedWorld;
World pW = p.getWorld();
WorldResetterPlugin.getInstance().getServer().unloadWorld(pW, false);
pW.getWorldFolder().delete();
WorldCreator wc = new WorldCreator("world1234");
wc.copy(savedWorld);
World newWorld = WorldResetterPlugin.getInstance().getServer().createWorld(wc);
double pX = p.getLocation().getX();
double pY = p.getLocation().getY();
double pZ = p.getLocation().getZ();
Location loc = new Location(newWorld,pX,pY,pZ);
p.teleport(loc);
p.sendMessage(ChatColor.AQUA + "Done.");
return true;
The proper way is to store the inventory view returned from openInventory and use that to compare
to compare with what? I thought if I do openInventory the game is just gonna call the methods defined in Inventory on the passed object
To compare against the view in the various inventory events
You arenāt meant to implement bukkit interfaces
how do I have something run on a per-player timer
getServer().getScheduler().scheduleSyncRepeatingTask() is for global, how do I have something run per-player
Its a timer, you do whatever you want inside it
hashmap with uuid and integer for the task id
nullcheck your arenamanager
so
getServer().getScheduler().scheduleSyncRepeatingTask()
and use hashmap?
per player and every like how long
I sound like it's really inefficient
Im trying to recreate natural regeneration
you have to assign the schedulertask to your integer and store it afterwards in the hashmap with the uuid of the player
but you could also just do one general task and for-loop through every online player
regeneration, as in Health?
yes
run a repeating timer with whatever interval you want, then when any player is injured you add them to a set.
your repeating task loops over teh set and heals each player in it a little. If they are fully healed you remove them
yeah but for exmaple
I set the timer to be 20seconds
there's no different between joining and waiting for 20secs and joining right before the 20th second
I dont think that's how natural regen was suppose to work?
then add a timer till next regen, so a map, UUID, Long
so in main create a per tick task
your timer loop runs every 5 ticks, and checks any players in the map time against the curren time
but there will be thing that changes the player's max health
and that doesn't involve damaging?
Want to sign my petition, itās the āPetition to Put Down my Grandmaā.
You know I always hear her yelling like āwhy is their rat poison in my soup!ā, and āwhere is my medicine!ā. It really annoys me! So please sign to debilitate said annoyance.
What? You were talking about regen, nothing about max health
in that case you are going to have to check every player every x number of ticks
if they are not at max set a time on them to begin regen
+1 ticker each tick for each player and when it's a multiple of X reset and regen yes?
how?
every loop of your timer you loop over all players (if not already in the Map, check their health/max health, if they have room ad them to the Map against LocalDateTime.Now() + 20 seconds
oh like actual seconds
after that check is done for all players, you loop the Map and anyone who's stored time is less than Now() you heal
Just use System.currentTimeMillis()
why is that preferred over the ticker method
you are not changing anything just checking a value against the system clock
this way their regen will be "faster" is the server is lagging right
relative to the server
Neither way will be "faster" its time based
if the server is running at 10tps they would regen every 10seconds from the server's prespective tho?
And its server side, so you only heal when the server tells you to
since real world time doesn't lag with TPS?
Correct
and that's not ideal?
I wouldn't want players to regen faster if the server is lagging
You woudl still only heal at teh rate the server runs
as the time is only the counter for when to start healing
ok so a player takes damage on 1900/1/1 00:00
they would be healed on 00:20
suppose the server got a huge lagspike
depends if yoru timer runs every tick or every 5
and the next tick was on 00:25
if there is a lag spike yoru heals woudl catch up when the server catches up
then they would health after one server tick
lag = no server operation
yeah
so if the mobs and stuff aren't hitting player but they are regening
that wouldn't be good right
Why not, you can only tell it to heal when the server says heal.
You can;t control lag
but if I use the ticker method
the regen lags with the mobs
wouldn't that be preferred?
You will still only heal at the speed of the server TPS, in both instances. You don't miss or get any extra heals
if the server is running at 10TPS, it would health players 40 seconds since they got damaged
and if I use the time method they get healed 20 seconds later
but in that 20 seconds, mobs are attacking at half the speed since the TPS is 10
yes, a timed method woudl result in healing startign as close to 20 seconds as you can, a ticker woudl be slower depending on the TPS
so a ticker is preferred right
no
If you want it 20 seconds, then a timed. If you want it in ticks then a counter
the player is about to die
and ticker is still ticking down from 400ticks but we experienced a lagspike and the server lagged for 20 seconds
with the timer they would get healed and survive
with the ticker it only passed 1 tick and wouldn't heal
which is what's suppose to happen no?
in general try to keep very game based things based on ticks
but say for instance you have a shop that resets every hour, use a scheduled executor service for that.
or else it would be like if the player can speed up/slow down time
==========================================
ok lemme think about this
Player is fighting a mob with a tiny amount of health left
they will get healed in 20seconds
but the mob is going to hit the player and kill them
He is correct. If you want it all in sync with the server ticks you should use a counter.
just base it off ticks. it makes more sense.
that's what I was saying
You asked for 20 seconds not ticks therefore you'd so with a timer
the bigger problem here is probs a server freezing for 20 seconds
I should've said just 400ticks frick man
Well, seconds and ticks are different things. Be precise š
when i developed battlepass we managed to use ticks for timings daily quest resets for like 18 months before we got any complaints
then we realised we should probs change it
since generally you dont base things in the server on real like times
Yeah low tick servers getting daily rewards every 48 hours is not good.
Wow I just realized the problem
yh someone came to us with that issue lol
Iāve been using ticks for real time stuff this whole time
bruh
Towny had the same issue with newDay
you dont notice it really unless you start losing a lot of ticks
So whatās the alternative
ScheduledExecutorService is the best way