#help-development
1 messages · Page 1567 of 1
gn
share
What was it 🤔
does saveResource display this message? Could not save messages.yml to plugins//messages.yml because messages.yml already exists
could that be the problem
crazy
first you use 1.8, then you don't understand the config api
saveResource will try/not try to overwrite depending on the boolean at the end
That's his reason for being here. You don't have to hate on everyone for not knowing everything you do.
but you don't want to overwrite the existing file since that's the point of a config
so if you have an existing config it will be untouched
when you are testing delete the existing config before loading the plugin
Oh maybe it is that then
<repositories>
<repository>
<id>spigotmc-repo</id>
<url>https://hub.spigotmc.org/nexus/content/repositories/snapshots/</url>
</repository>
<repository>
<id>sonatype</id>
<url>https://oss.sonatype.org/content/groups/public/</url>
</repository>
<repository>
<id>dmulloy2-repo</id>
<url>https://repo.dmulloy2.net/repository/public/</url>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>org.spigotmc</groupId>
<artifactId>spigot-api</artifactId>
<version>1.16.5-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.comphenix.protocol</groupId>
<artifactId>ProtocolLib</artifactId>
<version>4.7.0</version>
<scope>provided</scope>
</dependency>
</dependencies>
It keeps saying com.comphenix.protocol can't be found
Try 4.6.0 as the version?
So it was .getType the whole time? Smh lol
where did you get the dependency info
do you have the repo in your pom
I hate it when you get an error and you just can't find out which or what is wrong
yes
I tried invalidating all the caches
I'm assuming its at spigot's end
spigots /should/ work
what if u take out the duplicate sonatype repo
?
i doubt it has any affect but
Still can't import protocollib as a dependency in Maven because it says it can't be found
rip
what java version is gradle using
sometimes deps get cucked
if its set to project SDK then what sdk is the project on
Im using JDK 16
hmm
gradle is 7.1
should work..
hmm]
looks like I fixed the issue
I switched from implementation(dependency)
to compileOnly(dependency)
o
probs the spigot should be compiled at the start
I thought implementation is same thing as compile
<repositories>
<repository>
<id>spigotmc-repo</id>
<url>https://hub.spigotmc.org/nexus/content/repositories/snapshots/</url>
</repository>
<repository>
<id>sonatype</id>
<url>https://oss.sonatype.org/content/groups/public/</url>
</repository>
<repository>
<id>dmulloy2-repo</id>
<url>https://repo.dmulloy2.net/repository/public/</url>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>org.spigotmc</groupId>
<artifactId>spigot-api</artifactId>
<version>1.16.5-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.comphenix.protocol</groupId>
<artifactId>ProtocolLib</artifactId>
<version>4.7.0</version>
<scope>provided</scope>
</dependency>
</dependencies>
It keeps saying com.comphenix.protocol can't be found
what if u change scope from provided to compile @covert bluff
try
loadbefore: [ LiteBans ]```
or ```yaml
loadbefore:
- LiteBans```
loadbefore is for worlds?
How can you fix it so when you use ' in a a yml file it doesn't display 2 of them?
@granite stirrup
i thought it was for worlds
ok
no loadbefore aint for world
load
is for worlds
i think u have
load: POSTWORLD
and load: STARTUP
The home of Spigot a high performance, no lag customized CraftBukkit Minecraft server API, and BungeeCord, the cloud server proxy.
Just add it as a local jar man if mavens too tricky
double quotes
but not through the api methods, those always save with single quotes
this is my code
public final class Main extends JavaPlugin implements Listener {
private final Map<InetSocketAddress,Integer> playerVersions = new ConcurrentHashMap<InetSocketAddress,Integer>();
@Override
public void onEnable() {
// Plugin startup logic
ProtocolLibrary.getProtocolManager().addPacketListener(new PacketAdapter(this, ListenerPriority.NORMAL, PacketType.Handshake.Client.SET_PROTOCOL,PacketType.Login.Server.DISCONNECT) {
@Override
public void onPacketReceiving(final PacketEvent event) {
final PacketContainer packet = event.getPacket();
if (event.getPacketType() == PacketType.Handshake.Client.SET_PROTOCOL) {
if (packet.getProtocols().read(0) == PacketType.Protocol.LOGIN) {
playerVersions.put(event.getPlayer().getAddress(),packet.getIntegers().read(0));
}
} else {
playerVersions.remove(event.getPlayer().getAddress());
}
}
});
}
@Override
public void onDisable() {
// Plugin shutdown logic
}
public int getVersion(final Player player) {
return playerVersions.get(player.getAddress());
}
@EventHandler
public void onPlayerQuit(final PlayerQuitEvent event) {
playerVersions.remove(event.getPlayer().getAddress());
}
@EventHandler
public void onPlayerLogin(final PlayerLoginEvent event) {
getServer().getLogger().info(String.valueOf(getVersion(event.getPlayer())));
}
No idea what's up
I am new to protocollib
so use " instead of ' when in the yml file
"look at that ' thing" will work the same as 'look at that '' thing'
Sorry should of explained it better I mean that's it does that''s
Hello, I was wondering how I could apply potion effects my npcs using the citizens api
is it possible to make command alias using the setExecutor thingy mobob
you can create aliases for commands in the plugin.yml file
yea ik but
that aint working for me
bcuz im overide other commands
and it wont work if i just set an alias
"5 more minutes and 300 other hilarious jokes you tell yourself at 7:19 am" a book written by me is now on sale in my onlyfans
δ
how am I still working on this
bcuz gae
i caught someone duping in my server thismorning
he fricking put diamond blocks and em blocks
everywhere
alll thru village chests
now players are stacked
@EventHandler
public void onPlayerLogin(final PlayerLoginEvent event) {
getServer().getLogger().info(String.valueOf(ProtocolLibrary.getProtocolManager().getProtocolVersion(event.getPlayer())));
}
why this is show print 754 when im join on 1.12.2 and 754 = 1.16.4 and server is 1.16.5
just does
Stop it
is supposed to say something like 354 because am 1.12.2
SEE
BUT IT IS say ing this
am join the server on version 1.12.2 but it is print 754 why?
Hello, I was wondering how I could apply potion effects my npcs using the citizens api
supposed to print 340.......
u make no sense
is supposed to print 340 the getgproroction version manager method
because am joining server on 1.12.2 version
but it is show 754 ijntead which is 1.16.4
are you using one of the version porting plugins? maybe it's spoofing your version
u mean things liek viaversion?
yeah
Ok letm e try removing The plugin
I thinnk you are in the wrong channel bud
Lol, I think I found a bug. It kicks you if you tab complete this and try to send it in chat
ima thats some serious booty shakign hotdog shit
hmm?
Wdym the command? It's a plugin I'm working on. You mean the code?
Well, the autocomplete causes the bug
you do
Grab the listeners and set it to cancelled
i want to make it
atm i have /ban and stuff
but /litebans:ban
still does normal litebans thing
ohh
You may be able to change the alias in the config
i tried adding litebans:ban as a command
and that made error
then i did it as an alias
and that did nothing
Like you changed the alias in the config?
the litebans config
Possibly
just not
the litebans:
thung
./ban
does my thing
./litebans:ban
does litebans thing
i want mekt litebans:ban do my thing
ohh
Is there any way getting the offline time of an player?
idk
you mean you just want to do /ban and it pops up your gui?
;p
no
that is wat it does already
i want /litebans:ban
to open it aswell
im just gonna cancel the event for it
Yeah, that's what I thought.. Hmm. That's like the built in back-up function for the plugin. Like, it runs it directly from the plugin. Eg. /minecraft:stop obv runs the vanilla minecraft and /bukkit:ver runs from bukkit obv
I'm not sure
k
becaus
advanced bans
does it
it makes essentials:ban
but dw i got it sorted
I dont't think there's a built in way but you could probably grab their IP and use an API to get the time of their city
@EventHandler
public void preProcessCommand(PlayerCommandPreprocessEvent event) {
if(event.getMessage().equalsIgnoreCase("/litebans:ban")){
event.setCancelled(true);
}
}
will this work
The mojang servers don't check for authentication so you can use cracked accounts
bad
Indeed
@EventHandler
public void preProcessCommand(PlayerCommandPreprocessEvent event) {
if(event.getMessage().equalsIgnoreCase("/litebans:ban")){
event.setCancelled(true);
}
}
why thus no work
Especially dangerous because some hacked clients allow you to use a custom name. Thus, if you login to a server as the owner's player name and its permissions system is based only on name and not UUID. Yeah... imagine the rest
It's also possible to do on the official Minecraft launcher through .minecraft/launcher_accounts.json
Which is why authentication plugins like Authme Reloaded are needed when it comes to cracked servers
Ahh, I didn't know you could do it just by editing that file
Yup, you can
But when you open the launcher, you have to turn off your internet first
After you launch the game, that's when you can re-enable it
kids with cracked accounts trigger me
Interesting
I don't see how cracked accounts are accounts
they aint
They're just usernames without passwords
¯_(ツ)_/¯
try without the '/'?
It includes the /
got em
i had to teach them how to go gmc
omg
haha
You can actually even do '/sp'
thats super pickaxe
yo momma
yeah I fucked up, accidentally tried to rely on invoking methods on generic class objects passed through constructors
damn it
what are invoke methods
its the special method i used last night with yo mom
Other than LEGACY_SAND
just using reflections to try to run methods from classes, I wanted to mass instantiate objects via reflections but have managed to corner myself
how can I add potion effects to a citizen NPC?
go in creative then go into inventory find a splash potion of choice
and right click to throw
ezpz
I still feel like this is somehow possible, but I've been at it for well over 12 hours now so I think what I really need is some sleep
this is really dumb
usssinnggg the appiii orrr the citizen PLUGIN
Disregard my question, am dumb
man see you do C# for a week and suddenly you assume things in java work a certain way and they don't
is it possible to use query to get a list of online players
except u use bungee, the servers need to be offline mode there but u still need authentication when connecting thru bungee to the server (Connecting to server via direct IP gets disabled when bungee enabled) and the UUIDs get forwarded to the server
yea
is there any way to pass a class into another method as a way that will still allow me to invoke its methods while still allowing me to pass multiple different classes into that constructor and without forcing me to run instanceof or some other comparison check for every class I add?
Lambda?
how to add potion effect s to an entity object?’
Try this. I am still learning Lambdas but I think this might be what you're looking for.
https://www.programiz.com/java-programming/lambda-expression
In this article, we will learn about Java lambda expression and the use of lambda expression with functional interfaces, generic functional interface, and stream API with the help of examples.
no, not at all
Hmm? It allows you to pass a class into a method and call other methods
It's essentially an Anonymous class passed as an argument in a method
yeah that's not really what I was looking for
hey could i ask how can i obfuscate my plugin like this one?
?paste
ah, okay
https://paste.md-5.net/boziyenihe.java see extendedClass on line 46, that's my issue (I was passing it via constructor, doesn't really matter how I do it it's always generic)
since extendedClass is just Class I can't use it to invoke anything without first casting it
and I can't cast it without comparing it to something
and I can''t compare it to something without having to manually add an entry for every type of thing I want to compare it against
which I specifically don't want to do
okay well and how can i do it?
it was on that page
https://www.spigotmc.org/threads/approved-obfuscators.420746/
Ugh
I can't believe I just now thought of this
I can use a 2 dimensional array for my commands
I feel like there has to be a solution to my issue without doing a deep rewrite
Send pic
How I can bind a minecraft plugin with a discord bot? Anyone knows?
I posted the code above
That I can print logs in a channel
discordjda
Yeah but how
use an api from some other plugin unless you want to waste a large amount of time
hook into the discordjda api
oh, I didn't see it
I'm stuck with the fact that I want it to be generic but also able to invoke methods
which java doesn't like
hm
I can pass the more specific CustomConfigFields class which all of these classes extend but the issue is I am pretty sure it will then invoke things from the non-extended class
Yeah, I'm not sure what's going on there
maybe if I do everything through interface and then override the interface in the extended classes...
that is so stupid it just might work
hm
I don't understand what the extendedClass is suppose to do
the main thing it should be doing is storing the Class so I can invoke a method via reflections
right at the bottom
You see, i don't know what reflections are
it should also be doing another thing but that one doesn't really matter
So I can't help you out there xD
hm
well I'll give it another shot after some sleep, it's been about 14 hours I think
if you use this syntax in plugin.yml is there any way to let the console bypass the permission check?
makes sense, thanks
I want to make a player fly in a rocket like this. How can I do it?
I mean the rocket model u might want to use a custom item model and Then put it on an armour stand and mount the player on it. Then just apply velocities upwards
hmm ok
?paste
since you dont know what xmpp is, you shouldn't use it
https://paste.md-5.net/guzikiseva.cs I didn't use to get this error before... it works on all version except 1.17
you need to read the error. It tells you everything
its null because you are trying to obtain an rsp too early. They are nto registered yet
is it because vault api has to load first?
The perfect senario is you check for vault, then if found you runTask to get teh rsp, so it runs 1 tick after the server is started
That is another way to do it
my plugins depends on vault so I don't need to check
yes you do
really?
y
you can;t get an rsp untill its registered itself
its a messaging thing
you have no use for it
When in yoru code are you trying to obtain the rsp?
I don't know - and given that the plugin is niche I doubt anyone uses it
after I register all commands and events
But perhaps look at the docs first https://wiki.mc-ess.net/wiki/XMPP
So late in your onEnable?
are you depend on vault or softdepend?
depend
is it an eco you are trying to hook?
is there a reason you are hooking vault for perms and not using player.hasPermission ?
not sure really I just knew that lots of plugins use Vault
Your saying it's not necessary for perms?
if you are just testing for permissions then you don't need vault
So permission plugins will work without vault?
Didn't know that
they all push directly to superperms in Bukkit
ok, I'll remove Vault and try again
ffs
I trolled myself
yep
it works, it would've worked if I did the simple thing to start with but I didn't test it
The spigot update URL broke
How are people fixing it
This doesn't work.
https://www.spigotmc.org/wiki/creating-an-update-checker-that-checks-for-updates/
The home of Spigot a high performance, no lag customized CraftBukkit Minecraft server API, and BungeeCord, the cloud server proxy.
<?php
$userVersion = isset($_GET['v']) ? $_GET['v'] : 'unknown';
try{
$url = 'https://api.spigotmc.org/legacy/update.php?resource=46812';
$handle = file_get_contents($url);
echo $handle;
$latestVersion = $handle ? $handle : 'unknown';
echo $latestVersion;
} catch (Exception $ex) {
echo $userVersion;
}
It aint working.
UPDATE:
User-Agent header is required now.
Tip: you can remove the ?__cf_chl_jschl_tk__= and everything after that
I dont quite get where the issue lies, I get 1.17.1b just as intended
when accessed through a browser.
But through code I get a 403 or some other empty response every time
Yea, cf will block you from automating it I belive. Lemme check for sure
Guys , how to make items in GUI clickable to sendMessage
nvm, wget and curl works - so you might be doing something wrong with your code
how do i make my plugin log in the console properly, System.out.println() logs it but it does not show the [PLUGIN_NAME]: Log
getLogger().info() or plugin.getLogger().info()
oh thanks!
Hello, I use PluginMessages on my Spigot 1.12.2 plugin, but the message GetServer is lost when I use it on PlayerJoinEvent. Anyone know how to fix this problem ?
InventoryInteractEvent (InventoryClickEvent)
?paste
Ok but the code , how to check if it the Button
https://paste.md-5.net/oqetanayiw.rb What is the class file version?
If you don't know what it is, consider just supporting everything that supports every java (current) version (i. e. 1.16.5 and 1.17)
The "fix" is dependent on your build tool, so I cannot say for sure what it is
@quiet ice
What the code to make items in GUI clickable
that is done by default
I compiled with java 16 and using my plugin in a 1.13.2 server maybe that's the problem? but I did test the same plugin in 1.8.9 server and it worked flawlessly
That might be because you are not running spigot 1.8.9
Guys. what's the code for Inventory Click Event For GUI
public void event(InventoryClickEvent event){
}
class ClickListener implements Listener {
@EventHandler
public void onClick(InventoryClickEvent e) {
// DO
}
}
magic
I sure love spoonfeeding
What I write inside it ?!@quiet ice
e.google
In my GUI shop I want to use the itemstack amount to show the amount of stock? Is it possible for the stack size to be over 64?
Ok tell me what I write inside it @quiet ice
i don't believe so
@stiff topaz
What I need to write inside inventory click event for gui
it is possible but would also bork a few things
Consider just using things like https://github.com/Phoenix616/InventoryGui they do the job for you
it needs userr-agent.
You likely want something like
ItemStack spoonfeeding = this.is;
ItemStack bad = e.getCurrentItem();
if (spoonfeeding.equals(bad)) {
// code
}
beautiful
See ur dm @quiet ice
Why can I start my 1.8.9 server with java 16 but I can't start my 1.13.2 server?
Hey what's the best way to detect if a block is a real solid block and not snow/slab/stairs etc
1.13+ has stricter java checks, where as 1.8 can easily run on many java versions if native transport is disabled
What do I do then? I compiled the plugin with java 8 but idk if it will work with 1.17 now
It will run with 1.17
There are also at least one 1.8 fork that can run at J11 natively, J16 shouldn't be much of a difference
I'll test and see but everytime something seems to work it doesn't 🙂
Many of minecraft's libraries are still at J5 - J8 and it runs as intended
hey, was wondering why i'm getting a "null" error with this..? new to Java sorry for being bad
package com.ankledev.tabfix;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.plugin.java.JavaPlugin;
import org.bukkit.event.player.PlayerCommandSendEvent;
import java.util.ArrayList;
import java.util.Collection;
public class TabCompleteFix extends JavaPlugin implements Listener {
@Override
public void onEnable(){
getServer().getPluginManager().registerEvents(this, this);
}
@EventHandler
public void onTab(PlayerCommandSendEvent e){
Collection<String> cmds = new ArrayList<>();
for(String cmd : e.getCommands()){
if(cmd.contains(":")){
cmds.add(cmd);
e.getCommands().removeAll(cmds);
}
}
}
}
ok good to know
error in console, when .updateCommands() is called
(when the uesr joins)
ah, that isn't a NPE
It is a CME and I think I know what went wrong here
You can't modify collections while you iterate over them, so you need to create a clone first
so i should Collection<String> ecmds = e.getCommands();?
for(String cmd : new ArrayList<>(e.getCommands())){
if(cmd.contains(":")){
cmds.add(cmd);
e.getCommands().removeAll(cmds);
}
}
should solve the issue
no, that does not clone the collection
oh
im thinking "clone" literally, sorry lol
was also curious about .contains(
it says CharSequence in Eclipse..
but will CharSequence get fooled into becoming a string?
thats what i thought
I do not know why exactly CharSequence exists, but it does
yeah it freaked me out a little
i was worried i'd have to like
.contains(new CharSequence(":"))
but i didnt
You could do cmd.indexOf(':') != -1 which could be a bit faster, but eh noone will care
i tried that
and got the error
and thought "oh thats causing the error"
i actually got a larger error 😳
oh i didnt change it all sorry
im such a noob i feel really bad for flooding this channel im so sorry
yeah, I got confused for a sec there
Not a problem
im running on a little less than 5 hours of sleep, so i didnt see the new ArrayList thing
it works :D thank you so much @quiet ice
Also, there is another way of doing that that could help you, lemme write it up
is it with Packets
No, I mean another way of iterating over this collection
oh
@quiet ice the plugin works like a charm now, thanks.
Iterator<String> iter = e.getCommands().iterator();
while(iter.hasNext()){
String cmd = iter.next();
if(cmd.contains(":")){
cmds.add(cmd);
iter.remove();
}
}
avoids the need of cloning the collection
technically you don't need it, right
programmer instinct is the reason
i dont want to flood this channel with chat, but i did use skript for a while, then i used skript-reflect for a while while, and now im transferring into Java
Hello, I'm here to get help of cuboid class. https://pastebin.com/pv8JFXXL
I know how to set this. (new Cuboid(pos1.getWOrld, pos1.getloc...) But how to paste Cuboid?
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
a
toooooooo
hey guys
I'm running this code here, and the registerPlayer() function is called on a PlayerJoinEvent
Everytime I join the server it registers the player again
oh
Unregister the player when he leaves.
no I want it to stay registered across
Ok, then check if he is registered when he joins
I do
that's what the null check is
it's cause of player instance I think
so I need to use UUID
yes, uuid
Any guides on unit testing plugins around?
Mockbukkit
But it’s a disaster
Well unit testing in spigot is
You essentially need to emulate an entire server
Yeah I'm concerned about all these statics
The only major static thing is the Bukkit class
Just go with Plugin#getServer anyways
It’s properly injected
i want to create custom mob ex villager
then i try to extend EntityVillager class but it couldn't find the class
why
i don't know this is from ide or i do wrong
what build tool are you using ? maven ?
1.17-R0.1-SNAPSHOT
ye
did you follow this example layout ?
for 1.17
wait let me check them
md5 explained rather straight forward how NMS in 1.17 functions
is there a way to check if the block from the blockbreakevent is part of a naturally generated tree?
//Main class
public static FileConfiguration structures;
public void onEnable(){
structures = YamlConfiguration.loadConfiguration(configFile);
InputStream defConfigStream = this.getResource(configFile.getName());
if (defConfigStream != null) {
structures.setDefaults(YamlConfiguration.loadConfiguration(new InputStreamReader(defConfigStream, Charsets.UTF_8)));
}
//Loaded this way since it's not supposed to be edited
}
//Debug method
public static void echoKeys(Player player){
Set<String> r = Echo.structures.getKeys(false);
for(String e : r){
player.sendMessage(e);
}
}
The length / size of the set is 0. Why? The file contains keys and values.
also @tardy delta only way i can think of is logging when a tree is generated
hmm
you could check if there wood would have been generated naturally but that would be prone to errors
wait
I think you wanna stick to this.getClass().getClassLoader().getResource
well thing is
Boolean dd = Echo.structures.contains(args[0]);```
That returns 'true' for the keys
so im a bit at a loss
why does one method work and one doesnt
so u want to check if block is natural and not palced by playe
player?
Yeah they do
for that I will just recommend making hasset and just put specifc block location to
it and later when they brake it
just check if that location is in set or list
and stop code there
Looks alright
Ehhh, this could be kinda expensive on a large world
I’m not sure of a better way though
does anyone know whats wrong with this? I'm trying to change config files, the command runs properly but the config file doesn't seem to get changed
Does your messages send?
he can always use FixedMetadataValue
which he loses after restart
set can be saved to some file on restart
still not sure does that works on normal blocks
or just tiles
how to detect when player have hit an player?
event
EntityDamageEvent
link to doc?
why sad face
Didn’t work
oh xd
It looks like that at every end of line
would you mind opening your log and posting the symbol here?
sure
It is the carriage return character
[13:42:30] [Server thread/INFO]: [38;2;245;134;123mG[38;2;246;142;125mu[38;2;246;151;126ma[38;2;247;159;128mr[38;2;248;168;129md[38;2;248;176;131mi[38;2;249;184;132ma[38;2;249;193;134mn[38;2;213;214;216m [38;2;40;43;63m| [38;2;213;214;216mCommandes disponibles
[13:42:30] [Server thread/INFO]: [38;2;111;115;125m/g [38;2;184;187;194mjournal [38;2;250;137;67mtype [38;2;67;250;140menable [38;2;111;115;125m»[38;2;184;187;194m s'inscrire à un journal
[13:42:30] [Server thread/INFO]: [38;2;111;115;125m/g [38;2;184;187;194minfo [38;2;67;201;250mplayer [38;2;111;115;125m»[38;2;184;187;194m afficher les informations à propos du joueur
[13:42:30] [Server thread/INFO]: [38;2;111;115;125m/g [38;2;184;187;194mfreeze [38;2;67;201;250mplayer [38;2;111;115;125m»[38;2;184;187;194m changer le mode gel du joueur
[13:42:30] [Server thread/INFO]: [38;2;111;115;125m/g [38;2;184;187;194minspect [38;2;111;115;125m»[38;2;184;187;194m basculer votre mode d'inspection[m
hmm what's the difference?
To display line breaks in minecraft, you use the line break symbol (\n), you are using \r
Yeah but I don't understand: in my english config I don't have the issue
\r is irrelevant in minecraft since chat has no "pointer" that can be reset
but I do have it in french
Then show the two configs
how do i generate vanilla structures on lets say a interact event
what syntax is that
toml
no, the syntax inside the multiline string
mini message
hey, i have basic java knowledge and im trying to make a plugin that disables creeper block damage. the code framework itself works but i have no idea how to actually turn off creeper damage and what to import. any idea?
package me.tobias.anticreeper.commands;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import me.tobias.anticreeper.Main;
public class CreeperDamageOff implements CommandExecutor{
private Main plugin;
public CreeperDamageOff(Main plugin) {
this.plugin = plugin;
plugin.getCommand("creeperdamage off").setExecutor(this);
}
@Override
public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
// TODO Auto-generated method stub
Player p = (Player) sender;
if(p.isOp()) {
//block-creeper-block-damage = false
return true;
}
return false;
}
}
Is there needed to add properties in HikariCP so I wont disconnect from my database or this doesnt rly happen in hikaricp connection pool? before, I randomly got disconnected from my database without using HikariCP and I got recommended that.
?paste
hm, you can replace "Diceplugin_config" on "+label+"
@oak flame you can do an EventListener for creeper explosions i think
like here
I noticed the way to send packets has changed, how can I send packets now?
this is mini message syntax
how do i generate vanilla structures on lets say a interact event
((CraftPlayer) receiver).getHandle().playerConnection.sendPacket(packet);```
this doesnt work anymore
I assume I hate to parse it in a diff checker, that will take a while, so be patient
NMS isn't mapped my default anymore
You will have to use obfuscated names or follow the guide in the 1.17 release post
so like addEventListener(creeper-explosion)? sorry if that question is kinda dumb lol i just started using spigot and i dont know a lot beyond the very basics of java we learn at school
have you tried googling?
?eventapi
yeah i only saw forum threads that basically told me to look for a plugin somewhere
thanks! i checked the wiki before but didnt really find ressources
Well that page is exactly what you were looking for
anyone here knows how FileConfiguration works?
Yeah what about it?
because it contains keys and i can get those keys
I don't see any meaningful difference.
I guess you'd need to open a bug report (or look for a previous one) there
but Set<String> r = configuration.getKeys(false) returns a empty set
correction i can use those keys
getting them doesnt work
public static FileConfiguration structures;
//Declared in class, loaded in onEnable
structures = YamlConfiguration.loadConfiguration(new File("structure.yml"));
InputStream defConfigStream = this.getResource(configFile.getName());
if (defConfigStream != null) {
structures.setDefaults(YamlConfiguration.loadConfiguration(new InputStreamReader(defConfigStream, Charsets.UTF_8)));
}
structures.getStringList("Copper");//THIS returns the string list defined( [CCC, CCC, CCC] )
structures.contains("Copper");// True.
structures.getKeys(false);//THIS returns A EMPTY OBJECT! WHY?
I'm honestly not sure
structure.yml:
Debug:
- "CCC"
- "CXC"
- "CCC"
Copper:
- "++CCC++"
- "+CAAAC+"
- "CACICAC"
- "CAIXIAC"
- "CACICAC"
- "+CAAAC+"
- "++CCC++"```
its a big issue tho
i need to iterate over every key in the config
but i cant
since i dont get the keys
urgh if anyone has an idea just ping me imma leave for now
i cant think anymore
How can I change an entityplayer's ping?
Why do you want that
If you mean a real player then you can't
which should be obvious
if i want to ask for if(event.getEntity() == Creeper), do i have to import org.bukkit.entity.Creeper first?
you are looking for instanceof
after that, yes, it would work. But you can also do event.getEntity().getType() == EntityType.Creeper
thanks you so much!
?jd
¯_(ツ)_/¯
?learnjava
Here are some links to get you started on learning Java:
- https://www.codecademy.com/learn/learn-java
- https://www.sololearn.com/learning/1068
- https://www.learnjavaonline.org/
- https://programmingbydoing.com/
- https://docs.oracle.com/javase/tutorial/java/index.html
The last one is the only official one, however some of those concepts assume that you already know a bit about programming.
in my plugin.yml both the author and the commands are flagged as spelled incorrectly even though they arent, should i just ignore it?
pardon me
Google your question before asking it:
https://www.google.com/
@oak flame screenshot it and put it in here
Is there anyway of checking if a https://hub.spigotmc.org/javadocs/bukkit/org/bukkit/event/player/PlayerMoveEvent.html is caused by the player? (e.g. caused from a packet from the client, rather than moved by an entity)
declaration: package: org.bukkit.event.player, class: PlayerMoveEvent
Commands
should look like that
put the author name like author: {name} ???
id about the author part
and
Or, if that's not possible (I can't find a solution online), how would you listen for packets from a player, then you'd only get the events from when the above happens?
maybe you could check player input instead of movement, not sure if theres an event for that
u dont put syntax in the commands
just put creeperdamage:
and for the main
u have to make it direct to the actual main class
how do i use persistent dataholder
?pdc
me.crqpts.plugin
thanks
thanks! i made separate classes for the off and on command which is why i left it in
they have to both be in the same class
the class that extends "JavaPlugin"
if ur talking about onEnable and onDisable
Do i need to handle entity damage event if i want to increase mob damage or i can increase mob damage another way?
how do i run a command in spigot
like
/scoreboard
because i think thats probably the best way to store whether or not the player is a healer or healable
why not persistent data container?
guys how to get portal position from PlayerChangedWorldEvent?
handling scoreboard teams may break some plugins
You shouldn't run commands in spigot like that, if you don't want to use a PDC, I'd use a java hashtable, with a string and a boolean, to store if they're a healer, (if you haven't heard of hashtables they're like python dictionaries)
because it confuses me a lot
Maybe i can help you with this?
yeah but those wont save past restart
sure
thanks
DM me
any thoughts?
Guys how to make /fly command, Enable fly for player and how to make player invs
Spectate
Ok I found it
Setallow flight
yup
then for every other player on the server, you need to use Player#hidePlayer(plugin, player)
declaration: package: org.bukkit.entity, interface: Player
Does spigot allow you to make the external download link bukkit?
declaration: package: org.bukkit.entity, interface: HumanEntity
@noble spire @noble spire
Stop ping spamming wtf
What I write in the setGamemode
there was a working and free /premium command?
new net.minecraft.server.v1_16_R1.PacketPlayOutChat(chat, ChatMessageType.ACTION_BAR, player.getUniqueId());
in 1.16 why is this saying The constructor PacketPlayOutChat(IChatBaseComponent, ChatMessageType, UUID) is undefined
Why are you using NMS for actionbars
Just need an answer for the question. Not a question of my reasoning.
Your IDE should show you the options
Unless you're coding in MS Word
Well this is a spigot server, so people are unlikely to know how to do something in NMS when there's a way easier way in spigot:
player.spigot().sendMessage(ChatMessageType.ACTION_BAR, new TextComponent(message));```
Doesn't exist in earlier versions
hmmm okay
How to teleport player from server to another and when I complete that , where I put the plugin , in BungeeCord or the Lobby Spigot server
Wanna keep the same methods
out of interest, which version are you using?
1.8?
1.8.8 - 1.17.1
Is having an inventory listener for every GUI inventory bad practice?
When was the ChatMessageType parameter added?
idk, well answering your original question, apparently this is the syntax:
public static void sendActionBar(Player p, String message) {
PacketPlayOutChat packet = new PacketPlayOutChat(new ChatComponentText(message), (byte) 2);
((CraftPlayer) p).getHandle().playerConnection.sendPacket(packet);
}
wait a sec
Doesn't work in 1.16
Those params work for 1.8 - 1.15 but not 1.16
Get the version:
((CraftPlayer) player).getHandle().playerConnection.networkManager.getVersion();
?
@noble spire
How to teleport player from server to another and when I complete that , where I put the plugin , in BungeeCord or the Lobby Spigot server
Don't ask me 😳
If they're below version 1.15, then use the packets, otherwise use the inbuilt spigot function
Yeap. Since the question hasn't been answered lol
How to teleport player from server to another and when I complete that , where I put the plugin , in BungeeCord or the Lobby Spigot server
NMS isn't good to use for that specific reason, it changes all the time, through all the different versions
I realy Need this
I can't help much more
Can you elaborate?
What mean by that
explain what you're trying to do, I can't understand what you're asking
I need to know when the ChatMessageType param was added to spigot().sendMessage so I know which versions to use the api on.
Okay, well that's a different question
I want a code to teleport u from lobby server to pvp server and when I finish the plugin I put it in the plugins folder of Bungee proxy , or in the Spigot Lobby Server
Doesn't contain the ChatMessageType param
using ItemStack.getData() is enough to make a perfect copy of an item? same enchantments, same durability, same name, everything that an item can have?
Bungee messaging
Perfect thx
The home of Spigot a high performance, no lag customized CraftBukkit Minecraft server API, and BungeeCord, the cloud server proxy.
It goes in the spigot server
Afaik it is yes
@opal juniper
Thanks !
You can serialise it to a string and then back again
np
good old java importing classes too eagerly
this is a really bad structure and is bound to fail
use a refleciton wrapper instead
I'm usng a switch but testing why its causing the error
Don't want to use reflection for 2 versions
if anything a (well, actually a few) try-catch everything should resolve this issue
How can I "reschedule" a task? It's already scheduled and I want to schedule it to occur again. It is already running and I don't want to stop it.
how do i get the content of a player inventory? besides the armor and left hand, i dont get it, there is no methor for that on the PlayerInventory interface, or i cant see it
I don't have those on my other plugins for methods that act the same way.
just re-register it.
I don't know what exactly is happening here, but I assume that the JVM loads the class too eagerly as it hasn't yet computed the if-clauses. Why sometimes this happens and sometimes it does not (where as it does it in a persistent manner for a given instruction set) is beyond me
player.getInventory().getContents()?
should just give u all the items
right, bc thats inherited from Inventory
yeah
alternatively, #iterator()
thanks
how i can set the timezone of my server?
oh
mayb u can search javadocs for the date object
Why?
because on the console appears the timezone of the host pc
and not my own
and i want to set autorestarts
Hello, does anybody know what changed in 1.17 with packets
I had a code that used packets and it doesn't work anymore in 1.17
Do i need to handle entity damage event if i want to increase mob damage or i can increase mob damage another way?
whats in the spigotActionbar method?
could it be in that function?
or are you using a version below 1.9 for the test
1.9 below I'm using v1_8_R3 1.8.8
does ServerVersion have a .equals
And no its not caused by the spigotactionBar method. Already tried commenting that out.
Returns v1_8_R3
Its the object class. Nothing else
yeap
and .equals compares the information in it
class id
object identity 🙂
Yeap .equals has the same issues.
Cause its my own enumclass
ah ok
sorry im not very experienced in packets
trying to help as best i can
brb
Packets arn't the issue. For some reason this exact same code doesn't work on this plugin but works on my other plugin lol
do u have the packet object imported?
nope
maybe import it
If I import it and the version doesn't match then it throws the error saying class not found.
wait nvm i see what you're doing
I'd like an armorstand to move linearly along a path for about a second after it spawns, then die. Is there any way to accomplish this without delving into NMS?
Currently, I've tried no gravity + velocity, but no gravity disables velocity working.
Marker suffers a similar problem where the armorstand can't move with velocity.
trying to make an exact copy from slot 22 to slot 23, just for testing, but it doesnt work, it only copies the material, but no durability, enchantments, etc
ItemStack[] current = inventory.getContents();
current[23] = new ItemStack(current[22].getType());
current[23].setData(current[22].getData());
inventory.setContents(current);
there is no error in console, what am i doing wrong?
just use ItemStack#clone lol
teleporting otherwise gotta calc the velocity to keep it at the location
the thing is i need to use setContents, the idea is store the inventory, to later restore it
What?
Is this a serialization problem?
Unless you give more context as to why you can't
ItemStack#clone is your answer.
instead of making multiple if statements
:((
try do something like
i forgot how u do it
like mix in the version with the package thing
already tested everything. I'm limiting it to if so I know it will work
net.minecraft.server.(add version here).Packet
i want to store the inventory on a database
Use Item serializers then
If someone downloads 2 different versions of a plugin does it count as 2 downloads or 1
there's one in bukkit
this is a bad idea
That requires reflection and I'm not gonna do that for 2 versions
ok
I say again... I have the same method in another plugin lol No issues
whats the main differences between the plugins
anything big?
maybe you forgot something?
Don't mind the debug it doesn't run because of the error lol
well im lost
Yeap
honestly if this was me i would try import both jar versions
Can't
No its not.
Not the same exact objects but same concept one sec
doesnt 1.9 also have the api for action bar messages?
Nope
This is in a notepad that class I replaced with reflection because its for all versions not just 2
NoClassDefFoundError is a subclass of Error, with try-catch everything I meant catching the Throwable class. You'd also want to try-catch every if-else block as otherwise it'll short-circuit.
Though idk
This sounds really wrong imo
k one sec showing @quaint mantle what happens when I import
yeah ok
private boolean checkList(String[] args, Enum typeEnum) {
for (Enum e : typeEnum.values()) {
String arg = e.name();
if (arg.equalsIgnoreCase(args[0]))
return true;
}
return false;
}```
Does somebody know how the interactive shell from spigot got made? Are they using some library like spring-shell or what do they do?
I can add enum type to method?
Spigot uses jline (I think) and paper uses TCA and something else
catch Throwable, not exception
👍
NoClassDefFoundError is a subclass of Error
is it possible to get the particles a splash potion makes?
Yes
Particle enum :+1:
for example
splash potion in inv
choose what potion to use
take the particles of that splash potion you placed in the inv
save and use that
The home of Spigot a high performance, no lag customized CraftBukkit Minecraft server API, and BungeeCord, the cloud server proxy.
u can try multiple classes
then we would need to look at the bytecode of that method
or somethig else entirely is causing the class to load
oh thank you
Multiple classes kinda works but its not as clean and spreads everything out'
But yea, using different classes that are loaded lazily is the easiest solution
yeah but it works
and its so far the only thing ive found on nms multiple versions no reflection
I believe that it has something to do with the sendPacket method but the question still is WHY, there are a few more classes that are requested before it that could fail but do not. It looks as if something else causes the issue
thats pretty untrue (for the multiple classes not being clean thing), as NMS gets more complex you cant just use 1 class to store it all
I use to xD
One sec
Questionable coding style
the good thing is that this is the sort of class that you need to only code once and that you can forget about it later
i'd even say use MethodHandles lol but thats not needed
and also no encapsulation
oh wait
its a utility class
what
the fact that the method does not return as early as possible is another thing that upsets me
Well it was originally coded 3 plus years ago and I've just added on versions ever since.
Also keep in mind I did say I have since recoded it lol
Nah switched to reflection
Cleaner then multi classes
also doesnt need to use a bunch of if statements for most of those
just get the version string from the package
you see, it is a bad decision to post bad code
https://pastebin.com/t29xawNS the replacement class 😉
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.