mirror of
https://github.com/plexusorg/Plex.git
synced 2025-07-05 09:06:41 +00:00
a few fixes & optimizations
This commit is contained in:
@ -74,6 +74,15 @@ public class PlexUtils extends PlexBase
|
||||
player.playSound(location, org.bukkit.Sound.BLOCK_FIRE_EXTINGUISH, 0.5f, 0.5f);
|
||||
}
|
||||
|
||||
public static void disabledEffectMultiple(Player[] players, Location location)
|
||||
{
|
||||
Particle.CLOUD.builder().location(location).receivers(players).extra(0).offset(0.5,0.5,0.5).count(5).spawn();
|
||||
Particle.FLAME.builder().location(location).receivers(players).extra(0).offset(0.5,0.5,0.5).count(3).spawn();
|
||||
Particle.SOUL_FIRE_FLAME.builder().location(location).receivers(players).offset(0.5,0.5,0.5).extra(0).count(2).spawn();
|
||||
// note that the sound is played to everyone who is close enough to hear it
|
||||
players[0].getWorld().playSound(location, org.bukkit.Sound.BLOCK_FIRE_EXTINGUISH, 0.5f, 0.5f);
|
||||
}
|
||||
|
||||
public static ChatColor randomChatColor()
|
||||
{
|
||||
return CHAT_COLOR_POOL.get(RANDOM.nextInt(CHAT_COLOR_POOL.size()));
|
||||
|
@ -8,6 +8,7 @@ import dev.plex.Plex;
|
||||
import dev.plex.PlexBase;
|
||||
import net.kyori.adventure.text.Component;
|
||||
import net.kyori.adventure.text.format.NamedTextColor;
|
||||
import net.kyori.adventure.text.minimessage.MiniMessage;
|
||||
import org.apache.commons.io.FileUtils;
|
||||
import org.apache.http.HttpResponse;
|
||||
import org.apache.http.client.methods.HttpGet;
|
||||
@ -135,6 +136,23 @@ public class UpdateChecker extends PlexBase
|
||||
}
|
||||
|
||||
public void updateJar()
|
||||
{
|
||||
updateJar(null);
|
||||
}
|
||||
|
||||
private void sendOrLog(CommandSender sender, String message)
|
||||
{
|
||||
if (sender == null)
|
||||
{
|
||||
PlexLog.log(message);
|
||||
}
|
||||
else
|
||||
{
|
||||
sender.sendMessage(MiniMessage.miniMessage().deserialize(message));
|
||||
}
|
||||
}
|
||||
|
||||
public void updateJar(CommandSender sender)
|
||||
{
|
||||
CloseableHttpClient client = HttpClients.createDefault();
|
||||
HttpGet get = new HttpGet(DOWNLOAD_PAGE + "job/master/lastSuccessfulBuild/api/json");
|
||||
@ -144,7 +162,7 @@ public class UpdateChecker extends PlexBase
|
||||
JSONObject object = new JSONObject(EntityUtils.toString(response.getEntity(), StandardCharsets.UTF_8));
|
||||
JSONObject artifact = object.getJSONArray("artifacts").getJSONObject(0);
|
||||
String name = artifact.getString("fileName");
|
||||
PlexLog.log("Downloading latest Plex jar file: " + name);
|
||||
sendOrLog(sender, "Downloading latest Plex jar file: " + name);
|
||||
CompletableFuture.runAsync(() ->
|
||||
{
|
||||
try
|
||||
@ -153,7 +171,7 @@ public class UpdateChecker extends PlexBase
|
||||
new URL(DOWNLOAD_PAGE + "job/master/lastSuccessfulBuild/artifact/build/libs/" + name),
|
||||
new File(Bukkit.getUpdateFolderFile(), name)
|
||||
);
|
||||
PlexLog.log("Saved new jar. Please restart your server.");
|
||||
sendOrLog(sender, "Saved new jar. Please restart your server.");
|
||||
}
|
||||
catch (IOException e)
|
||||
{
|
||||
|
Reference in New Issue
Block a user