mirror of
https://github.com/Minestom/Minestom.git
synced 2024-11-15 15:16:46 +01:00
Merge remote-tracking branch 'origin/master'
This commit is contained in:
commit
56bdb402b1
67
.github/workflows/codeql-analysis.yml
vendored
Normal file
67
.github/workflows/codeql-analysis.yml
vendored
Normal file
@ -0,0 +1,67 @@
|
||||
# For most projects, this workflow file will not need changing; you simply need
|
||||
# to commit it to your repository.
|
||||
#
|
||||
# You may wish to alter this file to override the set of languages analyzed,
|
||||
# or to provide custom queries or build logic.
|
||||
#
|
||||
# ******** NOTE ********
|
||||
# We have attempted to detect the languages in your repository. Please check
|
||||
# the `language` matrix defined below to confirm you have the correct set of
|
||||
# supported CodeQL languages.
|
||||
#
|
||||
name: "CodeQL"
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [ master ]
|
||||
pull_request:
|
||||
# The branches below must be a subset of the branches above
|
||||
branches: [ master ]
|
||||
schedule:
|
||||
- cron: '27 19 * * 3'
|
||||
|
||||
jobs:
|
||||
analyze:
|
||||
name: Analyze
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
language: [ 'java' ]
|
||||
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python' ]
|
||||
# Learn more:
|
||||
# https://docs.github.com/en/free-pro-team@latest/github/finding-security-vulnerabilities-and-errors-in-your-code/configuring-code-scanning#changing-the-languages-that-are-analyzed
|
||||
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v2
|
||||
|
||||
# Initializes the CodeQL tools for scanning.
|
||||
- name: Initialize CodeQL
|
||||
uses: github/codeql-action/init@v1
|
||||
with:
|
||||
languages: ${{ matrix.language }}
|
||||
# If you wish to specify custom queries, you can do so here or in a config file.
|
||||
# By default, queries listed here will override any specified in a config file.
|
||||
# Prefix the list here with "+" to use these queries and those in the config file.
|
||||
# queries: ./path/to/local/query, your-org/your-repo/queries@main
|
||||
|
||||
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
|
||||
# If this step fails, then you should remove it and run the build manually (see below)
|
||||
- name: Autobuild
|
||||
uses: github/codeql-action/autobuild@v1
|
||||
|
||||
# ℹ️ Command-line programs to run using the OS shell.
|
||||
# 📚 https://git.io/JvXDl
|
||||
|
||||
# ✏️ If the Autobuild fails above, remove it and uncomment the following three lines
|
||||
# and modify them (or add more) to build your code if your project
|
||||
# uses a compiled language
|
||||
|
||||
#- run: |
|
||||
# make bootstrap
|
||||
# make release
|
||||
|
||||
- name: Perform CodeQL Analysis
|
||||
uses: github/codeql-action/analyze@v1
|
@ -2,44 +2,32 @@ package net.minestom.server.item.firework;
|
||||
|
||||
import net.minestom.server.chat.ChatColor;
|
||||
import net.minestom.server.color.Color;
|
||||
import net.minestom.server.exception.ExceptionManager;
|
||||
import org.apache.commons.lang3.Validate;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jglrxavpok.hephaistos.nbt.NBTCompound;
|
||||
import org.jglrxavpok.hephaistos.nbt.*;
|
||||
|
||||
import java.util.Objects;
|
||||
import java.util.*;
|
||||
|
||||
public class FireworkEffect {
|
||||
|
||||
private final boolean flicker;
|
||||
private final boolean trail;
|
||||
private final FireworkEffectType type;
|
||||
private final Color color;
|
||||
private final Color fadeColor;
|
||||
private final List<Color> color;
|
||||
private final List<Color> fadeColor;
|
||||
|
||||
//FIXME: fix javadoc
|
||||
/**
|
||||
* Initializes a new firework effect.
|
||||
*
|
||||
* @param flicker {@code true} if this explosion has the Twinkle effect (glowstone dust), otherwise {@code false}.
|
||||
* @param trail {@code true} if this explosion hsa the Trail effect (diamond), otherwise {@code false}.
|
||||
* @param type The shape of this firework's explosion.
|
||||
* @param color The primary color of this firework effect.
|
||||
* @param fadeColor The secondary color of this firework effect.
|
||||
* @deprecated Use {@link #FireworkEffect(boolean, boolean, FireworkEffectType, Color, Color)}
|
||||
* @param color The primary colors of this firework effect.
|
||||
* @param fadeColor The secondary colors of this firework effect.
|
||||
*/
|
||||
@Deprecated
|
||||
public FireworkEffect(boolean flicker, boolean trail, FireworkEffectType type, ChatColor color, ChatColor fadeColor) {
|
||||
this(flicker, trail, type, color.asColor(), fadeColor.asColor());
|
||||
}
|
||||
|
||||
/**
|
||||
* Initializes a new firework effect.
|
||||
*
|
||||
* @param flicker {@code true} if this explosion has the Twinkle effect (glowstone dust), otherwise {@code false}.
|
||||
* @param trail {@code true} if this explosion hsa the Trail effect (diamond), otherwise {@code false}.
|
||||
* @param type The shape of this firework's explosion.
|
||||
* @param color The primary color of this firework effect.
|
||||
* @param fadeColor The secondary color of this firework effect.
|
||||
*/
|
||||
public FireworkEffect(boolean flicker, boolean trail, FireworkEffectType type, Color color, Color fadeColor) {
|
||||
public FireworkEffect(boolean flicker, boolean trail, FireworkEffectType type, List<Color> color, List<Color> fadeColor) {
|
||||
this.flicker = flicker;
|
||||
this.trail = trail;
|
||||
this.type = type;
|
||||
@ -55,18 +43,21 @@ public class FireworkEffect {
|
||||
*/
|
||||
public static FireworkEffect fromCompound(@NotNull NBTCompound compound) {
|
||||
|
||||
Color primaryColor = null;
|
||||
Color secondaryColor = null;
|
||||
List<Color> primaryColor = new ArrayList<>();
|
||||
List<Color> secondaryColor = new ArrayList<>();
|
||||
|
||||
if (compound.containsKey("Colors")) {
|
||||
int[] color = compound.getIntArray("Colors");
|
||||
primaryColor = new Color(color[0], color[1], color[2]);
|
||||
for (int i = 0; i < color.length; i++) {
|
||||
primaryColor.add(new Color(color[i]));
|
||||
}
|
||||
}
|
||||
|
||||
if (compound.containsKey("FadeColors")) {
|
||||
int[] fadeColor = compound.getIntArray("FadeColors");
|
||||
secondaryColor = new Color(fadeColor[0], fadeColor[1], fadeColor[2]);
|
||||
|
||||
for (int i = 0; i < fadeColor.length; i++) {
|
||||
secondaryColor.add(new Color(fadeColor[i]));
|
||||
}
|
||||
}
|
||||
|
||||
boolean flicker = compound.containsKey("Flicker") && compound.getByte("Flicker") == 1;
|
||||
@ -118,11 +109,11 @@ public class FireworkEffect {
|
||||
* @return An array of integer values corresponding to the primary colors of this firework's explosion.
|
||||
*/
|
||||
public int[] getColors() {
|
||||
return new int[]{
|
||||
this.color.getRed(),
|
||||
this.color.getGreen(),
|
||||
this.color.getBlue()
|
||||
};
|
||||
int[] primary = new int[color.size()];
|
||||
for (int i = 0; i < color.size(); i++) {
|
||||
primary[i] = color.get(i).asRGB();
|
||||
}
|
||||
return primary;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -133,11 +124,11 @@ public class FireworkEffect {
|
||||
* @return An array of integer values corresponding to the fading colors of this firework's explosion.
|
||||
*/
|
||||
public int[] getFadeColors() {
|
||||
return new int[]{
|
||||
this.fadeColor.getRed(),
|
||||
this.fadeColor.getGreen(),
|
||||
this.fadeColor.getBlue()
|
||||
};
|
||||
int[] secondary = new int[fadeColor.size()];
|
||||
for (int i = 0; i < fadeColor.size(); i++) {
|
||||
secondary[i] = fadeColor.get(i).asRGB();
|
||||
}
|
||||
return secondary;
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user