#help-development
1 messages · Page 1905 of 1
Just change the variable name then
List<Player> players = new ArrayList<>(Bukkit.getOnlinePlayers());
Player hunter = players.remove(new Random().nextInt(players.size()));
hunter.teleport(new Location(Bukkit.getWorld("Game2"), -9.5, 75, -4.5));
for(List<Player>; help me here what do i do here pls) {
player.teleport(new Location(Bukkit.getWorld("Game2"), 0, 65, 0));
}
(sad code noises)
You continue if the player is not the hunter
yea forgot to remove
So you only teleport the hunter in your loop
just loop through the players and teleport each one
no need for the check since the hunter is not in the new list
yes
but every time
i get Variable already defined in scope when i just try to use it in my for loop
Player hunter = players.remove(new Random().nextInt(players.size()));
for (Player player : players)
player.teleport();```
hmm thnx ill try that
VARIABLE ALREADY DEFINED IN SCOPE
i have decided
that i want to die
.
can you screenshot the error
Verify
big brain time
i have this:
List<Player> players = new ArrayList<>(Bukkit.getOnlinePlayers());
Player hunter = players.remove(new Random().nextInt(players.size()));
i can tp the hunter
how do i tp the players that are in the list
if i do this:
for (Player player : players){
player.teleport(new Location(Bukkit.getWorld("Game2"), 0, 65, 0))
}
the word "player" in the for loop gets an error variable already defines in scope
So give it a different name
Did you rename the other usages of it?
wdym
yea
if i rename those then i get var already defined in scope
so im kinda stuck now
List<Player> lala = new ArrayList<>(Bukkit.getOnlinePlayers());
Player hunter = lala.remove(new Random().nextInt(lala.size()));
Random rand = new Random();
for (Player onlinePlayer : Bukkit.getOnlinePlayers()) {
hunter.teleport(new Location(Bukkit.getWorld("Game2"), -9.5, 75, -4.5));
for (Player chingchang : lala){
player.teleport(new Location(Bukkit.getWorld("Game2"), 0, 65, 0));
}
gonna try this
can someone help me with my plugin dm
How can i make a API for my Plugin so that other plugins can communucate with my Plugin?
Create a separate module and write interfaces to interact with your plugin
in plugin module, implement those interfaces
Is there a Tutorial how to so that?
In most cases you dont have to do much. Even bigger plugins just provide a single API class with helper methods.
You just need to provide a convenient way of distributing this class. Havin multiple interfaces makes sense if your
plugins size exceeds several dozen classes.
^ you want your api to be simple above all the complex details your plugin operates on
does this select a random player out of online?
List<Player> lala = new ArrayList<>(Bukkit.getOnlinePlayers());
Player hunter = lala.remove(new Random().nextInt(lala.size()));
why do you remove?
Sure
hmm it doesnt look like its working
always selects the same guy
or its just super lucky
do you have more than 1 player online
yeaa
but
wait
my friend is pulling this stunt where he is running 2 instances of mc at the same time, and hes in hypixel in the other instance
yea and i cant tp him
propobly that lmao
doesnt matter what hes doing with the rest of his PC...
but i cant execute anything on him
On your server?
Send the stack trace please
yea cant tp him (his character just doesnt appear) but i can kick/ban him etc. hes just not rendered (becuase his in another server and mine at the same time)
Oh i see. He uses the same account for both servers.
That’s not how that works
How is he even able to join then?
You can join as many servers as you want at once
til
Just can’t join the same server twice
so i tried the stack trace and still cant find the issue . or im dumb
oh thanks. I thought that was a total possibility. Having the same UUID join twice makes sense.
Send it
17:28:02] [Server thread/ERROR]: Error occurred while enabling EnderRider v1.0-SNAPSHOT (Is it up to date?)
java.lang.NullPointerException: Cannot invoke "String.replace(java.lang.CharSequence, java.lang.CharSequence)" because the return value of "org.bukkit.configuration.file.FileConfiguration.getString(String)" is null
at enderrider.enderrider.utils.Lang.loadLang(Lang.java:23) ~[?:?]
at enderrider.enderrider.Main.onEnable(Main.java:56) ~[?:?]
Main.class line 56
Send that pls
sec
Blah now I’m second guessing turning all my data instinct strings for storage
And pls make sure this time (and this is important)
that the version you are shwoing matches the version installed on the server. 1:1
No fiddling with your code while you track down an error!
Pls compile this exact code and run it again. Then show the stack trace.
And the full stack trace this time pls.
Ok then show the loadLang() method pls
ok
if i do this hunter.getInventory().addItem(Material.BOW);
then i get cannot resolve method
Because there is no method to add a material to an inventory
tbf the stack trace is really conclusive.
return value of "org.bukkit.configuration.file.FileConfiguration.getString(String)" is null
Just means you call getString(String) somewhere and it returns null.
oh do i add it with: public enum Material implements org.bukkit.Keyed
its what error tells me to do
No Material is just a type. Nothing that can exists in the world. Could be the type of a Block or an ItemStack.
hmm how do i implement or use the additem get inventory thing
Your keys are as follows:
"Lang "
"EnderPeralName "
"CoolDownTime "
Notice the space character at the end of each line + the spelling error in Pearl
Step one: Create an ItemStack
Step two: Add it to an Inventory
Is there a way to get the NMS Dependency into a private Maven Repository?
For what version?
Usually if you run BuildTools then Spigot and all its dependencies are installed into your local maven repo
I don't need the local one, I need it into my nexus Repo
1.17.1 + 1.18.1
Upload it or run BuildTools on your remote machine?
Oh but working with NMS in 1.17.1+ has changed a lot
Since it's snapshots uploading won't work. I need to run it through mvn deploy, but I don't know which module and so on I need to use
smile the same error again
Pls tell me that you fixed your plugin.yml and also removed it before starting because your plugin doesnt overwrite the old plugin.yml
yes i did
Show me the plugin.yml in your plugins folder
lets say I have a config
Elaborate
hello
how i can create top 5?
Like this
claim.category is your path
claims
"claim-1"
Sort all and get the highest N elements
so I would just set claim.category
to a String value
config.setString("claims.claim-1", "Something");
Write it in the FileConfiguration then save it to a File.
So how would I add
Iirc setString doesn’t exist
to an existing FileConfiguration
It’s just set
yeah it is
Ah right. Didnt work with bukkit configs for a while now
Setting a key that doesn’t exist will create it
Ah great
Nope. In your plugins folder on the file system. Not the one inside your jar. You need to remove the old one.
Still seems like the easiest way though, even if it defeats half the purpose of a relational database
lets say that there is no plugin yml
If you just want to store the data then this is fine. You only need relational data if you want
to write complex queries. For example: Get all IDs of Students which names start with the letter A and are at least 21 years of age
Its a choice between efficiency and simplicity
And modularity. Because using json Strings also enables you to simply store the data in Flatfiles or a DocumentDB like Mongo
or, editing individual parts. For example, you dont have to replace the entire row to just change clan's disply name
Does that matter much
with proper design you can take an advantage of relational dbs even with flat-file and mongo. On last 2 variants, it is not ging to be that efficient though
For me, yes 🤷♀️
Yeah I don’t really need any complex queries
For me it never mattered
It just feels wrong
Even if it saves me writing a whole bunch of classes to handle properly transforming data into tables
this feeling cant leave me
Just dont bother using relational DBs then 🤷
elaborate
non-relational
smile
I mean the data isn’t really relational
But SQLite is convenient, and most shared hosts offer MySQL
just create your own database :p
Your config.getString returns null. Make sure the keys match 100%. Thats all you need to do.
Again: If you are just after storage then using a blob is fine. Its not like you want to outsource workload to the DB
Would it be a blob or a text column
JSON data type
json is nice to read but not efficient ^^
Does that provide any advantage over just text
assert Lang.getLanguage() != null; can this cause any issue ?
easy to read with api stuff ... just text is a bit different
Sure. If getLanguage() returns null... But dont use assertions at all pls.
Focus on your problem
Neat
I did plan to simplify the storage of some stuff to non-json strings, but this may make me re-consider
hello set block wheat ?
crops
what is do ?
yes
block.setType(Material.CROPS)
pls
Not working
what exactly is not working ?
did removed them
now
and again the replace is saying to add a notnull parameter
ahhh getstring is nullable
hi,
i tried creating a ftp client connection in plugin but im getting an error
[19:24:40 WARN]: Unexpected exception while parsing console command "startup-b" org.bukkit.command.CommandException: Unhandled exception executing command 'startup-b' in plugin icecube v1.0.1 at org.bukkit.command.PluginCommand.execute(PluginCommand.java:47) ~[paper-api-1.18.1-R0.1-SNAPSHOT.jar:?] at org.bukkit.command.SimpleCommandMap.dispatch(SimpleCommandMap.java:159) ~[paper-api-1.18.1-R0.1-SNAPSHOT.jar:?]
it was big but these are first few lines of error
?paste
send full eror via paste ^^
ok
saying this
Class Not found it seems
How can I check if an argument (a player) is set?
how to fix
check if its null
args.length >= 2
Or if I can find any, then the whole command without any arguemtns are dead
Stacktrace :p
xyz.squeek.icecubesmp.plugin_cmds.backup_cmd.onCommand(backup_cmd.java:28)
Caused by: java.lang.ClassCastException: class com.destroystokyo.paper.console.TerminalConsoleCommandSender cannot be ca
st to class org.bukkit.entity.Player (com.destroystokyo.paper.console.TerminalConsoleCommandSender and org.bukkit.entity
.Player are in unnamed module of loader java.net.URLClassLoader @484b61fc)
It is not checked, but I will also do it.
The thing that is checked at this time is the permission
did, what should i do
(aka the console will also be able to run the command)
i cannot see any error in ide
check the backup_cmd.java in line 28
Umm
Then probably there is the error:
Player a = (Player) sender;
Player v = Bukkit.getPlayer(args[1]);
FTPClient ftpClient = new FTPClient(); no error in ide
the stack trace shows line 28
AdminCommand.onCommand(AdminCommand.java:15) - little console log :3
I cannot cast a as the admin. 😆
yes but i didnt understood , its just FTPClient ftpClient = new FTPClient(); i am unable to find anything
You can’t cast sender to player if sender isn’t a player
I know. The console has shown that I currently cannot use the line Player a = (Player) sender;, because it is unused.
I just removed this line (which was the 15th line), and now it works.
Thank you for your help! 😄
did you make a pubilc class?
also
FTPClient ftp = new FTPClient();
@mint quiver
try this hmm
ok
hm
doesnt seem to work
yeah
it does set it
but it just sets the value
doesn't create a new child String
e.g.
claims: "claim-1"
and not
claims: "claim-1"
like I want
The player has 3 groups of the same and the same number of items, when I use player.getInventory().remove, all three groups will disappear
That’s the format for a string list
How do I refer to remove a group
You need to pass a List<String> to .set
?jd
yeah
it does
but I want to create an initial child key
"claim-1":
type: 1
location: world,x,y,z```
like this
How would I do that?
@young knoll
I have my own server in aternos with spigot/paperbucket but whenever I add my username in ops list and when I join the server but I didn't get op perms what should I do now?
The player has 3 groups of the same and the same number of items, when I use player.getInventory().remove, all three groups will disappear
How do I refer to remove a group?
Sorry I didn't get it
Just set those 2 values directly
thats a aternos problem lol
this.getCommand("getpearl").setExecutor(new givePearl());
setexecutor leads to a NPE
paper bucket
that’s a new one
not if you define in plugin.yml
wht should\ i define it then ?
If a command isn’t in your plugin.yml getCommand will return null
what coll said
config or plugin
Plugin
how can I get the current server name (bungee) in spigot plugin event
hey, i have a problem with connecting 2 plugins with eachother :/ I only know how to set a variable of another plugin but not how to call a method:
Plugin 1 accessing Plugin 2:
Plugin plugin = Bukkit.getPluginManager().getPlugin("SahneBuildings");
try {
Field field = plugin.getClass().getField("a");
field.setAccessible(true);
field.set(plugin.getClass(), 1);
} catch (NoSuchFieldException | IllegalAccessException e) {
e.printStackTrace();
}```
Plugin 2:
```Java
public static int a = 0;
public static void testMethod() {
Bukkit.broadcastMessage("yooo");
}```
I just want to call "testMethod()" 🙂 I appreciate your help 😄
i do have class for the command
what is the hungerdepletion event?
Ty ^^
something like that?
not working, sry for late reply i was gone to eat
Why do toy use relfeciton? Just add the second plugin as depenency
whts the new error?
:D. done
any way to keep player sprint forever (they dont run out of hunger) but dont regen health
Hello, on 1.8 move an armorstand spawned with packets with setVelocity does not work
how can I move an armorstand from a point A to B smooth
tx 🙂
teleport
Wht packets
You mean with the packet ?
Why do you use packets
yes i found it
There's a packet for velocity as well
probably because want to avoid server side entity
exactly
yes
when(item){
ItemManager.unranked -> {
val inventory = UnrankedInventory()
player.openInventory(inventory.inventory)
}
ItemManager.ranked -> {
val inventory = RankedInventory()
player.openInventory(inventory.inventory)
}
}
This is a snippet from my PlayerInteractEvent and it works fine (Kotlin), The only problem is it would start getting bloated once I keep adding item events, Is there a better way to do this which won't bloat the class?
but it does not work :/
I think velocity may not work for dummy entity
because position calculation is serverside
wdym keep adding item events
@thorny python according to wiki.vg, the teleport packet is only for moving entity more than 8 blocks..
When they right click, The items do things
then you may check what packet will be used within 8 blocks...but I think it will still work; 8 block may just minecraft standard behaviour
let's try 🙂
I am not familiar with kotlin... so you want open a particular inventory when player interact with item?
Entity Move packet?
No, I just want to make it more dynamic so the class won't get too bloated if I add many items that I want to trigger certain events with
What?
factory pattern, or command pattern (I feel they are similar sometimes)
it's not working. I must say too that it's in a task
public void run() {
firstVector = armorStand.getLocation().toVector();
destination = armorStand.getLocation().add(0, 3, 0).toVector();
move = destination.subtract(firstVector);
PacketPlayOutEntityTeleport teleport = new PacketPlayOutEntityTeleport(armorStand.getEntity().getId(),
move.getBlockX(), move.getBlockY(), move.getBlockZ(), (byte)0, (byte)0, false);
((CraftPlayer)player).getHandle().playerConnection.sendPacket(teleport);
}
I don't know what you mean by that
so you keep a map which map a ItemStack to a 'Handler' object
Hm
so you try to get handler object from a ItemStack
if the map give you nothing, you dont do anything; if you get a handler object, handler will run the code it should run correspond to that ItemStack
Hm, So like a consumer?
ya that's it
I was doing something similar before
about map an ItemStack to certain object (e.g. String or Consumer)
so I keep a Map<Material, List<Tuple<ItemStack,TargetType>>>
for any given ItemStack, it get List<Tuple<ItemStack,TargetType>> according to item Material
then iterate over the bucket to attempt find the right Tuple<ItemStack,TargetType> via isSimilar() in ItemStack
a
if one tuple return true in isSimilar(), you can use the second value in the tuple (TargetType)
Can't I just have a Map which stores the ItemStack and a Consumer that takes a player?
uh what's that
Persistent Data Container
oh
?pdc
sometime that's an option
Are you telling me store the PDC in the map instead?
but I need to map an arbitrary minecraft ItemStack to other object
No. Give a consumer some key, and store the key in pdx
The get the key from pdc, and retrieve the consumer from map
such as minecraft:potato
How do I increment a value in a config by 1, because:
config.set("path.to.something", config.getInt("path.to.something") + 1);
doesn't work, it always says the value of "path.to.something" is 0, and increases then to 1. but the next time I run this, it is 0 again
(I save the config afterwards)
hey guys i get 2 of each item, with no enchants, any ideas?
hunter.teleport(new Location(Bukkit.getWorld("world"), -9.5, 75, -4.5));
ItemStack bow = new ItemStack(Material.BOW, 1);
ItemStack arrow = new ItemStack(Material.ARROW, 1);
ItemMeta bowmeta = bow.getItemMeta();
bowmeta.addEnchant(Enchantment.ARROW_INFINITE, 1, true);
bowmeta.addEnchant(Enchantment.ARROW_KNOCKBACK, 1, true);
bowmeta.addEnchant(Enchantment.DURABILITY, 3, true);
hunter.getInventory().addItem(bow);
hunter.getInventory().addItem(arrow);
you dont set the itemmeta to the itemstack again
oo
probably not saving or loading again. Code would help
how do i do that lmao
?paste
?jd
there you can see what the ItemMeta is and that you need setItemMeta after changing stuff
hm ok ty
what do you mean how lmao lemme check docs
how do i set itemeta bacc to itemstack
you need to call ItemStack#setItemMeta() ._.
uh
Bro
bow.setItemMeta(bowmeta);
ty ^^
._.
._.
@spiral light @lost matrix @young knoll Srry For Ping But The Plugin Finally works without errors tysm for your help guys
i dont know what i did O.o
Main.plugin.saveCustom ?
Unlocker.plugin.getStatsFile ?
this is not clean and this may be your problem you have
how clear inventory
player.getInventory().clear() maybe
ty
sorry, I didnt correct this. now its the right version: https://paste.md-5.net/helamelume.cpp @spiral light
Get their inventory and then use the clear method
btw any good approach to get current spigot server (bungee) name in spigot plugin?
you should still try to use dependecy injection tho... its not clean to use public static stuff like this
do you get some errors ?
you can also try to debug what getInt gives after setting it +1
No errors. getInt after +1 gives me 1, so it must have been 0
the problem is getFile and saveCustom ...
thats my savecustomfile method: https://paste.md-5.net/ipucelagun.cpp
you cannot get next key
because atm
well
there is a method
do getKeys(false)
And getfile just returns the file from the Main class
match the first one equals your current key then take next
the next key
it returns the key itself
for instance
claims: claim1: claim2: claim3:
I want to get all of the child keys
but it just returns "claims"
which is mostly not a configfile ....
uh
It is a .yml file
did you test it ?
then you do getKeys(true) if you want children keys
yeah but I just want to get the first
children keys
there are multiple keys for those children keys
._.
@rich inlet i rly dont think its the config file you want.
so can you give a better example?
me?
so should I just rename the method getFile?
did you use git add correctly ?
well I'm trying to get the keys
depends on what you did in your main class ... if you want the default config for your plugin you should use JavaPlugin#getConfig()
and saving it with saveConfig()
child keys specifically
for just one key
claims: claim1: claim2: claim3:
so like this
well to upload to github (by using commands) you need to add files ^^
no, I just want a custom file, which is created in the main class, which worked already. setting the value of the path in this file to 0 also worked, the only thing not working is incrementing it
nvm I've fixed it
thanks for the help
ok
you can set any value you want but only incrementing does not work ?
@gritty urchin just use getKeys(true), iterate through them and check if the key contains the string "claim". If not, skip the key. Then when it finds one, do some more stuff to get the number from the key.
yeah thats what I ended up doing
thanks tho
Has anyone had any luck with creating a custom snowball model to make it look like the player is throwing something like a cupcake model assigned to the snowball?
Questions about protocollib?
?
Could I use that to accomplish this?
hey
custom model data is your friend
how can i break a big amount of blocks? Sometimes i have like 600 blocks to break and when i iterate over my arraylist of blocks and then break naturally them the server directly crash
um I dont think 600 blocks is large enough to crash the server
?paste
Could I added 3d model data to a snowball?
Yes
vanilla /fill can do 4k blocks iirc
32k blocks actually
for unknown reason it makes the server crash with a ConcurrentModificationException
oh probably im outdated
are you doing it async
i don't think
ConcurrentModificationException sound like you trying to remove something on list while iterate it?
but i don't know how to break blocks asynchronously
yes it is but it comes from the server directly and not from my plugin and that's the problem
may you show your code? sound like a fixable problem
you are trying to remove a block which is used on the main thread at the same time
á ConcurrentModificationException
where is blocks come from
ok ... i dont understand what your doing xD
normally you can just use:
git status
git add *
git commit -m "random"
git push
un looks good; does the exception been thrown from b.breakNaturally()?
i cant help you with what your doing
i don't think
the error is:
java.util.ConcurrentModificationException
at java.util.HashMap$HashIterator.nextNode(HashMap.java:1445)
at java.util.HashMap$KeyIterator.next(HashMap.java:1469)
at net.minecraft.entity.EntityTracker.func_72788_a(EntityTracker.java:293)
at net.minecraft.server.MinecraftServer.func_71190_q(MinecraftServer.java:910)
at net.minecraft.server.dedicated.DedicatedServer.func_71190_q(DedicatedServer.java:461)
at net.minecraft.server.MinecraftServer.func_71217_p(MinecraftServer.java:778)
at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:624)
at java.lang.Thread.run(Thread.java:748)
In what context do you execute this code
To break trees. I made some code that search all woods and leaves blocks that are next to them and then stores the block in the arraylist
where are you run this code?
wdym?
so is this code been triggered by some event?
yes, BlockBreakEvent
and to try to remove the crash i even tried to run it in a new thread
I dont think run in a new thread fix it
Removing stuff while looping over a collection?
you may print something to console while running your code
wait a min
yea maybe it's because the blocks are stored in the arraylist while it is break?
it may potentially because when you do breakNaturally() it fire another new BlockBreakEvent again
idk
Custom model on the snowball doesn't seem to work. Just getting the missing block texture on it
looks like the problem wasn't what i think
what's your spigot version?
._. I feel like someone already asked you if you are doing it in async
before the bug i wasn't
so i was a bit confused
because if i break a little amount of block asynchronously everything is fine so i though it wasn't the problem 🤷
thanks for helping
i have just a last question, will breaking a big amount of block without async freeze my server?
concurrent exception come in chance; the longer time it take to process the higher chance it will happen
WE have async version to edit world iirc
Never break Async. You can "usually" read fine async, but never change anything async
not sure how the magic happen anyway
mh okay
WE jumps back sync to perform all changes.
hm
set the section to null
you may delete small amount of blocks (partial) each tick
it is complicate in some sense anyway
In config?
that's a good idea
yes
Just call set(path, null)
That will delete it, and if it's a section, it will delete the whole section
private void removeOldRecipes() {
//System.out.println("Removing Recipes...");
Iterator<Recipe> it = Bukkit.recipeIterator();
NamespacedKey dummy = new NamespacedKey(this,"dummy");
it.forEachRemaining(next -> { // <---------- THIS
if(!(next instanceof Keyed)) return;
Keyed keyed = (Keyed) next;
if(!keyed.getKey().getNamespace().equals(dummy.getNamespace())) return;
Bukkit.removeRecipe(keyed.getKey());
});
}
How the fuck can this line throw an error?!
it can ^^
yes but how? why?
concurrent modication error lol
since the Bukkit.recipeIterator() contains a obj with all recipes which gets modified by removeRecipe your iterator has less recipes then it thinks it has
but that's what the iterator is supposed to be for
i know its rly stuppid
when using Iterator.remove, it does NOT remove the recipe
iterator no allow you to remove item during iterate iirc
someone mentioned it a while ago and had the same error
but that's what Iterator#remove() is for
which I used before, but Bukkit seems to not actually return an iterator over the actual collection but just a copy or sth >.<
um
its probably just a unwanted bug ...
make a copy by yourself to see if it fix
you can cast the Iterator<Recipe> to RecipeIterator ^^
but it's weird
?
RecipeIterator?
lol well I won't use NMS for such a simple thing though 😄
I just loop over my already existing HashSet<Recipe> to remove my own ones
it no yet go down to nms anyway
just make a extra list where you add those you want to delete
anyway it's weird though 😄
ya make a copy of recipe by yourself should fix the issue
doesnt seem to do anything
save config after
oh shit
I just do this now
thanks
private void removeOldRecipes() {
NamespacedKey dummy = new NamespacedKey(this,"dummy");
recipes.stream()
.filter(recipe -> recipe.getNamespace().equals(dummy.getNamespace()))
.forEach(Bukkit::removeRecipe);
}
register your command in plugin.yml
howwww
the wiki is confusing
i dont know.. maybe just read how the plugin.yml works ? XD
Hi! How I use the PlayerCommandSend event? How to delete commands here?
cancel event
nah
remove the command from get getCommands() collection
it isn't even cancellable
oh I was thought it is the event which fired when player send command xd
you can just remove String in getCommands()
according to docs
For example?
You did something wrong
you will get this error though
oh lol
because you spelled it differently
the command is "help", not "/help"
Oh thy
so any good way to get current spigot server name? ._.
the capital P?
I ask three times already xd
yes
yes one sec
ok thx ill try again
Thy it's works.
Bukkit.getServer().getMotd()
I mean the name used in bungee server
String str;
int number;
public Object(String str, int number) {
this.str = str;
this.number = number;
whateverList.add(this);
}
}```
Can anyone tell me how to do this properly, im stupid ik :(, it says unsupported operation exception
The home of Spigot a high performance, no lag customized CraftBukkit Minecraft server API, and BungeeCord, the cloud server proxy.
?showerror
er
I always forget the command
ya that's almost work, but I need the name right in the event handling so cannot wait the callback
then ask for it when the first player joins and cache it
hm
?notworking
"Does not working" is a useless statement. Please describe what exactly is not working, what you expect it to do, and what actually happens. If you get any console errors, also ?paste the entire stacktrace.
the server name can only change by restarting bungee
its a basic error, because of my limited knowledge, just tell me how would you add the object to a list upon its initialization
?notworking
"Does not working" is a useless statement. Please describe what exactly is not working, what you expect it to do, and what actually happens. If you get any console errors, also ?paste the entire stacktrace.
I don't ask for the exact error for fun
you dont even have the list "whateverlist" there ???
you probably have an immutable list but since you just say it's a "basic error", noone can really know
thats not the problem, im aware, its defined in another class
yeah but not in that class or that code you showed us .. you can just access stuff from other classes because you use the same name ^^
don't worry, they don't even show the error message, no need to try and guess without the error message
java.lang.UnsupportedOperationException at java.util.AbstractList.add(AbstractList.java:153) ~[?:?]
at java.util.AbstractList.add(AbstractList.java:111) ~[?:?]
i have a list of players, how do i disable pvp in that list?
check entitydamagebyentityevent
ty
then cancel that event is both attacker and victim are players
and if the victim or attacker is in your list
of course abstract lists can not be used to add data. use a real list, like ArrayList
no
?
im back again]
?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. Make sure you use the right channel regarding the topic of your question. Create a thread in case the channel is already in use!
its defined as "public static List<Object> whateverList = Arrays.asList();"
with the same error 😢
or idk what youre asking
this.getCommand("getpearl").setExecutor(new givePearl());
no. dont do that
Arrays.asList is an immutable list, as I already said
so
you have to create a new list
for example
idk but your fast
List<Object> whateverList = new ArrayList<Object>(Arrays.asList(...));
how do i check for player in a list i have
oh ok im grateful for your response
if(list.contains(player)) { // Player is in the list }
ty
np 😄 but next time plssss directly send the error message 😛
How I can detect how much arguments player enter in a command ?
For example I enter /test a b c d e f and my plugin returns 6
gwt tge length of args array?
Thread
hmm checking if attacker and victim are in the same list is hard lmao
Not hard, its only a list
true but still is
if (list.contains(attacker) || list.contains(victim))
oh
When using getNewScoreboard();, why is the server disallowing the visibility of the registered teams (to be clean: the teams are visible over the tab, and the tags are also hidden (because it is set to be that), when using getMainScoreboard();, but when using getNewScoreboard(); nothing will be displayed on the tablist, and the tags are also visible again. Is there a way to fix this? I even made it be in another plugin)
This is why we've been telling you to learn Java. So many of the things you've asked are basic Java knowledge. Please, just take a bit of time to read a Java beginner tutorial. Maybe do some coding practices too before jumping straight into plugin developing.
Otherwise you're gonna have a hard time.
Get string from 2 more arguments
wtf
that's literally one line of code
mfnalex can u check my thread again
?paste
Is there a way to check if the player is still mining
do i need to worry abt this warn
yes
its wont break your plugin
but something is null without you checking it
so it can break in the future
i think so ... ?
and... how.?
do you like nms ?
try {
synchronized (metrics.optOutLock) {
if (metrics.isOptOut() && metrics.task != null) {
metrics.task.cancel();
metrics.task = null;
Iterator var3 = metrics.graphs.iterator();
while (var3.hasNext()) {
enderrider.enderrider.utils.Metrics.Graph graph = (enderrider.enderrider.utils.Metrics.Graph) var3.next();
graph.onOptOut();
}
}
}
Anyone? 😅
Iirc only main scoreboard is synced to the client
did you try PlayerInteractEvent ?
So there is no point of making a scoreboard then? 😄
that only sends it once
.
hmm?
I think
Yea thats it
any fix
Also i think the action of mining is client side
Read the error
I just hope when it switches it sends the abort packet first
if it doesnt im gonna be real sad
idk how to fix that since itss one line ;-;
What does the message tell you
Cannot read field "optOutLock" because "this.this$0.metrics" is null
metrics.task.cancel();
metrics.task = null;
Iterator var3 = metrics.graphs.iterator();
while (var3.hasNext()) {
enderrider.enderrider.utils.Metrics.Graph graph = (enderrider.enderrider.utils.Metrics.Graph) var3.next();
graph.onOptOut();
}```
this part
should i change the null part
Im telling you it isn't
but the stacktrace says line 87
Which part of this is optOutLock
Look again
Shade?
I'd just let maven shade it, yes
The only thing you need to do is instantiate a metrics
Thats it
See its github readme
idk how linksss
Ok not readme
that part is already there in the main class
doesnt it send every few ticks ?
trying to make a player ride a enderpearl
So why do you need metrics
Metrics for riding pearls??
I have a feeling this is too hard for you
smooth riding
ye but i have to
whut
This is either mind blowing
or tottaly dumb
"My animation is laggy, better add bStats to make it smoooth" lmao
lmao
do you have any idea what bstats / metrics does? o0
a big NO
this is what bstats does
it collects about who uses your plugin, how many, what java version they use, etc
ik abt that it keeps some record thats all
I have this code to get a string like wtf is this from /test add wtf is this, I removed add from the string but still print it in the result
it doesn't do anything else
ok
Remove space before add and add space after
Or remove the first element from the equation during join
umm this is better how ?
no
replace "add " not " add "
yea
we are all dumb at some point. expect some ppl
I like this font
Damn thanks
nope pretty sure
then you need packets 😄 or just add it with a pr
pr?
There isnt a packet for that
Im afraid
im stupid
Pull request
I mean there is a start and stop packet
yeah I got that
Is it possible to use the FileConfiguration#isSet(path) method so it ignores the upper or lower case of the path?
contains?
does it ignore upper and lower case?
No, fileconfigurations should be case-sensitive
I should probably verify eh?
e.g. config.contains("path.ExAMpLE") will return the same as config.contains("path.example") ?
And is there a way to make it not-case-sensitive?
create your own system
prob not very efficient but will work system
loop through all the values and chekc
What I extend to make a zombie Custom Mob class?
why sahould you do that ? just always know what you do
hmm okay
madlad gonna add the ultimate customization
the zombie... class...
also @spiral light does verifying make my name same as myspigot one
CraftZombie, Zombie, or EntityZombie?
no just blue
if you dont know it you shouldnt do it probably
But Zombie is just an interface
and CraftZombie implements that interface ... but does not create the entity
you would need to use EntityZombie
Alright Thanks!
Problem with my File Manager class ( custom yml )
so what do i do here for maven
open git bash
maybe google how to use git ^^
should i use protocollib for packet management
idk how to get that
but I would perfer plain nms
if you want multi version support easy you can use protolib but coding it yourself is also cool
me not smart
me dumb
then you no packets use
ah for the break thing ?
tryna make a clickable text
uhmmm cant be thaaaat complicated to make events for that :/ but i am to lazy for adding this to spigot since i dont know why its not existing already ... its worth you make an feature-request maybe someone will add it
events for what-
pretty sure it wont be an event
well idk what youre talkin abt but im talking abt smth like if the player is still mining
just adding event called "BlockBreakStartEvent" and "BlockBreakEndEvent"
how do I make a feature request tho
what type would i put in a method to accept an instance of a class as a param
Object?
hm k
Class clazz ?
?
argument Class ?
how do i iterate over a hashmap?
entrySet
can someone give me a example of setting players armor im reading the doc and i dont get a thing
(i have read docs before but i dont seem to get this one)
would that iterate through the values or keys?
set an item on a slot
for (Map.Entry<String, ConfigManager> set : configManagers.entrySet()) {
}``` i have this, but `set` doesn't seem to be a ConfigManager
Player#getInventory
set.getValue
?paste
How do I check if a date is not longer than 30 days ago from the current time? https://paste.md-5.net/omevecodur.bash is what I have so far
which packet is sent when an entity do something that create particles?
Hi, guys, why doesn't EntityPlayer have getServer(), getServer() and other methods in 1.18.1?
Nevermind, I figured it out. :)
Help
how do I use new HoverEvent?
particle
packet name in nms pls
Double Shift + ClientBound Particle
Hi guys why cant I use colors in messages? Intellij just says unsolved reference
and the + is red
getmemory isnt a string?
getmemory returns a string
not remaped pls
how do i get the item a player is holding?
getItemInMainHand
Get the inventory first
k
public void progressBar(Double progress, int bars) {
int x = (int) Math.floor(progress * bars);
}``` is this a proper way to do double -> int conversion, or is blind casting bad in this case?
seems fine
hey does anyone know how to get Material.HEAD ? Player head i dont know but NOT skull ? Api : 1.9
No.
ThreadLocalRandom.current().nextInt(5)+1
that’d be the quickest way (where nextInt() takes an integer and returns an integer from 0 to the passed integer-1 [hence the +1])
ok ty
I'm trying to serealize an inventory and save it to config
and then fetch it and deserealize it
how would i do that
Hmm to your comfort ItemStack is already serializable and there’s a good api for that
Idk same could be said about inventory
But create an object which implements ConfigurationSerializable properly (guides exist on the web)
and the just use
set(path, customObject);
getSerializable(path,CustomObject.class);
btw conclure .... your code from yesterday did not help xD
you can set private final fields to null but not to smth else 😄
ok but would i make an ArrayList of <Serializable> and then put all the itemstacks in his inv in there and then save it to config
and then get the arraylist back and then deserialize them and loop them and add them to his inv
You can
but it must obv be the correct type
Unsure
Give it a try
h devs
const something = () => {
}``` do u call that lambda or im incorrect
and yes im aware its js
i have a command its registered in both plugin.yml and my main class still dosnt work just shows cant find command
It is indeed a lambda kacper
Is there an event called by bukkit if another plugin (like bungeecord) causes a player to swap between servers?
Or well “arrow function”
In java a Runnable can be considered equivalent to some extent
Would it be login? Or the world swap event like when you go through a nether portal?
Nope
Ugh
can any1 help lol?
The backend servers don’t have any inherit knowledge about proxy behavior
It’s not much to go on as of now
Actually, what I mean is, I’m not looking to differentiate the two
I suggest you provide us with relevant resources