#help-archived
1 messages · Page 214 of 1
maybe don't use a version that is over 5 years out of date
1.8 And 1.8.8
@tacit spoke Go in the updates and search for old versions
@frigid ember Search in anchient archives if someone else had this error. 1.8 is very old and outdated.
@frigid ember https://www.spigotmc.org/threads/internal-exception-java-io-ioexception-error-while-write.64922/
Hey guys,
i got the problem that a website cant reach the Port 8195 on my server. I opened the Port at the UFW and its free on my server.. idk whats the matter, can anyone help me out?
@bleak osprey Check open (tcp) ports with netstat -lt
cant see ports in there
oh yes i do
tcp 0 0 v22020041189561149:8195 0.0.0.0:* LISTEN
00:37:42 [SEVERE] [NuVotifier] Votifier was not able to bind to /192.145.46.62:8195```
Yeet
yes
v22020041189561149:8195 What is that??
the server name
No idea... try forwarding 0.0.0.0:8195
v22020041189561149:8195What is that??
@grim halo might be a long addres
How can I run a BukkitRunnable() inside:
public class Spawns implements CommandExecutor {
public static Integer getRandomInt(Integer max) {
Random ran = new Random();
return ran.nextInt(max);
}
public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
if (cmd.getName().equalsIgnoreCase("sp-iasw")) {
//bukkitrunnable
}
return false;
}
}```
Ipv4s can be expressed as a long value by shifting their groups bytes
How can I run a BukkitRunnable() inside:
public class Spawns implements CommandExecutor { public static Integer getRandomInt(Integer max) { Random ran = new Random(); return ran.nextInt(max); } public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) { if (cmd.getName().equalsIgnoreCase("sp-iasw")) { //bukkitrunnable } return false; } }```
@frigid ember I don't suggest you create a new Instance of Random each time you call that method
00:41:38 [INFO] [NuVotifier] Votifier enabled on socket /0:0:0:0:0:0:0:0%0:8195.00:41:38```
Oh that random isnt supposed to be there, I forgot to remove XD
i don't suggest you use Integer where you should use int
public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
if (cmd.getName().equalsIgnoreCase("sp-iasw")) {
Bukkit.getScheduler().runTask(plugin, () -> {
System.out.println("Im running one tick later");
});
}
return false;
}
public boolean onCommand(final CommandSender sender, final Command cmd, final String label, final String[] args) {
if (cmd.getName().equalsIgnoreCase("sp-iasw")) {
new BukkitRunnable(){
@Override
public void run() {
System.out.println("This also works...");
}
}.runTask(plugin);
}
return false;
}
@frigid ember
Lambda ftw
}.runTask(plugin); for plugin I just use Spawns?
> 00:45:37 [WARNING] [/194.169.211.218:45848] <-> InitialHandler - read timed out
> 00:45:38 [WARNING] [/194.169.211.218:45854] <-> InitialHandler - read timed out```
@grim halo
test vote cant be reached
@frigid ember For plugin use your plugin instance
ah ok
is redstone supposed to ignore cancelling physics updates?
a quick question: how can I change my plugin's icon?
Redstone has its own event
a quick question: how can I change my plugin's icon?
@stark oxide in the spigot website i mean
@stark oxide You mean in the forum=
yes
Ok so im stuck at:
private static Spawns instance;
public static Spawns getInstance() {
return instance;
}
public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
instance = this;
if (cmd.getName().equalsIgnoreCase("sp-iasw")) {
new BukkitRunnable(){
@Override
public void run() {
System.out.println("This also works...");
}
}.runTask(this);
}
return false;
}
runTask gives me:
The method runTask(Plugin) in the type BukkitRunnable is not applicable for the arguments (Spawns)
So use the one from my Main?
thanks!
How can I call it from my Main? This is new to me as im used to putting everything in main im trying to understand to make things neater/clean looking
Create an instance of your main and pass it to the constructor of spawns
Create an instance of your main <- Dont
the instance of your main is created by the server
just pass ur main into constructor
and it is a singleton
this refers to the instance you are currently in.
So in your "main" class you pass this as an argument if you want to pass a reference to another class.
Can entities like armorsatnds have custom nbt keys/values?
Yes
Can I do it with NBT API?
Entities have persistantDataConatiners
use the PDC
its for a minigame so it doesnt have to last over restarts
Unless you are on super old versions
im on 1.12.2
Ah
rip you i guess
If it doesnt need to persists you can just use metadata no?
Or a map
if (cplayer.isLeader()) {
p.closeInventory();
p.sendMessage("");
p.sendMessage("§c Are u sure?");
p.sendMessage("§c If yes, type 'YES' on the chat.");
p.sendMessage("");
p.performCommand("clan desfazer");
p.playSound(p.getLocation(), Sound.CAT_MEOW, 1.0F, 0.5F);
return;
}
}
How can i verify if the player send the message "YES" to the chat and the execute the command "clan desfazer"?
Yes or a map...
its for a minigame so it doesnt have to last over restarts
metadata
pretty sure it's dumb though
@frigid ember https://hub.spigotmc.org/javadocs/spigot/org/bukkit/conversations/Conversation.html
Conversation API or listening for the chat and command events
declaration: package: org.bukkit.conversations, class: Conversation
I remember having to serialize it back to it's actual type because it was all strings for me 🤔
@frigid ember https://hub.spigotmc.org/javadocs/spigot/org/bukkit/conversations/Conversation.html
Conversation API or listening for the chat and command events
Will check it, thanks
conversation is the most horrid shit ever imo but it does have its uses
haha
conversation is the most horrid shit ever imo but it does have its uses
What would you use on that case?
To verify the message
I don't know what you're doing here, but I'd probably do what towny does
use a command to confirm and not a chat message
I prefer the freedom of choosing whether I'm entering a command or speaking to chat
the conversation api strips that freedom
i no longer have the choice to use chat
I must respond to whatever plugin wants me to respond before I can talk in chat
I don't know what you're doing here, but I'd probably do what towny does
I just want the player to confirm the action before doing it
also a very good option
How do I set metadata to an armorstand?
ArmorStand#setMetadata(String metadataKey, MetadataValue newMetadataValue)
metadata is horrible
only has these values by default, https://i.imgur.com/cxHkfbv.png
🤢
Does it last when you restart the server/
no
I mean just throwing them in a map is probably faster
https://paste.md-5.net/momekayogi.cpp save and loading hashmap info into .yml file
null for location
line 45: Location loc = Location.deserialize(se.getConfigurationSection(reason + ".location").getValues(false));
nah im in 1.16.1
deathlocation:
e9d30742-403e-4726-8b0f-de85903ede35:
Lazinq fell out of the world:
time: 1596410212700
location:
world: world
x: 230.5
y: 73.0
z: 242.5
pitch: 3.300001
yaw: -4.050001```
then there's getLocation()
for getting it out of a config.yml file?
deathlocation.location
oh wait
When someone has a minute, could they please take a peak at this? https://www.spigotmc.org/threads/custom-recipe-in-custom-recipes.455756/
🤔
You can just directly set the location instead of having to serialize it
set(key, location);
yes and im deserializing it
then use getLocation(key) on it
with loading ive to get the info and put it into the .yml file again
All entities have unique ids right?
"yes"
myes 😏
with a very small footnote of "maybe an uuid collision will happen eventually"
probably not 🤔
@frigid ember
- Dont use '%'
- setIngredient(char key, RecipeChoice ingredient)
So if you want an exact recipe choice:
new ExactChoice(ItemStack)
*ExactChoice only works for ShapedRecipes
how would u guys get location for the player's uuid out of this .yml file
that is formatted like this
ConfigurationSection#getLocation(String path)
And also save it like you are supposed to do
private void saveData() {
dataMap.forEach((uuid, list) -> {
for(Data data : list){
String saveKey = "deathlocation." + uuid + "." + data.getReason() + ".";
getConfig().set(saveKey + "time", data.getTime());
getConfig().set(saveKey + "location", data.getLocation().serialize());
}
});
saveConfig();
}```
Dont .serialize() by hand
^
public String locToString(Location loc) {
return loc.getWorld().getName() + ", " + loc.getBlockX() + ", " + loc.getBlockY() + ", " + loc.getBlockZ();
}```
I had this method
also, can't maps be put into yaml
but someone told me to use serialize so I could deserialise
ideally you would save the world by UUID and not name, unlike the bukkit location serializer
set(key, location) // Serializes already
getLocation(key) // Deserializes
but how can I use getLocation(uuid) here?
depends on where the location is
ItemStack d1 = new ItemStack(Material.STICK);
ItemMeta d2 = d1.getItemMeta();
d2.setDisplayName(ChatColor.translateAlternateColorCodes('&', "&6&lReinforced Stick"));
d1.setItemMeta(d2);
d1.addUnsafeEnchantment(Enchantment.DURABILITY, 1);
ShapedRecipe r1 = new ShapedRecipe(d1);
r1.shape("SSS","SSS","SSS");
r1.setIngredient('S', ExactChoice(Material.STICK));
Bukkit.getServer().addRecipe(r1);
``` getting an error for ExactChoice
ExactChoice is not a method but a class
Ah
getConfig().set(saveKey + "location", data.getLocation());
deathlocation:
e9d30742-403e-4726-8b0f-de85903ede35:
Lazinq fell out of the world:
time: 1596410212700
location:
world: world
x: 230.5
y: 73.0
z: 242.5
pitch: 3.300001
yaw: -4.050001```
String saveKey = "deathlocation." + uuid + "." + data.getReason() + ".";
Location loc = config.getLocation(saveKey + "location");
Does anybody know of a library or method that can parse a String into a String array while taking into consideration quotation marks similar to command prompt or a terminal of some sort?
Also new ExactChoice(Material.STICK) is not valid as it takes ItemStacks only
in order to get the location from this
you need to know the UUID and the death reason
could just be formatted into this
deaths:
%uuid%:
%int%:
time: //time here
reason: // reason
// location serialized with set(key, location)
🤔
keying it by int will let you save every death in the file
keying it by reason will only let you save 1 death per reason
How can I show a title to all players in a server?
ohh ok
show a title to one player on the server
and then repeat that for all of the players on the server
How can I get an array of players so I can loop through it?
Bukkit.getonlineplayers
Thanks
ideally you'd use a list of maps
instead of a map of maps keyed by autoincrementing number
but it probably doesn't matter
and what is list here
no idea, probably list of locations
oh it's the data stuff, https://i.imgur.com/luUL4oa.png
well this is a map
reason, time, etc
and it's a mess 🤔
though your link was a Map<UUID, Map<Integer, Map<String, Object>>>
That looks like it should be encapsulated in a ton of new classes...
this, i mean
deaths:
1234-56789-2348-2394-294:
1:
time: 12345678
reason: "Ha you dead!"
location: // Serialize
2:
time: 12345790
reason: "You dead again!"
location: // Serialize
good enough
this is a map holding maps holding maps
I don't serialize maps e_e
needs to be a map holding lists holding maps reeee
Unless they're this type of map, https://i.imgur.com/nXbsJ32.png
then I may serialize it
deaths:
1234-56789-2348-2394-294:
- time: 12345678
reason: "Ha you dead!"
location: // Serialize
- time: 12345790
reason: "You dead again!"
location: // Serialize
oh is that how maps are serialized 🤔
that's how a list of maps looks like yeah
never serialized them, so I never saw the output of em'
like idk if a hashmap holding lists holding maps would actually get serialized into this by the bukkit config api
well, I serialized them once but for item serializing
but this is how a dictionary of lists holding disctionaries looks in yaml
i get cancer from the bukkit config api
thankfuilly my config framework is set up in such a way that I can leave and forget the serialization and shit in a specific class
and then pull complex objects directly from the config
I should go find a lib that save comments and such 🤔
plugin.config().SOUNDS.BONFIRE_LIT.val().play(player, player.getLocation());
better than getConfig().getStringList("sounds.bonfire-lit").forEach((s) -> (player.playSound(Sound.valueOf(s))));
or do you disagree
not really
the more verbose way to do it would be to
SoundsKey.SoundSet soundsToPlay = config().SOUNDS.BONFIRE_LIT.val();
and then call .play on soundsToPlay
but there's no reason to be that verbose imo so i just do it in a single line
this also lets me refactor shit directly without running around in 20 million places looking for strings that represent paths in the config
🤔
plus the ide can actually suggest config paths to me now 😎
config().SOUNDS. + ctrl-space shows me all of the subkeys under the sounds configurationsection
does anybody know of a library or method or something that can turn
hello this is "test string" and it has a space in it, but it is still it's own argument
into these arguments:
hello
this
is
test string
and
it
has
a
space
in
it,
but
it
is
still
it's
own
argument
can anyone explain to me why this happened? I dont think i have the logs anymore but a while back my server started spouting weird stuff about chunks on startup (I think something about it not being able to find it but take that with a grain of salt) recently I went to the end and saw chunks that were not how they normally are, like this isnt even the original terrain
because of this I got an automatic backup set up incase anything like this happens in important areas like some of my big builds
String[] arguments = "hello this is test string and it has a space in it, but it is still it's own argument".split(" ");
that doesn't produce the result I have shown
command arguments/tab completions?
this string contains "an argument" which has spaces -> this, string, contains, an argument, which, has, spaces
yeah
well
ACF has that except it's with |
I wanted it to be like command prompt or a terminal
where strings help keep arguments encapsulated
double-quotes i mean
and the double-quotes can be escaped as well
@quick arch acf?
Aikar's command framework
do you know what method it is?
oh it uses annotations
so would it be something like
convert(String) and it will give a string array
no
damn ok
no that is not what i am looking for sorry
oh
String original = "hello this is \"test string\" and it has a space in it, but it is still it's own argument";
String[] arguments = original.split(" ");
List<String> editedArguments = new ArrayList<>();
for(int i = 0; i < arguments.length; i++) {
String arg = arguments[i];
if(arg.startsWith("\"")) {
arg = "";
for(int j = i; j < arguments.length; j++) {
if(arg.length() > 0) {
arg = arg+" "+arguments[j];
}else {
arg = arguments[j];
}
if(arg.endsWith("\"")) {
i = j;
editedArguments.add(arg);
break;
}
}
}else {
editedArguments.add(arg);
}
}
for(String args : editedArguments) {
ConsoleOutput.log(args);
}
editedArguments.clear();
```Outputs: https://i.imgur.com/Lgh6tQS.png
https://i.imgur.com/HI3MqkM.png
(Yes I know its dirty code. Make your own if you want it cleaner lol)
@patent monolith
i just finished mine
public static String[] getArguments(String raw) {
Objects.requireNonNull(raw, "arg0:java.lang.String");
raw = raw.trim();
List<String> arguments = new ArrayList<>();
char[] chars = raw.toCharArray();
boolean escaped = false;
boolean quotes = false;
StringBuilder argument = new StringBuilder();
for (char c : chars) {
switch(c) {
case ' ':
if (quotes) {
argument.append(c);
escaped = false;
} else if (argument.length() > 0) {
arguments.add(argument.toString());
argument.setLength(0);
}
break;
case '\\':
escaped = true;
break;
case '"':
if (!escaped) {
if (quotes) {
quotes = false;
} else {
quotes = true;
}
break;
}
default:
argument.append(c);
escaped = false;
}
}
arguments.add(argument.toString());
return arguments.toArray(new String[arguments.size()]);
}
rip
How to get a player's EditSession to undo after they have pasted a schematic within my plugin?
worldedit 6.1.5 btw :3
hey guys im just getting started into developing plugins, so u guys have any yt channels or smth that could help? ping me
thesourcecode's bukkit tutorials is a great start @elfin juniper
can someone help me out
im mind blanking
has support for wildcard permissions been removed from any recent version of spigot
for some reason i feel like it has and that's why my stuff is breaking
Hello good night, a question is that it happens to me for the first time I bought a premium complement but it has not been released. What would be the problem?
Whats the best way to go about playing a sound from the resource pack to a location with say a 14 block radius? I'm usually sending direct to a player so radial to all in an area is new to me.
This is what I have: (yes I know its shotty)
Random randr = new Random();
String[] soundlist1 = {"westernsfx_01"};
int index = randr.nextInt(soundlist1.length);
p.playSound(p.getLocation(), soundlist1[index], 1.0F, 1.0F);
how come i cant use viaversion
@elfin juniper try CodeRed he’s pretty good as well, explains thing throughly, and his videos are relatively new. Also although thesourcecode’s videos are old they’re still pretty relevant.
@patent monolith want a more efficient solution?
private static final Pattern ARG_PATTERN = Pattern.compile(
"(\".*?\"|[^ ]+)"
);
public static String[] getArguments(String input) {
return ARG_PATTERN.matcher(input)
.results()
.map(it -> it.group().replaceAll("\"(.+)\"", "$1"))
.toArray(String[]::new);
}```
@elfin juniper most of the source codes videos are fine, but i would also recommend technovision for the setup as he goes a little more indepth on the updated versions
When using TSC videos you need to make certain you're using the recent videos
🤔
hey can yall help me with my viaversion?
its in my plugins folder but its not letting me connect
Is there a default setting for how long stuff lasts after someone dies. I just switched from vanilla to spigot and my players say the timer seems much shorter.
can i put 2 event handlers in 1 class?
k ty
@wild ivy fairly certain the default of 5 minutes hasn’t been changed in Spigot
You’d have to check the spigot.yml, it probably has that as a setting
@wary ledge yes
Don’t forget the @EventHandler annotation for each method
so this should work
public class Count implements Listener {
HashMap<String, Integer> jump = new HashMap<String, Integer>();
public HashMap<String, Integer> getjump() {
return jump;
}
@EventHandler
public void event(BlockBreakEvent event){
Player player = (Player) event.getPlayer();
Random random = new Random();
int R = random.nextInt(20)+1;
if (R==10) {
if(jump.get((player.getName())) == null) {
jump.put((player.getName()), 0);
}
else {
if (jump.get((player.getName()))>=94){
jump.put((player.getName()), jump.get((player.getName()))+1);
}
else {
jump.put((player.getName()), 94);
}
}
player.addPotionEffect(PotionEffectType.JUMP.createEffect(10000000, (jump.get((player.getName())))+0));
}
}
@EventHandler
public void event(EntityDeathEvent event) {
if (event.getEntityType() == EntityType.PLAYER) {
Player player = (Player) event.getPlayer();
player.addPotionEffect(PotionEffectType.JUMP.createEffect(10000000, (jump.get((player.getName())))+0));
}
}
}```
Yes, assuming you added the listener when you initialized the class
K, I'll look for it there, thx. Just got started and haven't really had a chance to jump into the plugins. My players wanted modded 1.16...but I had to create offspring instead.
getServer().getPluginManager().registerEvents(new Count(), this); but this adds the entire class
bukkit...registerEvents(...)
Correct, that should work fine
A bit of testing should confirm it
Are there even sufficient mods for 1.16 yet?
Dunno. Another reason I was waiting a bit.
Don’t think that’s related, might be an importing/build setup error?
pointing at the end of events
?paste
there isn't anything to paste
The formatting is weird on mobile, could you paste it there please?
probably because it's also called event (method name)
well i mean it prob does work but i can't get it to compile
that's some wack indentation
it appears that your first if is encompassing the rest of the class, i'd fix that (it isn't, but the indentation suggests it)
so if i rename the method to event2
do i just change the method name or everything event
that might be it... I'd rename the methods
something more accurate
public void onDeath() and onBlockBreak()
other than that I strongly recommend formatting the class properly, the indentation is throwing me off way too mukch
@EventHandler
public void event(BlockBreakEvent event){
Player player = (Player) event.getPlayer();
Random random = new Random();
int R = random.nextInt(20)+1;
if (R==10) {
if(jump.get((player.getName())) == null) {
jump.put((player.getName()), 0);
}
else {
if (jump.get((player.getName()))>=94){
jump.put((player.getName()), jump.get((player.getName()))+1);
}
else {
jump.put((player.getName()), 94);
}
}
player.addPotionEffect(PotionEffectType.JUMP.createEffect(10000000, (jump.get((player.getName())))+0));
}
}
the way this indentation is, it's suggesting if (R==10) { is outside of the event(BlockBreakEvent event) method
it makes me think you're missing a curly bracket
@EventHandler
public void event(BlockBreakEvent event){
Player player = (Player) event.getPlayer();
Random random = new Random();
int R = random.nextInt(20)+1;
if (R==10) {
if(jump.get((player.getName())) == null) {
jump.put((player.getName()), 0);
} else {
if (jump.get((player.getName()))>=94){
jump.put((player.getName()), jump.get((player.getName()))+1);
} else {
jump.put((player.getName()), 94);
}
}
player.addPotionEffect(PotionEffectType.JUMP.createEffect(10000000, (jump.get((player.getName())))+0));
}
}
@EventHandler
public void event(EntityDeathEvent event) {
if (event.getEntityType() == EntityType.PLAYER) {
Player player = (Player) event.getPlayer();
player.addPotionEffect(PotionEffectType.JUMP.createEffect(10000000, (jump.get((player.getName())))+0));
}
}
discord is messing it up
+0 ?
it was for my IDE
Could you try seeing if a separate piece of code works in a different class?
Like just try setting a random player's health to 0
and see if the IDE throws an error
is this maven, gradle, or have you added the libraries manually?
maven
have you successfully used maven in the past?
Could you send your pom.xml?
so the issue is resolved?
ummmm
maybe
he plugin is broken in game
could be my hash map
the way i tried to use my hash map from my other class didn't work
wait no
i might have gotten it
just dont't know why this wont work
getServer().getPluginManager().registerEvents(new Death(), this);
So @past orbit what is the important part of the command you're trying to get? You know that the player wants to toggle god, but what other info do you need if it's not for themselves?
@wary ledge where are you calling it and what exactly do you mean by wont work?
you are correct, it won't work without it, but how do you know it isn't working? is the code simply not running? are there errors?
nvm
So RAGING do you agree that the code can assume if the sender doesn't specify a player they intend to target themselves?
in other words, if the player simply ran /god without a name, they meant to target themselves?
Excellent! Since the arguments that came with the command are given in a String array (String[] args), you can check the length (ie. how many arguments were given after /god <args>) with args.length
For example:
if(args.length == 1) {
// The player executed /god <player>
} else {
// The player specified either only /god or /god [too many arguments]
}
Hopefully this is all making sense so far?
Great, let me know if anything is confusing, I know arrays can be confusing.
To simplify, arguments that are supplied with a command are put into the args array, so args[0] would be the player name you want
if someone ran
/testcommand hello how are you
args[0] would be hello
args[1] would be how
args[2] would be are
etc.
Since you want to allow /god [name], args[0] means you only want one argument the be specified, so you check if the sender gave 1 argument
ok so everything should work
if i can figure out how to access the hash map
from the other file
You would probably want to keep an instance of the listener in your main file and have a public method to retrieve the hashmap in your listener file
but the hashmap is in listener
Yes, if you keep the instance of the listener in your main class you could do something like plugin.getListener().getMap()
Ahhh I see
How can I check if a player is invulnerable due to the invincibility given for the short amount of time after a player takes damage?
but the player isnt actually invulnerable
they just cant take damage for that time
are you sure that would work
Ok so you know when u punch a player u cant just have 50 cps and do 50x damage, minecraft has a time when the player cant be damaged at all
it happens when u punch the player
Player target = null;
if(args.length == 1) {
if(sender.hasPermission("staff.command")) {
target = (Player) bukkit.getPlayer(args[0]);
} else {
// Send no permission command, or default to sender
// if you send no perm command remember to return true;
}
} else {
if(sender instanceof Player) {
target = (Player) sender;
} else {
// Tell the console sender to specify a player
return true;
}
}
That's something that I'd do RAGING
@spring coyote Player#getNoDamageTicks and setNoDamageTicks
https://hub.spigotmc.org/javadocs/spigot/org/bukkit/entity/LivingEntity.html#getNoDamageTicks()
declaration: package: org.bukkit.entity, interface: LivingEntity
thx
That way RAGING you have both the sender and the target, they may or may not be the same person
however you only have to run the setInvulernable and other code once, for the target
do entities not have nodamageticks?
Pretty sure all entities have noDamageTicks
You might also be interested in setMaximumNoDamageTicks
oh well it wont get the nodamageticks of the entity
what mc version?
1.16.1\
No problem, what exactly are you confused on?
Have you modified your current code at all?
@spring coyote could you try casting to LivingEntity?
Yeah I just looked at the javadocs and saw it only works for livintentity
thx for the help
👍
so RAGING we can go line by line
public void onCommand(...){
Player target = null;
if(args.length == 1) {
if(sender.hasPermission("staff.command")) {
target = (Player) bukkit.getPlayer(args[0]);
} else {
// Send no permission command, or default to sender
// if you send no perm command remember to return true;
}
} else {
if(sender instanceof Player) {
target = (Player) sender;
} else {
// Tell the console sender to specify a player
return true;
}
}
no problem, glad I can help
The first line we create a Player variable that will act as the target
at the end of this logic the target variable will be the player that we want to toggle/enable god mode one
This would all be within the onCommand scope
This means you can use it further down the line within the command method
Why do falling blocks with non downward velocities always have such issues syncing with the client?
Am I missing something?
I'd guess the client always enforces gravity acceleration?
There might be a way to turn gravity off
Do you by any chance have a youtube video explaining what you're talking about?
Err not a good one
But try doing a falling block entity
gravity off
Some random velociry
it lags back if its left for any period of time
Maybe the client doesnt simulate drag?
but the client is running the server
so jt makes no sense
if a block doesn't have a downward velocity then how is it a falling block o.O
Its what its called in the code
anyways, the reason for a block going back is because the client predicts how the block should move and doesn't really anticipate that the server doesn't want it to move
Frostalf please dont respond to my questions you never help
you dont understand whats going on
your issue is client prediction
unfortunately it isn't always easy and sometimes impossible to get around that issue
what should i use for a no pvp delay for 1.16
there is an attribute @twilit orchid called attack speed
i mean what plugin
I want to start making plugins but I don't know how to start, I have been told that they can be done without putting anything, if someone were so kind to pass me a video or something.
The client simulates the server
@frigid ember do u know the basics of java?
they can be done without putting anything ?
More or less a little
ok thats good enough, i find spigot a great way to learn java tbh
this youtuber is good, also, even though it says 1.15 it still works for 1.16 and most likely 1.17
But I don't know if the same applies with intelj which is where I work the plugins
The coding would be exactly the same
Once you have everything set up it shouldnt be too difficult to follow along with the tutorials, i think that only the setup of putting the spigot api in would be different
I already know that, but what I mean is that if I have to download something, I know you can download the spigot libraries but they told me that in Intelj they don't need to.
That applies to any IDE that supports Maven/Gradle
that's simply because Maven/Gradle automatically download it for you
The home of Spigot a high performance, no lag customized CraftBukkit Minecraft server API, and BungeeCord, the cloud server proxy.
Thanks
@torn robin Is there any reason the client wouldn't properly predict velocities for falling block enitities?
The client has all the code
Why does it predict it to go farther than it does?
tps is 20
I'm making a small plugin to check it out
Wow, nice, thanks
I'm trying to actually make some small moving structures
But without consistent movement, it's impossible
it probably does predict velocities correctly
however it probably has problems when the velocity is 0
that would be a bug if you ask me since the client should account for a velocity of 0
also, the client doesn't simulate the server unless you are playing in single player
so from what I looked at, if the NBT tag is set for NoGravity the falling block shouldn't fall
however, falling blocks have a max lifespan of 30 seconds, 5 seconds in some situations before turning into a dropped item
so maybe ensure the nbt tag is actually being set on the falling block is all I can say
if it is set, then it is a client bug
assuming no other plugins are at play
@past orbit ?
how could i set a zombie to drop items from the fishing loot table? so far i've got something like Zombie fishingZombie = (Zombie)evt.getLocation().getWorld().spawnEntity(evt.getLocation(), EntityType.ZOMBIE); fishingZombie.setLootTable(LootTables.FISHING); fishingZombie.damage(200);
@wheat mirage https://youtu.be/SCgyt9JM27c
I was able to get a basically still FallingBlock by setting the velocity to .00001 in the Y direction
@torn robin Interesting
Im not using low velocities
Yet they still seem to desync
It could be prudent to note
Its not all the time
Id say 1/5 blocks
Also, launching them in groups means they tend to lag back together
Or not at all
Try a reasonable velocity over a long distance
To clarify you want to say launch a wall of falling blocks moving perfectly horizontal?
Indeed
The desync is indeed strange
I wonder why it tends to happen for many blocks or none at all
Timings are good though
@torn robin Theres a popular mc bug on the tracker talking about minecrafts tendency to round values fairly inconsistently. However this shouldnt be related at reasonable speeds on all axis.
@past orbit I'll look into that in a bit, it could definitely be optimized a bit
(rounding errors in packets, specifically)
@past orbit I think spigot has a built in API for command permissions IIRC
could be wrong
But I recommend it
[23:31:40 INFO]: miningX: -113
[23:31:40 INFO]: miningY: 98
[23:31:40 INFO]: miningZ: -496
[23:31:40 INFO]: targetX: -113
[23:31:40 INFO]: targetY: 98
[23:31:40 INFO]: targetZ: -496```
```java
if (mining.getLocation().getBlockZ() != targetBlock.getX() || mining.getLocation().getBlockY() != targetBlock.getY() || mining.getLocation().getBlockX()!= targetBlock.getZ()) continue;
is there an issue with my syntax? wtf
Bukkit.broadcastMessage("miningX: " + mining.getLocation().getBlockX());
Bukkit.broadcastMessage("miningY: " + mining.getLocation().getBlockY());
Bukkit.broadcastMessage("miningZ: " + mining.getLocation().getBlockZ());
Bukkit.broadcastMessage("targetX: " + targetBlock.getX());
Bukkit.broadcastMessage("targetY: " + targetBlock.getY());
Bukkit.broadcastMessage("targetZ: " + targetBlock.getZ());```
???
Store them in variables
Data types may have some issues
Then broadcast the variables
getX for block is an integer
getBlockX for location is also an integer
same types
So you know what youre comparing is the same as what youre broadcasting 100%
Variables
Please
Give us the full class
cant help with just that
which class?
ok so basically
currentMining is always null
but when it broadcasts
there is an instance of my Mining object
that has the same coords
Dyde
Youre using getblockx
in the z check
USE VARIABLES
and also
Respect your line lengths
Press enter a few times
Theres an actual name for it
But dont make them that long
lol
or you miss errors
doubt
Anyway
Enjoy your fix
change x to z
follow proper conventions
or go somewhere else
Dont want to help make bad code
Youre the kind of developer that gets cursed out by anyone who inherits your code
The conventions exist for a reason
also id like to point out that technically getBlockX is a variable, its just stored somewhere else lol
Id also like to point out your code looks like trash
And that wasnt my point
Cya!
Lol just because you follow every goddamn rule of code doesnt mean you are some demi god? I actually care about clean code, Im not trying to argue im trying to get something done.
Looks like the wall still moves pretty smoothly
what range of velocity are you trying to achieve?
@torn robin In bed rn its 6am
So cant record myself sorry
I think its probably around 1 on each axis
Try a large amount of entities
Thanks
@buoyant path I turned your code into better code and instantly found your problem
The conventions are there to help you too
Generally I follow java conventions
Maybe you wouldnt need to cry on discord about how your debugs dont work if you actually dollowed them
I just didnt in this instance
I wouldnt have been doing this for 5 years if I didnt use conventions lmao
@torn robin Try different instances of them
@torn robin Sorry for lack of detail, I'll get you a video tomorrow
IronMan it looks like the issue was you were using getBlockZ with == getX
You should be using either only getBlock== getBlock or get_ == get_
also of course make sure you're not mixing up xyz's
getX for blocks returns the same as getBlockX would for the location
what exactly do you mean by different instances?
and Im not going to be generating an instance of Location
I looked through the code in spigot and all it does is plug the x y z variables from block
straight into a location
@torn robin As in doing multiple indpendent walls
I got it dont know why it wasnt working
He was using x in a z check
oh thats cool
YOURE USING X IN A Z CHECK holy fuck lmfao
i said that twice
i solved your problem using
give it a read
once y'all are done could someone help me out with some setup im way out of my depth here
x doubt
Go ahead Roan
I setup a custom scoreboard for my server and I want to display the top 5 players from a scoreboard objective. Do placeholders exist for this?
yea well so I made a regular server, like with the server.jar and that was working fine, and ive tried to carry over as much as I can to the spigot server, mainly the ip adress thing, and it doesnt seem to be connecting
@wheat mirage want me to name the java conventions off lmao
you guys are like plats in rocket league
if you arent JSTN
you arent shit
I guess?
NotOliver sounds something that a plugin would be better suited for
Ill let you help other people but please actually help with the issue at hand
I'm assuming you've changed the ip-address in server.properties?
yes
Have you tried setting it blank or to 0.0.0.0?
I have not, I can though
Also I'd strongly recommend just using a host lol
also you're implying you got it working with a vanilla server?
Are you connecting on your own computer?
Magic 🧙♂️
sorry for bothering you
No problem, glad you solved it 👍
@wheat mirage
I made them follow me every tick and didn't see any significant desync
lol, making blocks follow you
I believe the issue might be whether the nbt tag is being set or not or there is other plugins doing things
Highly doubt this is a client problem unless they are using an older version =/
@torn robin for your initial example does velocity never decay? firing a block straight out with velocity and no gravity should make it slow down after a while
I've tested it with both decay and no decay
Has anyone noticed that if you place down 2 mushroom blocks next to each other and place redstone on one of them, it will update the states of the blocks, and even when it's cancelled, it will still update it?
this is my plugin for spawning islands
and i want to make it be able to undo
im using worldedit api btw
can anyone help me?
Player p = (Player) player;
EditSession session = WorldEdit.getInstance().getEditSessionFactory().getEditSession(p.getWorld(), -1, p);
session.undo(session);
i've tried that so far
but it threw an exception
cuz you can't cast WorldEdit's player to Bukkit.Player
probably wanna go to their discord instead
can you dm me an invite?
is it safe to use Bukkit.getScheduler().runTask(plugin,runnable); inside another thread or do I have to use Bukkit.getScheduler().runTaskLater(plugin,runnable,1) when I want to do something inside the main thread from another thread?
Bukkit.getScheduler().runTask(plugin,runnable);
use this if you want to make something in main thread
thanks!
yw
if I can't open build tools
Build tools does that mean it's done?
it might be norton firewall being really annoying
yeah I turnt it off and I ca open it again
"can't open build tools" Do you use git bash or a .bat script to run BuildTools?
I used the .exe
That is unsupported stuff ^^ you need to nag the author if you want support for 3rd party tools.
alright cheers, my problem kinda just sorted it self out anyway.
does anyone know in 1.8 the packets to make an iron golems arms do tyhe attacking animation
tried this but doesn't seem to be working
"Some routers may allow you to disable UPnP. In that case, please refer to your Router's manual in order to enable it."
do I need to disable or enable it
Q~Q
this is for beacon
which apparently is the offical way to portfoward.
let me see on mine
mine disabled @drowsy furnace
but i doubt this is what you need for port forwarding anyway
Default is still 25565
thanks
At the native english speakers. Does this make sense?
"There are X force loaded Chunks in this world."
"From whom Y are loaded by FCP."
nvm whom is only fro ppl.
it makes sense to me 🤔
does anyone know in 1.8 the packets to make an iron golems arms do tyhe attacking animation
@silent kiln why are you passing the handle in first argument
Wouldn't it just be the golem entity
is there any way to get if an item is a sort of arrow
ItemStack arrow = new ItemStack(Material.ARROW);
@rare prairie as in tipped arrow or spectral arrow or arrow all in one class
i was trying to check if a property in the config is empty, which in my case it is, but the fullSetting != "" is still true
even though it seems to be ""
String#isEmpty
maybe you have a hidden space in the config
pretty sure they are different materils for those
@tiny dagger is there any class that can get them all into one
no, you can make one
oh nvm i just had to use string.equals
!= null
Just to see if i understand, if all is set up, will this - statement.executeUpdate("CREATE TABLE test ();"); create a table named test? (SQL)
Add "if not exists"
DeathInfo:
e9d30742-403e-4726-8b0f-de85903ede35:
'2':
location:
==: org.bukkit.Location
world: world
x: 182.30000001192093
y: 66.0
z: 224.30030996357354
pitch: 36.000366
yaw: 116.70021
reason: Lazinq was slain by Zombie
time: 1596454816759```
Is created in the config by doing the following:
```java
private void saveData() {
dataMap.forEach((uuid, list) -> {
List<Data> deaths = dataMap.get(uuid);
for(Data data : list){
String saveKey = "DeathInfo." + uuid + "." + deaths.size() + ".";
getConfig().set(saveKey + "location", data.getLocation());
getConfig().set(saveKey + "reason", data.getReason());
getConfig().set(saveKey + "time", data.getTime());
}
});
saveConfig();
}```
so I want to locate ALL info about the player in the config
this only locates 1/2
@neon matrix sorry I dont understand that at all
how do i check if an item can have ddamage?
what is the enchanting playsound id
just look it up with the command playsound or sound and that use tab to find it
Is there a simple way / plugin to fix Nullping + Authsmasher and stuff
how do I change plugin priority?
May I ask can I use bungeecord with forge?
I believe you can.
So what to combine it to use with
Normal bungeecord + Cauldron server
Like normal bungeecord
with a spigot server
but instead of spigot use cauldron or something
@hollow thorn just make a method or a check
how should i use a timer?
like for example a timer used in bedwars for when the diamond or emerald gens will upgrade or something
how should i use a timer?
@blazing burrow https://bukkit.gamepedia.com/Scheduler_Programming
okay thanks
wait yeah no @vernal spruce i tried runnable already
do i have to use runnable
there isnt really a way to have a timer otherwise
yes okay
im storing info in the hashmap <UUID, List<Data>>
Data -> datafile, the list is to store for example 3 values for one player, which you guys could probably already guess but am I able to save the whole list of data to the yaml file like this: https://paste.md-5.net/dajodetaji.coffeescript instead of https://paste.md-5.net/ulimuvuzaz.coffeescript
2 is now wrong cuz its just the size 🙃
@vernal spruce so could i just have a while loops thats runs a runnable every 20 ticks?
private void saveData() {
dataMap.forEach((uuid, list) -> {
List<Data> deaths = dataMap.get(uuid);
for(Data data : list){
String saveKey = "DeathInfo." + uuid + "." + deaths.size() + ".";
getConfig().set(saveKey + "location", locToString(data.getLocation()));
getConfig().set(saveKey + "reason", data.getReason());
getConfig().set(saveKey + "time", data.getTime());
}
});
saveConfig();
}```
its about this
@vernal spruce so could i just have a while loops thats runs a runnable every 20 ticks?
@blazing burrow a runnable can be a timer itself,exists for both a timer(once every X),or later(after X)
Bukkit.getScheduler().runTaskTimer(plugin, ()->{}, 1L, 20L);
But i cant seem to figure out how, i looked at the thing but cant really make out how a repeating/looping one will look like so i presumed u use a while loop
ima walk with my dogs tag me if you have an answer pls
what params does runTaskTimer use
Bukkit.getScheduler().runTaskTimer(plugin, ->{}, 1L, 20L);
@sturdy oar disgasting lambda 🤢
Delay and period
Delay is time before first execution, period is time between executions
@sturdy oar disgasting lambda 🤢
@vernal spruce lambda is superior
Ohhh i see
Don't tell me you use new Runnable
Man yeeted the ()
public void runnable() { new BukkitRunnable() { public void run() { time++; } }.runTaskTimer(this, 0, 20);
so is this practical
I wanna make an custom ban command, but when i type /ban the vanilla command also pops up
k
Set the target level
This is my first plugin
Not sure what you mean
Do I need to add something to the pom.xml that specifies target level?
I am having trouble running SPIGOT buildtools
this is my BAT command file
java -jar BuildTools.jar -nogui
PAUSE
Exception in thread "main" joptsimple.UnrecognizedOptionException: n is not a recognized option
at joptsimple.OptionException.unrecognizedOption(OptionException.java:108)
at joptsimple.OptionParser.validateOptionCharacters(OptionParser.java:633)
at joptsimple.OptionParser.handleShortOptionCluster(OptionParser.java:528)
at joptsimple.OptionParser.handleShortOptionToken(OptionParser.java:523)
at joptsimple.OptionParserState$2.handleArgument(OptionParserState.java:59)
at joptsimple.OptionParser.parse(OptionParser.java:396)
at org.spigotmc.builder.Builder.main(Builder.java:156)
at org.spigotmc.builder.Bootstrap.main(Bootstrap.java:34)
-nogui is a spigot argument, not a buildtools argument
How can I find the slot number a specific item is in inside of an inventory?
is there a function for that?
or do I just have to use a for loop against the contents
Is it possible to give levitation to a boat in which a player is with commands?
Java is not commands.
No, Java is made up of statements.
so you're talking about command blocks
Yes.
in which case I don't think it's possible
but it might be
there's a discord group, Minecraft Commands
I could give u an invite if u wanted
they would probably know
Alright, thanks.
private void saveData() {
dataMap.forEach((uuid, list) -> {
for(Data data : list){
String saveKey = "DeathInfo." + uuid + ".";
getConfig().set(saveKey + "location", locToString(data.getLocation()));
getConfig().set(saveKey + "reason", data.getReason());
getConfig().set(saveKey + "time", data.getTime());
}
});
saveConfig();
}```
im saving my info into .yml file like this
but it only saves information about 1 thing in the hashmap
not multiple while its a list of Data```java
private final Map<UUID, List<Data>> dataMap = new HashMap<>();```
https://paste.md-5.net/alofoqekal.cpp <- Data.class
Can any one tell me why when you save config file all double banana: " " are replaced with single banana: ' '
thing is if some one later wants to edit messages
and they type some thing like |don't| inside single ' it will break config
Can i code my own spigot plugin?
Can someone help me
My server keeps crashing over and over
I tried to optimize it by editing the spigot.yml file
Can any one tell me why when you save config file all double banana: " " are replaced with single banana: ' '
if you save your config, the " " thing is replacing by ' ', and if you using ' don't ' then you should do like,'don''t'
?paste
I need help finding a auto unban plugin for 1.11.2
advancedban
@frigid ember Are you added some Data instances to List<Data> into hashmap not only one? and you sure that you not clearing somewhere the hashmap data?
Can someone help me out here?
?paste
paste your error
how
advancedban
I do not see a auto unban feature where it says features (not meant to sound rude)
anyone here helping with code? or just trouble shooting public plugins
why can't the bottom 2 methods access the Map?
@wary ledge How do you mean by that 2 methods is not accessing? Seems the code is correct for me
All I did was change the spigot.yml
@left grove maybe you have lot of plugins that causing OutOfMemoryError?
and someone told me that it was this line player.addPotionEffect(PotionEffectType.JUMP.createEffect(10000000, (jump.get((player.getUniqueId())))+0));
I do not see a auto unban feature where it says features (not meant to sound rude)
@rare prairie can you dm me a screenshot where it says auto unban for AdvancedBans
if you want to
@wary ledge java.lang.NullPointerException
You have to do jump.containsKey(player.getUniqueId()) before player.addPotionEffect
@nocturne laurel No, there are temporary bans, that automatically unbans the banned player after the time is expired. So if you have like essentials, do /tempban playername 1h then this player will can join again after 1 hour
what does containskey do?
it checks if the player uuid is in the map saved
is there something wrong with my plugins?
@left grove if you start your server without plugins, you'll see the result, if the error still present, you'll have to update your java, or dont know
well ummm
Is it possible to run bungeecord commands from a spigot console
The reason I want a auto unban plugin is incase I get banned from my server it will auto unban me (Oh and if it is a .sk file then let me know how to keep it from spamming messages in console)
is my spigot file okay?
I really don't know what I did to kill the server like this
How do i save a default configuration with Bungeecord? The configuration systems seem really different from the bukkit one.
This tutorial showed how to make the config: https://www.spigotmc.org/threads/bungeecords-configuration-api.11214/ And said default configs are easy
but i can't figure it out
is there a variable for what world a player is in? for like a scoreboard? i tried %world% but it didnt work
Is it possible to run bungeecord commands from a spigot console
@tranquil aurora
Nothing that I try is working
@wise spoke %player_world%
how do I fix this
thanks
/papi ecloud download Player
@frigid ember
ConfigurationProvider f = ConfigurationProvider.getProvider(YamlConfiguration.class);
f.save(file);
hm
i did a debug
so new values get written?
@frigid ember that didnt work. it literally shows %player_world%. i use multiverse and minecraft 1.8.9
/papi ecloud download Player
@frigid ember No, if you set new values/path like on bukkit plugin, then that value is set to the config by the given value
@wise spoke
and it does the same thing when i die
yeah? @frigid ember
you executed that command?
/papi ecloud download Player ?
@wary ledge You still not do a check for Map#get method, you should do
if (jump.containsKey(player.getUniqueId())) {
player.add
}
unknown command. would it help if i told you the scoreboard plugin?
is placeholder api even installed?
@wary ledge and also you can cancel the PlayerItemConsumeEvent with https://hub.spigotmc.org/javadocs/spigot/org/bukkit/event/player/PlayerItemConsumeEvent.html#setCancelled(boolean)
declaration: package: org.bukkit.event.player, class: PlayerItemConsumeEvent
@wise spoke
i did have it installed. will that command work when i install it and restart?
yes
ok thanks
it requires it working
Is it possible to run bungeecord commands from a spigot console
@tranquil aurora
so code is now
if(event.getItem().getType().name().toLowerCase().contains("bucket")) {
Player player = (Player) event.getPlayer();
if (jump.containsKey(player.getUniqueId())) {
player.addPotionEffect(PotionEffectType.JUMP.createEffect(10000000, (jump.get((player.getUniqueId())))+0));
player.chat("milk");
}
}```
I tried to optimize the server
@left grove ```#
There is insufficient memory for the Java Runtime Environment to continue.
Native memory allocation (mmap) failed to map 2126512128 bytes for committing reserved memory.
Possible reasons:
The system is out of physical RAM or swap space
The process is running with CompressedOops enabled, and the Java Heap may be blocking the growth of the native heap
Possible solutions:
Reduce memory load on the system
Increase physical memory or swap space
Check if swap backing store is full
Decrease Java heap size (-Xmx/-Xms)
Decrease number of Java threads
Decrease Java thread stack sizes (-Xss)
Set larger code cache with -XX:ReservedCodeCacheSize=
This output file may be truncated or incomplete.
#```
oof hardcoded item names
and I like
broke it
@frigid ember https://paste.md-5.net/itulesisaz.cpp
my spigot file
@frigid ember that worked. however when i change world it still shows the old world name. i then have to reload the scoreboard plugin.
that I edited
@wary ledge we recommend comparing the item type with our enum for materials
enum?
Material.BUKKET
idk
if that was it
.getType() == Material.BUKKET
idk it exactly
but that should be it
@left grove removing it?
oops
BUCKET
ah
ok it worked
im using powerranks. how i show what rank they have on the scoreboard? would it be %player_rank%?
but that still doesn't make everything else work
just look what placeholders the plugin supports
ok so
everytime you break a block there is a % that you will gain a level of jump boost
i have that down
but
if a player dies or drinks milk
i want to instantly add it back
what event
when a player consumes a bukket
declaration: package: org.bukkit.event.player, class: PlayerItemConsumeEvent
check if its a bukket
but what if they are trying to clear other effects
then don't cancel it
my idea would work if it would run
Player player = (Player) event.getPlayer();
if (jump.containsKey(player.getUniqueId())) {
player.addPotionEffect(PotionEffectType.JUMP.createEffect(10000000, (jump.get((player.getUniqueId())))+0));
player.chat("death");
}
}``` death is being sent but the effect is not
and give it back after consuming
Hi everyone
bye
I want to send a message from spigot to bungee and then I want to receive a response. How can I do that?
The home of Spigot a high performance, no lag customized CraftBukkit Minecraft server API, and BungeeCord, the cloud server proxy.
