#help-archived
1 messages ยท Page 96 of 1
but secretly deleinting it
and making a new one completly with a new name!
i mean with it's oldd name
so you don't want to keep the one that was there at all? not even the image in your plugin directory?
It seems to me that you plugin should be able to download a remote file, maybe add that to AnimatedFrames.
If you've got that working, then you just need to tie your plugin into AnimatedFrames.
That way you can interact with FrameManager
yeah, I'm just trying to figure out if you can even do that
turning right by turning left
because the functionality is already in place
Don't reply to me frost because ik your busy...
TextComponent message = new TextComponent( "Click me" );
message.setClickEvent( new ClickEvent( ClickEvent.Action.OPEN_URL, "https://www.spigotmc.org" ) );
message.setHoverEvent( new HoverEvent( HoverEvent.Action.SHOW_TEXT, new ComponentBuilder( "Visit the Spigot website!" ).create() ) );
return true;``` This doesn't output anything when I do the command
so
did you send the output?
im forcing the player to type out the command
you create the TextComponent but I don't see anything that sends it to the player (p)
๐
sorry, helping myself right now
Thats fine!
me?
no y?
well the things you consider
?
that not my question to answer but i dunno
liek this p.sendMessage(ChatColor.AQUA+" Hey " + p.getName() + ", here is our social media!");
just imangine blue text
thing is I had that and the text I sent before, but the output wasn't a hover event
yes?
wait nvm
lol
hey what happend to frost?
its because they're tired of idiots like me
no,
sorry, helping myself right now
xd
Are you using maven or gradle to build your plugin?
i personally would use maven
me?
but
H311
yeah?
I meant your plugin
have you already included AnimatedFrames as a dependency?
you want to add AnimatedFrames, and then in your plugin's onEnable, check to see that it's loaded and then access it
hmm ok
because you'll then be able to access it's FrameManager
which is what handles changing/creating frames
then it's just a matter of creating your own command to find the frame you want to update
and replace it with the new source
what's the point of replace then? if it doesn't target a specific frame?
well your right
but
i want to transport what i said to the other commands
to make a new one
it will take the name of the image then remove it
as long as you include AnimatedFrames as a dependency, and it's loaded for your plugin to use, you should be able to tie into it's code
then it will take the new url and same name a put it into the creat commmand
Make adjustments via the FrameManager class that it provides
my friend
just look at the code for its commands
i can make the player say what i want him/her to say
with player.chat
if i want it to dispense both commands it will
you can use events
player issues a command, create a new, custom event, with properties for the information you want to share
i need to transport the commands contents that i gave it
or just schedule it in the command
right, that's what you do with your custom event
whatever things you need to transfer
how do i make one
https://bukkit.gamepedia.com/Event_API_Reference
Creating Custom Events, just over half way down the page
ok i'll check this brb
Anyhow, I have to go, good luck ๐
oh ๐ฆ
cya
but thank you for the help
no problem, just work at it, I'm sure you'll figure it out in steps.
Anyone know how click/hover events work, I can't figure it out
I do not knwo this
np
I can't ask more than what you know
yeah your right fo sure
if you want i can suggest a discord channel you cna join for more help
I shall chill in MC until I get tagged for help
sure!
for just general plugin development
yeah
yes please!
Why can no one access my server?
Hey, does someone know how i can chang the number of Hoppers can be used on a Skyblock Island?
(IridiumSkyblock)
I do found out someting about a Config.json file (https://github.com/IridiumLLC/IridiumSkyblock/wiki/FAQ)
But i dont finde the file :c
Wouldn't Block#getRelative result in null if the relative block is air? Or is an air block handled as any other blocks?
Jds says it's a non null method.
will be air yea
hmm that's intressting as other stuff in the api handles air related material as null on getters.
when i try to go in the website it says bad gateway
@worldly horizon it's in the config.json
yea i know and i finally found it but i can open it
now
there is something written like "try to contact the admin of that file or the system adminestrator....
you should join the iridiumskyblock discord
i am already they cant really help me :c
oof
yy
I'm trying to implement a hoverEvent, but can't. I copied the spigot example one and that didn't work. If I send the code, do you think you could tell me where I'm going wrong?
Think i got it rn :3
damn
I dont really think i can help y sorry that Iridium Plugin is the first one I ever interacted with but good luck ๐
Is there a way to replace all default mobs in your world with your custom one?
np
gg
๐
I was reading a tutorial on how to make custom entities on 1.13.2
Somehow the NMS changed and I can't seem to figure how to "get the world version"
More specifically here
so i keep getting a null pointer exception on this
this.getCommand("skills").setExecutor(new CoreCommand(this));
^^ thats the class that is the executor
^^Thats the error
main: me.joseph.hexion.hexioncore.HexionCore
version: 1.0
commands:
skills:```
thats my plugin.yml
Somehow the NMS changed
Fun fact. NMS changes every version. That's why the Bukkit API exists. To prevent plugin breakages. Vanilla code is volatile and ever-changing
thats my plugin.yml
That's your whole plugin.yml?
yeah i just started this plugin
hey guys, wanted to ask you something in theory. When having a game (for example SG), when is it the smartest to update the MySQL database async? Instantly after the kill? Cache it and update it at the end?
since that is something I'm not really sure about what the smartest way is to do
Is there a Spanish helper?
how do I name several aliases?
like atm I can only add one like this "[social]"
but I also want to add socials
@warm carbon after the kill
- data is saved instantly so doesnt matter if server crashes later
- updated data instantly accessible by other applications / servers
- you're dealing with such a tiny, tiny, tiny amount of queries, batch requests will have 0 performance impact
@silk gate awesome, thanks for your reply man!
๐
another question, it is a long time since I used mysql. Do you save UUID's by VARCHAR, if so which length? I assume you save the uuid with uuid.toString() then, right? @silk gate
Why can no one access my server? :c
@warm carbon yeah unfortunately with mysql you dont have a native uuid type unlike postgres
you have 2 options
- simple option, uses more bytes - varchar(36)
- store the uuid as a 128 bit int
mysql has some helper functions
@silk gate do you know why im getting the error
why are you asking me
thanks fam @silk gate
idk u seem smart
thanks
but I'm new to java programming, I've searched online but it looks so simple that noone bothers to answer it
@mild gazelle uh make sure your plugin.yml is included in the jar
yeah
How would I change the speed of a zombie? [1.8.8]
por favor
so what event do i need to check if a player wants to interact with a horse? because i want that only players who own a horse can interact with their horse and ride it and not others
.
Hey guys, there is a /msg /tell functionnality with spigot ? Because i can use it but i have no chat plugin, its normal ?
afaik vanilla supplies you with /tell
AND NO /MSG ,
No
any reason as to why this isn't working? ``` public void gui (InventoryClickEvent event) {
final Player player = (Player) event.getWhoClicked();
final Inventory inv = createGUI(player);
if (!Arrays.equals(event.getInventory().getContents(), inv.getContents())) return;
event.setCancelled(true);
}```
So it cant be that
the event isn't being canceled
how can i find where that /msg come ?
Well no knowledge for that
That is a seriously poor way to handle GUIs
really?
Make use of the InventoryView
Yea, you're creating an inventory every single time you want to check if it's your GUI, then you're comparing every single item within it
I'll check out InventoryView, thanks
openInventory() will return an InventoryView and all inventory events will have a getView(). They should be == comparable
but I will have to cycle through and check?
Or map from players to inventory views, whatever. Yea
should I just check the title?
how do I add several aliases? ATM I can only add one like this "[social]" but I also want to add socials
Titles are not well defined in inventories and should not be relied upon
https://timings.aikar.co/?id=63641258ff0c43f788129b9f0d992d65 Anyone know what may be causing lag on my server? What plugin or thing would be causing tps to dip super low randomly?
go to paper help lol
would this work? event.getView().equals(inv) (or is that very inefficient)
oh like in a map? (thats what you said earlier xD)
Map, Set, yea whatever
thanks
I would say use a HashSet or something so you can quickly do referencedInventoryViews.contains(event.getView())
oh okay
InventoryView then has getPlayer()
I was thinking player.openInventory(createGUI(player)); player.getOpenInventory() then checking the view
player.openInventory(createGUI(player)); quite literally returns an InventoryView
InventoryView view = player.openInventory(createGUI(player));
Add that view to a HashSet or something, work from that
When the inventory closes, remove it
thanks a lot! Now I don't have to check every item lol

Handling inventories is a lot easier than people think. But instead we have people going about implementing InventoryHolder like they shouldn't
thats me ๐
eclipse told me to implement it so I blindly followed
always use your brain before trusting an ide
Kept getting the same error no matter what I did
Spending hours with a friend only to realize it's not the code it's the jar we used in the build path and server
No
Do not do that
It's an illegal mirror
BuildTools works just fine for tens of thousands of other people. If something's broken, it's your fault not BuildTools'
oh the get bukkit thingy?
And it works just fine for me except when I want an srmor stand to spawn ๐
java.lang.Error: Unresolved compilation problem:
EntityEquipment cannot be resolved or is not a field
This implies your plugin is not compiled properly
What part of illegal mirror did you not understand? lol
Rofl this guy "your plugin works completely fine except when using latest buildtools jar it must be his fault"
Explain what compilation error is there?
public interface EntityEquipment extends LivingEntity {
}```
The fuck is this?
You're extending Bukkit
idiot lol
That's not how this works
lmao
So yes. This guy is right, you're being a dumbass
It IS your plugin's fault
Do not use illegal mirrors. Use BuildTools and write your code properly
"Hey guy some methods were changed in the latest update and here's how it works now"
"Fuck you you're stupid, fuck you idiot, fuck anyone who tries to learn plugin development I'mma just be toxic and deter people from learning coding or coming here for support"
Bukkit has never been extendable
Never
If you want to use EntityEquipment, you don't re-define it and give it a new definition in your code. You import from Bukkit's EntityEquipment
https://hub.spigotmc.org/javadocs/bukkit/org/bukkit/inventory/EntityEquipment.html
If you're extending anything from Bukkit that isn't explicitly declared as extendable, you're doing it wrong
so is there any plugins that i can make 1.8-1.14 players join my 1.15.2 server
(bungeecord)
so i tried to use viaversion
That line of code was added last second as we were trying different things that worked. EVEN WITH that line removed you get the same error
Why are we getting entityequipment errors when all we are doing is making an armor stand entity spawn at a location?
ONLY having this issue with the latest build tools jar
Not the other 1.15.2 spigot jar
That stacktrace you sent can only be caused by what you sent above
That stack trace is from last night
That line of code was added 4 hours ago
So no it's not only caused by it
totally my guy lol
Give me 5 minutes
Then show the code you had from last night that caused the stack trace.
This is the code that caused it
All I'm trying to do is make an armor stand in a specific location
It works on an older 1.15.2 jar but on the latest one through build tools it throws entityequipment errors
About to double check the code as well.
So yet again, I go back to you doing something you shouldn't
Danny the error seemed to come from that equipement method
sigh
I also second that because the code you sent that you claim threw that error states that the error was thrown on a closing bracket
lol
I also third that
ยฏ_(ใ)_/ยฏ
Also @gaunt thorn some helpful tips while programming: https://www.spigotmc.org/threads/beginner-programming-mistakes-and-why-youre-making-them.278876/
BuildTools has been working for 5 years now
If you genuinely believe there's a bug in the server (which there doesn't seem to be, neither Solo nor I can replicate your issue), create an issue on the jira
?jira
Though as far as I can tell, you're misusing the API and blaming it on BuildTools
We do not condone the use of illegal mirrors and we will not allow them to be linked here or on the forums because it's distribution of Mojang's proprietary code
It's a violation of the EULA. BuildTools is Spigot's legal workaround to ensure that it is not being broken
Do whatever you want to do, but do not encourage others to use it. Use mirrored builds at your own risk, though we advise the use of BuildTools
if i copy a player's inventory
do all items get copied too ?
just wondering is this a good way to check if I should cancel shift click? public void preventShiftgui (InventoryMoveItemEvent event) { if ( ((Player)event.getSource().getHolder()).getOpenInventory() != Main.openGUI.get(((Player)event.getSource().getHolder()).getName()) ) return; event.setCancelled(true); }
I need help with a thing, Im kinda dumb and the person that can help me only knows c++ and csharp
how do I loop this 'arraylist'
public void onPlayerChat(AsyncPlayerChatEvent e) {
ArrayList<String> words = new ArrayList<String>();
words.add("9b9t");
words.add("l2x9");
words.add("scratchem");
words.add("scratchem-as");
words.add("dementeranarchy");
words.add("virginanarchy");
words.add("earthanarchy");
words.add("10b10t");
words.add("66.55.158.15");
words.add("orbis");
words.add("2Cry2Baby");
words.add("alt169");
words.add("AltCraft");
words.add("altcraft");
words.add("sorryanarchy");
words.add("quaggacraft");
words.add("abx4");
words.add("infernoberry");
words.add("6b0t");
words.add("solvenda");
words.add("7b7t");
words.add("anarchy.bar");
words.add("anarchy,bar");
words.add("anarchy-mc");
words.add("minetexas");
e.setCancelled(true); {
}
}
}```
ignore the e.setCancelled
My intent was to try to help, I will admit I did not know "GB" was an illegal mirror there was no malicious intent there and I do apologize for that. Secondly, after re-downloading the buildtools package the spigot jar file there works and plugin runs fine.
The culprit is I'm assuming when the packages were downloading it got interrupted somehow and I was using a faulty jar file as when I try to use the one I previously downloaded it gives me that error with nothing changed. (Just tested it)
It's not always someone using it wrong.
I am using spigot?
@agile girder
for (Object o : Iterable<Object> io) {
o.clone();
}
for (int i = 0; i < Collection<Object> co.size(); i++) {
co.get(i).clone();
}
or Iterable<E>#forEach
Stream<E>#forEach
Stream can be obtained through Stream.of(T...) or Stream.of(T[])
You also get an ArrayList by Arrays.asList(T...)
So you could actually do something like this
Stream.of("rabbit",
"bunny",
"snowman").forEach(str -> {
System.out.println(str);
}```
Sorry I'm dumb, where do I add that?
//EventHandler
Stream<String> stream = Stream.of("9b9t", "das" /*more strings*/);
//reference "stream" and loop through it
stream.forEach(str /*str is our reference when iterating over the stream*/-> {
//do stuff with "str"
}
e.setCancelled(true);
I mean you could just do this as well:
for (String word : words) {
//"word" is now our reference when iterating over the list
}```
for some odd reason this doesn't seem to work ``` public void gui (InventoryClickEvent event) {
final Player player = (Player) event.getWhoClicked();
if (event.getView() != Main.openGUI.get(player.getName())) return;
event.setCancelled(true);
}Note: I open my inventory using public void openInventory(final Player player) {
InventoryView view = player.openInventory(createGUI(player));
Main.openGUI.put(player.getName(), view);
}
```
I mean encapsulate a class with an inventory and inventoryview?
thats my code for that class
Yea that listener doesn't seem to be registered anywhere
xD
fierceeo is openGui a static map?
yes
sorry, but whats dependency injection?
Look up Guice
class Main extends JavaPlugin {
private Map<Player, Integer>;
@Override public void onEnable() {
map = new HashMap<>();
new EventListener(this);
}
public Map<Player, Integer> getMap() {
return map;
}
}
class EventListener implements Listener {
private final Main main;
public EventListener(Main instance) {
this.main = instance;
}
@EventHandler public void onJoin(PlayerJoinEvent e) {
main.getMap().put(e.getPlayer(), 0);
}
}```
Guice is little overkill?
But it will give an idea of how dependency injection works
yeah tru
But for this case yeah it's overkill
is it an overkill?
Some if the lib from guice are in my opinion
It's like cutting butter with a chainsaw
fierceeo but dependency injection is when we're passing objects through constructors.
pretty much
I prefer making lots of butter in a consistent, maintainable way.
like ?
Using guice for dependency injection vs creating a lot of object instances and explicitly passing a bunch of dependencies. Just depends upon how complicated your project is
If you're smart you don't make your code passing a bunch of different dependencies in the first place.
But yeah I get your point.
Well, no matter how you handle it, the dependencies are still there
I mean there is ways to keep maintainability without using guice.
Guice makes it a lot easier though
I can associate all the dependencies in just a few lines, whether itโs commands or classes that are handlers/managers. Makes it a lot easier to add additional features
are the patch things in build tools a part of build tools or are they something else?
The patches are what makes spigot, spigot
They are additions that get inserted into the code of vanilla
but are patches a part of maven or git? or are they specifically made for build tools
i'm just trying to get a better understanding of how build tools works so i get better use out of it, but i don't really know where i can find that information
spigot's codebase is stored as a bunch of patches to the actual server @minor spruce
due to like legal reasons
so it's distributed that way & you have to apply the patches yourself
Could not successfully run git. Please ensure it is installed and functioning. Cannot run program "git" (in directory "."): error=2, No such file or directory
buildtools just does that for you automatically
this isnt on windows
i need git... even when on linux?
buildtools depends on git
im fairly certain you only need git if youre on windows
git does not come on linux by default so yes you need to install it
and if i wanted to make my own patches, they're a part of git right?
buildtools applies git patches to the server codebase so you need git to use it
buildtools doesn't come with git built in
Open your terminal if you are on Linux, or git bash on Windows.
additionally, it's the same jar for windows & linux
or
on linux, the default shell is bash, but on windows, it's not, so you have to use git bash to use the bash shell
git bash lets you run linux utilities and commands on windows
for being
@minor spruce you wouldn't use buildtools for that
you'd clone the spigot repository, run a script to decompile the source & apply patches, then modify the source, then use a script to turn your changes into a patch
buildtools is meant for building
I mean I tend to use WSL over git bash
yeah you don't have to use git bash @wanton delta , you can use other programs too
thanks for the help, i think i know what i need to do, guess i'll just play about with it for a bit
Does anyone know how I can use Coord coord = townBlock.getCoord(); with player.teleport? just a bit confused here.
townyapi.
Hi!, I have a config.yml that ask for a number like:
# Number between 1 and 100
Number: '6'
How can I make that if the number is higher than 100 or lower than 1 throws an error? Just a console.log or should I add something else?
Do you know how to throw an exception?
Hey guys, can I download stuff to my D drive? Or will this mess up my pc
o.O
secondary drives has been a thing since the late 90's
why would using a second hard drive mess it up?
idk that's what I'm curios about
I mean, if you plan to use it to install stuff, then you can run into issues when you remove the HDD. But if its a permanent internal one, then not much to really worry about
I have 5 externals for my computer XD
Hi. Excuse me. I have a problem with the Anti-Lag that comes by default from Spigot. What happens is that I don't know how to remove it. I don't know if they understand me very well, but the Anti-Lag makes the Spawn of mobs too weak, making the farms not work very well. It also happens that the drops of experience come together in one, instead of being several drops. Could you tell me how that Anti-Lag is removed?
o.O
not aware of plugins that come with spigot by default, especially not anti-lag ones lol
what did you do download a pre-built jar from somewhere?
No. I do not download it from anywhere. Spigot comes with a kind of anti-lag so that it doesn't Spawneen so many mobs. But I don't know how to remove it
are you referring to the config options?
if so just modify the configs in the spigot.yml
you don't really remove it as it isn't a plugin o.O
oh, ok. Thank you!
Do you know how to throw an exception?
Iโm also interested in this
i thought spigot wasnt supposed to affect vanilla mechanics
example throw new IOException("message");
Spigot can be configured to adjust the spawn mechanics
if you're expecting a number within a certain range for a config value, would it make sense to use an InvalidArgumentException?
@barren abyss You could also hardcode the range you expect the value to be and clamp it, so if the input is <1, then make it 1, or if it's >100, make it 100
I add some error throw stuff
im working with probability, cant change the numb to a random value, the plugin wouldnt make any sense hahaha, but thanks for the tip
Well, in the case of the value only being valid within a range, you could enforce it and still give an error message. Was going based off your example.
Hey, how would I set up permissions for this shop? https://www.youtube.com/watch?v=pCCFN_V5n9M
hello to all
i need help
with a command i want to give someone an diamond sword with a custom name but not working
this is what i got /give @p diamond_sword 1 [{display{Name:test}}]
@atomic imp the permissions are listed on the spigot resource page for that plugin. https://www.spigotmc.org/resources/simpleshopx-sell-anything-for-anything-free-1-14.68462/
https://www.digminecraft.com/generators/give_weapon.php
@vocal phoenix
where?
at the bottom
i tryed that it dont work
for some reason it seems like when using inventory view, all guis are equal
oh i see
expand the spoiler
but my friend doesnt want to give us OP
@red zenith i have tryed that it dont work
how does your friend manage permissions
then you must not be using 1.15 mc
i need help
@vocal phoenix Can I recommend you this page? https://www.gamergeeks.nz/apps/minecraft/give-command-generator
we dont have any permissions
in which case I can't really help if you are using an outdated version
well, then that's a problem
we need to set it up so we dont have op but can still use the shops
I would use a permission plugin
like?
LuckPerms is what I use
how would I use that for the shop plugin
it comes with a default group, which all users have
i have tryed four dif web sites
@atomic imp you mean you dont have a permissions plugin or the plugin for the shop dont have any permission node?
so you just add the permissions to that group
@vocal phoenix would probably help more if you state what version of mc you are using because obviously you are using an outdated one if none of the generators work for you
/lp group default permission set simpleshopx.buy true global
we use luckyperms
1.15.2
@barren abyss i have tryed that as well
@vocal phoenix Are you using essentials or any plugin that modifies give?
yes essentials
/lp group default permission set simpleshopx.own true global
im so confused
if you install luckperms on the server
ah, you need to do /minecraft:give instead to use the mc give command instead of essentials @vocal phoenix
Yeah... essentials change /give arguments
then your friend just needs to issue those commands, either in console or from in game, once they give themselves the permission to use luckperms
do what frostalf said
no im using /give @p
but /give is modified by essentials
use /minecraft:give
to use the default command set by minecraft
the selector may not work if essentials has overriden the command
Essentials override a lot of minecraft default plugins, thats a mess ๐
but dont know how to use it
ok look i can give a sword with a name by using /give @p minecraft:diamond_sword name:test this works but i want ot add other things like enchantments but it does not work
@atomic imp add the permission node of simpleshop into the group that you want to have acces to
I think the format you linked earlier is wrong
what version of mc are you running?
Aka
@vocal phoenix if you are not going to use the commands as mentioned and instead want to insist on using essentials give command then you need to go look at essentials wiki for that
@vocal phoenix do not use /give if you are using default arguments, instead use /minecraft:give, and those websites generators will then work.
^
is there any reason why inventory view is the same for every gui a player opens? public void openInventory(final Player player) { InventoryView view = player.openInventory(createGUI(player)); Main.openGUI.put(player.getName(), view); }
and ```
public void gui (InventoryClickEvent event) {
final Player player = (Player) event.getWhoClicked();
if (event.getView() != Main.openGUI.get(player.getName())) return;
event.setCancelled(true);
}```
๐
what do I put in the luckyperms config file
simpleshopx.buy
Allows players to buy items from shops
Default: op
simpleshopx.own
Allows players create and run shops
Default: op
simpleshopx.admin
Allows players to destroy and the shops of others
Default: op
@pastel condor need to set the owner as not null
this is simple shop perms
ok i have tryed it woth /mincracft:give still nothing
you don't change the config file for luckperms
then what do I do
you use the commands provided by luckperms from your server console
what are the commands
or you give your player the permission to use the commands in game
who would be the owner then? because I was told not to implement inventory holder @keen compass
it's all on that website
ok i have tryed it woth /mincracft:give still nothing
@vocal phoenix Can I check it on your server?. you can also check the version of your minecraft.
sure
If you can't read that page how are you going to understand it if i tell you?
@pastel condor if the inventory being opened has a null owner, then all players can see it
arguments are changed in some versions i guess
my server is 1.15.2 and spigot 1.15.2
if you instead just make up an owner you can selectively add players to see it instead
but I then have to make a class that implements inventory holder
should I just use inventory.equals(inventory)
In order to have an intventory view, you need an inventory
the inventory you create needs an owner
so /lp then what
I just want to create a gui
help
should I use inventoryview or check inventories with .equals for guis?
@atomic imp for any user to be able to buy and create shops you just need to do the commands I shared earlier
Whoever runs the server and has op probably has the permission/ability to use the commands for /lp
@vocal phoenix /minecraft:give @p diamond_sword{display:{Name:"\"Big Sticker\"",Lore:["\"Stabby stab stab\""]},Enchantments:[{id:sharpness,lvl:5},{id:fire_aspect,lvl:2},{id:looting,lvl:3},{id:sweeping,lvl:3},{id:unbreaking,lvl:3},{id:mending,lvl:1}]}
what is the best way to reload a plugin? i dont want to keep having to restart my server everytime i update it and test it
get plugman reload then /plugman reload (plugin name)
plugins are not ment to be reloaded when the server is running but yeh plugman
generally that is down to poor design if it can't handle reloading
Not necessary
If 2 plugins are working together and you reload one, it might cause any error
then that second plugin shouldn't be making assumptions and should be checking that what they have is valid
Im not saying that you cant handle those errors, im just saying that even essentials have errors when reloading something
well even popular plugins make mistakes or poor design choices
if there is something that the server provides to the server ops, then you probably should design your plugin to handle such scenarios if they are something to possibly happen
Right
I have a question, I didnt try it yet im just messing with itemstack, but if I want to drop the custom item I just have to add the item name to the drop? ^^
@zenith palm i need help please
Depends what methods you are using to drop the itemstack
for some reason this map seems to have messed up values static HashMap<String, Inventory> openGUIs = new HashMap<String, Inventory>();
well you are putting an object as a value, but what messed up values does it have?
Help with ItemStack.
Im trying to change a Helmet default protection, is there any way to do it? didn't find anything in the docs.
should project be com.domain.pluginName.MainClass or com.domain.MainClass?
what do you mean project?
packages should be lower case, while classes it is alright to have capitals
I would probably opt for the first on in case you make more plugins
Does anyone know what the command is for all players since @a isn't working?
/minecraft:minecraft command ex /minecraft:kill @a
pluginname is a must to prevent clashes with your other projects
this gui system doesn't seem to work ``` public void gui (InventoryClickEvent event) {
final Player player = (Player) event.getWhoClicked();
if (!(event.getInventory().equals(Main.openGUI.get(player.getName())))) return;
event.setCancelled(true);
}and public void openInventory(final Player player) {
Inventory inv = createGUI(player);
player.openInventory(inv);
Main.openGUI.remove(player.getName());
Main.openGUI.put(player.getName(), inv);
}```
Well, I'm trying to have a crate for all online players but @a doesn't work.
@a don't exists on lower Minecraft version, such as 1.7.10
how can I check if a player clicked in my gui?
event.getSource() != Main.openGUI.get(((Player)event.getSource().getHolder()).getName()) doesn't seem to work
I have 1.15.2
I always do this.
InventoryClickEvent e {
if(e.getInventory().getHolder instanceOf MyGUI)
// ...
}
Also don't compare Inventory name, it can easy to exploit
looking for a lootcrate system?
like give keys to everyone and let them unlock a crate @ spawn?
@heady jolt but then you're implementing inventoryhandler?
and thats considered bad I though
InventoryHolder
yes
Nah. It's works fine
You must reading someone on spigot said: You abuse this you abuse that
but in the end, comparing inventory name is bad. from what I know
Do what fit you the most. I test it on the server, I see no exploit.
anyone able to help?
?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.
Yo guys, I'm messing around with TNT fuse lengths
I want my TNT to detonate at after 1200 ticks (1 minute)
However, it detonates after its "normal" number of ticks, with no respect to my fuse timer
It also does not decrease the number of ticks - it would seem strange for me to manage the reduction of ticks
use nms
kill me
i don't know what you change but i'm pretty sure it's not exposed in the api
you need to swap the TNT for a TNTPrimed which is an entity if I recall
just listen for the appropriate event https://hub.spigotmc.org/javadocs/spigot/org/bukkit/event/block/BlockIgniteEvent.html
@keen compass Well aware of that one, the problem is Minecraft does not reduce the tick count
what do you mean reduce the tick count?
private TNTPrimed tnt;
...
tnt = (TNTPrimed) Bukkit.getWorld(Statics.worldName).spawnEntity(newLocation, EntityType.PRIMED_TNT);
...
tnt.setCustomName("the region that the player is in + tnt");
tnt.setCustomNameVisible(false);
tnt.setFuseTicks(SiegeUtilities.getBombTicksByLocation(tnt.getLocation()));
defuseClicks = SiegeUtilities.getDefuseClicksByLocation(tnt.getLocation());
tnt.setInvulnerable(true);
Hey everyone, I own a 1.7/1.8 hcf server and was wondering how to fix a glitch. People can put a sand or gravel above their head in a 1 by 1 and then break blocks while walking forward to go into peoples claims/bases. Is there a way to fix this block glitch? Unfortunately disabling the blocks or block falling is not an option for us on hcf.
next time, please surround your code with 3 back ticks so that it looks better
are you certain the ticks being set are actually correct?
Bro, I am fully aware of proper code syntax
Anyways, only thing I can think of is that the number of ticks you are setting are not what you think it is
Trust me, that is not the issue. I believe this is something deeper.
I found this^, not sure if its still relevant
interesting, will have to open my IDE up to see
Answer already found but ty
think you can probably resolve it by sending an extra Metadata packet to the client
Metadata packets for entities are not required when they spawn, so probably could just send that packet with your values to the client to see if the client updates as expected
not the ideal solution, but if it works then it solves your problem lol
Metadata packets are not required, they are optional
Do you guys know of some resource for nms packets. Reflecting into each class invidually & reading its methods sucks
Spawn packet doesn't contain the metadata anymore you are right, but they are not required to be sent either when an entity does spawn
And is a hugeeee damper on productivity
I know this because I had to fix a plugin I maintain for this specific scenario
Where an entity spawns but no metadata given
the handy thing is though since it is a separate packet, you can send metadata anyways or a duplicate metadata packet
@frigid ember could use protocollib to send metadata packets for entities if you just want to test really quick
but would recommend if it does work that you implement that yourself instead of using a large lib for that one thing
Is there a way to check chunk is in loading process or not?
not entirely sure you can do that without nms, only thing I can think of that wouldn't require nms is to see if a region file has a lock on it to determine that
if the lock is present, it means the server has it loaded
I'm trying to check location's block on PacketFly and want to wait if chunk is in loading.
And I also don't want to sync check. It's delaying the check
just use the isLoaded() check, if it isn't loaded just wait till it is loaded
create a boolean function that does the checking
and then you can implement it into whatever task you have to wait till that boolean function comes back true. But might want to implement a timer on it though in case it never does load so a max wait time lol
I'm checking next location so system cannot be sure the chunk might be in sync loading. If I try to check or get chunk it gives me async throwable
Is there any other way to do that? I don't want any delay on the process :/
then check if it is loaded then if not tell the server to load it is the only thing I can think of if you don't want to wait
Yeah I can make list for that whenever chunk is loaded add into it but isn't it bad way to do that? I wish there is chunk load think in packetfly ๐ญ
not sure how you have it implemented but if you just need the chunk data, could always just read the region file instead to get all the chunks you might need XD
as long as you are not modifying the region file, should be fine with reading it
@keen compass I will have to use nms many times throughout my plugin, so maybe protol lib not such a bad idea?
Itโs just another external dependency, no?
yes, but it is a large one and if you are only using it for just one thing, doesn't really make sense to require a hard dependency on it if you can implement it easily for that one packet
good news is protocollib is often used so most servers will probably have it anyways. personally I try to make my plugins not have as many hard dependencies on things if it isn't necessary. Therefore they have soft dependencies. That is if it is present it uses it, if not uses its own internal stuff. But it doesn't really make a difference if this plugin of yours isn't going to be something public
how would i run a event when a tnt i spawned explodes
BlockExplodeEvent should probably do it
thanks
Hey everyone, I own a 1.7/1.8 hcf server and was wondering how to fix a glitch. People can put a sand or gravel above their head in a 1 by 1 and then break blocks while walking forward to go into peoples claims/bases. Is there a way to fix this block glitch? Unfortunately disabling the blocks or block falling is not an option for us on hcf.
hcf?
what is that some other fork? if so not sure why you are trying to get help here for some other fork
second, you are on very outdated versions
so glitches in the server are going to be on you to fix
hcf is a gamemode, hardcore factions. The reason we use 1.7/1.8 is for the pvp and the community within in
@keen compass As you said, I could get block with NMS(WorldServer).
Do you know what is the fastest way to get material and type from NMS Block data (IBlockData)?
not sure where I recall specifying NMS o.o
I said without using NMS you could read a region file lol
if you are using NMS, the fastest way to get the material and type is just to read the NBT data yourself
Caused by: java.lang.ClassNotFoundException: com.comphenix.protocol.events.PacketEvent
at java.net.URLClassLoader.findClass(Unknown Source) ~[?:1.8.0_251]
at org.bukkit.plugin.java.PluginClassLoader.findClass(PluginClassLoader.java:101) ~[spigot.jar:git-Spigot-1.7.9-R0.2-208-ge0f2e95]
at org.bukkit.plugin.java.PluginClassLoader.findClass(PluginClassLoader.java:86) ~[spigot.jar:git-Spigot-1.7.9-R0.2-208-ge0f2e95]
at java.lang.ClassLoader.loadClass(Unknown Source) ~[?:1.8.0_251]
at java.lang.ClassLoader.loadClass(Unknown Source) ~[?:1.8.0_251]
... 20 more
Ahh yes a random error log with no context time to do my magic
I think it's stupid idea to use PacketInFlying packet for checking blocks so I move PlayerMoveEvent.
As I see from source code of spigot, there's nano second delay between packet and move event. So there's no problem with it
As long as you are carefull what you do in it,ur good
I used to use packets for just didn't want to delay
or hard depend if its absolutely necessary
But in either case it isn't going to help if you are not going to catch exceptions regardless XD
i know it seams very stupid but how do i do that ?
int avance = 0;
Bukkit.broadcastMessage(messages[avance]);
int avance =+1;
Error : Duplicate Local Variable avance```
?
avance +=1;
or
avance++
or
++avance
avance += 1 is just avance = avance + 1 shortened
lol
Oh boy..
get rid of "int" in front of the second avance
doesn't work
On other news anyone know a way to bypass the 1.13 iron golem fix? They no longer spawn in air
lmao
what, why did you say it doesnt work then
Hey anyone can help me i cannot talk in my server
everytime i talk this happened
no one can see my message
what
and
Delete all your plugin and add em back one by one until you can talk
look in the logs
@EventHandler
public void Death(PlayerDeathEvent event){
Bukkit.broadcastMessage("Hi");
}
}```
Doesn't works
Yes
why is it called Death
how
Why not?
thats now how are methods called
it has no importance
it does
to you
package ibmesp.deathmessages;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.plugin.PluginDescriptionFile;
import org.bukkit.plugin.java.JavaPlugin;
public class DeathMessages extends JavaPlugin {
public String version;
public String name;
public void onEnable() {
PluginDescriptionFile pdffile = getDescription();
version = pdffile.getVersion();
name = ChatColor.DARK_RED + "[" + pdffile.getName() + "]";
Bukkit.getConsoleSender().sendMessage("[DeathMessages] - Version: " + version + " Enebled - By IBM_ESP ");
}
}
See, as I said
lmao
You don't register the listener
"registered listener"
Bukkit.getPluginManager().registerEvents(new Messages(), this);
literally anywhere in your main class
i wouldnt use PlayerDeathEvent for death messages
there is no method that returns the killer in the death event
lmao he's clearly just starting, just give him some code and let him explore it
there is one in the Player interface but that doesnt work properly
doesnt return the actual killer
use EntityDamage/ByEntityEvent
you can get the cause + damager
I just want to give a personal messsages like if its called Mario say "Go to the castle"
okay then
Lol there are lots of YouTube tutorials for this, like VerveDev or {TheSourceCode} or pogo
Or just a google search
Yes
String messages[]= {"message1", "message2"};
Bukkit.broadcastMessage(ChatColor.GREEN + "Bienvenue a "+player.getName()+" sur Gnanpvp !");
int avance = 0;
while(avance < messages.length) {
Bukkit.broadcastMessage(ChatColor.GREEN + messages[avance]);
avance =+1;
}```
But i still only get "message1" in chat... can anyone help pliz ?
when do you call this
Probably because the tutorials were 1.8.8 so, also CodedRed is doing a series rn if that helps
1.15+
no the version doesnt matter, they are using very bad java practices
were
@worn gate just do something like this
Yes they r
@Override
public void onEnable() {
broadcast();
}
private void broadcast() {
final char[] chars = {'a', 'b', 'c', 'd', 'e'};
int count = 0;
Bukkit.getScheduler().runTaskTimer(task -> {
if(count != 4) {
Bukkit.broadcastMessage(Arrays.toString(chars[count]));
count++;
return;
}
count = 0;
});
}
@worn gate
while(avance <= messages.length)
yes but it's not in my public void onEnable(), it's in another class
for (int i=0; i<messages.length; i++) {
Bukkit.broadcastMessage(message[i]);
}
Super fundamental for loop ^
this is gonna broadcast all the messages at the time quitwolf
...considering he was using a while loop before, I think this is okay
for (String messageString : messages) {
Bukkit.broadcastMessage(ChatColor.GREEN + messageString);
}
Could, but that creates a new instance of Iterator
not Bukkit.broadcast, player.sendMessage()
what creates an instance of iterator lol
i'm trying ur method
Using the colon operator in the for loop.
enhanced for loops use an iterator in the background
^
they dont create a new instance every time though
while(avance <= messages.length) @keen compass crashed my server because it was spamming in chat
No, but it's unnecessary
i'll try this : for (int i=0; i<messages.length; i++) {
Bukkit.broadcastMessage(message[i]);
}
That's great!
@bleak creek thats not an new instance though they take the iterator from memory
@worn gate lol, should flip that operand around then
if you want the while loop
but, an enhanced for loop is better suited though
for your case
It's a performance/memory thing, it has relatively the same effect
Just a best practice to use what I suggested.
iterators are not inherently bad
no, I would honestly even agree from a readability standpoint they are superior
Like I said, just suggested it because it's a best practice
Preeeettty sure compiler optimizes enhanced for loops for lists
in this case its an array not a list lol
Then it's the same anyways since arrays have no iterators
I wouldn't worry about it too much, not worth debating lol
It would be the exact same bytecode
Well, as you can see there is many ways to accomplish this
I guess just pick which ever one you like ๐
and how could i put a 100 ticks between every messages with bukkit runnable ?
String messages[]= {"message1", "message2"};
for (int avance=0; avance<messages.length; avance++) {
player.sendMessage(ChatColor.GREEN + messages[avance]);
}``` ?
Ah see now you want the other guy's suggestion
?
this one ?
@Override
public void onEnable() {
broadcast();
}
private void broadcast() {
final char[] chars = {'a', 'b', 'c', 'd', 'e'};
int count = 0;
Bukkit.getScheduler().runTaskTimer(task -> {
if(count != 4) {
Bukkit.broadcastMessage(Arrays.toString(chars[count]));
count++;
return;
}
count = 0;
});
}```
lol something like that... pretty messy if you ask me
public void Death(PlayerDeathEvent event) {
if (player.getName() == "IBMSecuncario") {
Bukkit.broadcastMessage("Hi");
if (player.getName() == "IBM_ESP") {
Bukkit.broadcastMessage("Hp");
}
What should I add?
You should use .equals() for strings
well i would like it to work when a player joins and that he has never joined before
@EventHandler
public void onPlayerJoin(PlayerJoinEvent event) {
new BukkitRunnable() {
@Override
public void run() {
Player player = event.getPlayer();
boolean hasJoin = player.hasPlayedBefore();
if(!hasJoin) {
final char[] chars = {'a', 'b', 'c', 'd', 'e'};
int count = 0;
Bukkit.getScheduler().runTaskTimer(task -> {
if(count != 4) {
Bukkit.broadcastMessage(Arrays.toString(chars[count]));
count++;
return;
}
count = 0;
});
}
}``` ?
no should
what
are you creating new BukkitRunnable every time player joins which runs a scheduler inside of it?
lol
it wont work
lmao, hold on @worn gate Just like tell us what your goal is?
If it's to learn a ton of new spigot/java stuff, then this is fine, whatever
@bleak creek Like this?
Bukkit.broadcastMessage("Hi");```
But if you're trying to actually achieve something specific, there are probably better ways to do it
Or less convoluted at least
no
i would just like the messages to display after 30 secondes (because of AuthMe register) and then to display messages in a list which happens every 5 secondes
to make sort of like an irl conversation
to a specific player?
player.getName().equals("IBMSecuncario")
okay defnitly im stupid
i'm even more @azure finch , don't worry ๐คฃ
and in this code Player player = (What gooes here)
love how we keep suggesting solutions and the person keeps adding requirements as we solve each one making the code change drastically to handle each new requirement
lol
so does anyone has an idea of how should this work ?
That's why I asked for a specific usage
I'm still not clear what you're trying to do
public void Death(PlayerDeathEvent event) {
if (player.getName().equals("IBMSecuncario")) {
Bukkit.broadcastMessage("Hi");
if (player.getName().equals("IBMS") {
Bukkit.broadcastMessage("Hp");
}
}
}
}```
I mean the "player" its in red how i solve that
...
lol
You don't have a player variable defined
You want to pull one from the PlayerDeathEvent
yea thas waht im asking
presumably
i need help with a command block if anyone could help, not my thing
event.getPlayer()
?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.
i would just like the messages to display 30 secondes after the player joined (because of AuthMe register) if the player never connected b4 and to make sort of like an irl conversation i would like to have a gap between every messages of 100 ticks (5 secondes)
But why
for a magical plugin
so the messages explain how it works, after it open a gui and etc
with the conversation api you can put the player in their own chat channel with the server and parse their repsonses however you see fit as well as their actions etc.
It is nice ^
im having bother with luckyperms were players can use /kits {name}, so im just going to use a command block for the time being, problem is now that when i use "/kits essentials" i need it to be usable by who ever stands on it, i thought @p was the command but im wrong
event.getPlayer()
@bleak creek This goes in the variable?
so i tryed "/kits essentials @p" btw
if you want to use it later many times, sure
If you're only going to use it the once, or perhaps twice, you can just call the method getPlayer() on the event when you need that Player variable
i.e. If you replace the word "player" in your code above with event.getPlayer(), it would work
https://github.com/hawkfalcon/ServerTutorial/blob/master/src/main/java/pw/hwk/tutorial/conversation/CreateTutorial.java
@worn gate
example on using the conversation api
could this work ?
@EventHandler
public void onPlayerJoin(PlayerJoinEvent event) {
new BukkitRunnable() {
@Override
public void run() {
Player player = event.getPlayer();
boolean hasJoin = player.hasPlayedBefore();
if(hasJoin) {
String messages[]= {"msg1", "msg2"};
Bukkit.broadcastMessage(ChatColor.GREEN + "Bienvenue a "+player.getName()+" sur Gnanpvp !");
new BukkitRunnable() {
@Override
public void run() {
for (int avance=0; avance<messages.length; avance++) {
player.sendMessage(ChatColor.GREEN + messages[avance]);
}
}
}.runTaskLater(plugin, 100);
Inventory Classe = Bukkit.createInventory(null, 54, "");
player.openInventory(Classe);
}
}
}.runTaskLater(plugin, 20*30);
}```
public final class CraftRunnable {
public void runTask(Runnable runnable, long delay, long period,
TimeUnit unit) {
int generatedId = ThreadLocalRandom.current().nextInt(50000000) + 1;
ids.add(generatedId);
final ScheduledExecutorService service = Executors.newScheduledThreadPool(1);
services.put(generatedId, service);
service.scheduleAtFixedRate(runnable, delay, period, unit);
}
public void cancel(int id) {
if(ids.contains(id)) {
ScheduledExecutorService service = services.get(id);
service.shutdown();
}
}
}
private CraftRunnable runnable;
@Override
public void onEnable() {
runnable = new CraftRunnable();
broadcast();
}
public void broadcast() {
runnable.runTask(() -> {
}, 20L, 20L, TimeUnit.SECONDS);
}
o.o
ez
lmfao
soooo much code
very best code
Who was the person earlier telling me not to spoonfeed lmao
lol
this wouldnt work tho
I should just create a bot to sit in here to make gists of all the code that gets contributed here
rrrrrrrrrrr
CraftRunnable lol
Now get player its in red
fix the imports
doesn't help... @keen compass
what doesn't help?
player = event.getPlayer() <- assignment
event.getPlayer() returns Player
player is just an variable
what event is that
PlayerDeathEvent, presumably
PlayerInteractEvent ?
ok thanks
either way, all those Player... Events have a getPlayer() method I think
no they dont
Could be wrong
lmao well ig my b, that's kinda dumb
The PlayerDeathEvent actually extends EntityDeathEvent and thus has the getEntity method which returns the player
public Player getKiller() {
return this.getHandle().killer == null ? null : (Player)this.getHandle().killer.getBukkitEntity();
}
its a PlayerDeathEvent tho
and look at this
this is really dumb lol
why is it casted to player
my code still doesn't work ๐ข
What is that from? The PlayerDeathEvent?
it's normal to some degree
What if it isn't a player killing them?
i dont know
its broken the whole thing
plus it doesnt return the killer
it returns the entity that last damaged them before the killer
lol
The NMS killer field of the EntityLiving class is of type EntityHuman - the EntityPlayer class is the only one that extends it as far as I'm aware
no
Just work for the first Player
lol just a basic ternary operator
you never tried to get the entity behind the projectile did you
event.getDamager().getName()
yeeah that would return the projectile
no
To be honest, that's rather trivial... just create a method to do it for you
Ok solved
This place really needs more than one #help-archived channel lmao
it's not really needed
It does in fact return an Entity, but if the damaging entity was an arrow, then that's what will be returned. Projectiles are also entities.
it can be done in if (e.getDamager() instanceof Projectile) {
Entity shooter = (Entity) ((Projectile) e.getDamager()).getShooter();
yes
but look how it looks
just wanted to say
it looks fine?
probably never trying to do anything harder if u say this looks horrible
lol
i did
Yeeeea it works thaks for helping me and sorry for wasting ur time
if (event.getDamager() instanceof Projectile) {
Projectile projectile = (Projectile) event.getDamager();
}
u dont need to double cast
lol
the source
What is happening here lmao
you need the source tho
What source
the one who shoot the projectile
Why are you assuming there's a projectile involved
LivingEntity entity = projectile.getShooter();
it happens to be
