add credits and change some stuff

This commit is contained in:
Chayapak 2023-05-06 12:17:05 +07:00
parent ce173298d8
commit bb81bb956e
16 changed files with 21 additions and 8 deletions

View file

@ -4,7 +4,7 @@ import land.chipmunk.chayapak.chomens_bot.Bot;
import land.chipmunk.chayapak.chomens_bot.chatParsers.data.MutablePlayerListEntry;
import land.chipmunk.chayapak.chomens_bot.command.Command;
import land.chipmunk.chayapak.chomens_bot.command.CommandContext;
import land.chipmunk.chayapak.chomens_bot.util.NumberUtilities;
import land.chipmunk.chayapak.chomens_bot.util.MathUtilities;
import net.kyori.adventure.text.Component;
import net.kyori.adventure.text.format.NamedTextColor;
@ -41,8 +41,8 @@ public class RandomTeleportCommand implements Command {
final MutablePlayerListEntry sender = context.sender();
final int positionX = NumberUtilities.between(1_000, 1_000_000);
final int positionZ = NumberUtilities.between(1_000, 1_000_000);
final int positionX = MathUtilities.between(1_000, 1_000_000);
final int positionZ = MathUtilities.between(1_000, 1_000_000);
final String stringPosition = positionX + " 100 " + positionZ; // very 100 y
bot.core().run("essentials:teleport " + sender.profile().getIdAsString() + " " + stringPosition);

View file

@ -6,7 +6,7 @@ import land.chipmunk.chayapak.chomens_bot.data.BossBar;
import land.chipmunk.chayapak.chomens_bot.data.BossBarColor;
import land.chipmunk.chayapak.chomens_bot.data.BossBarStyle;
import land.chipmunk.chayapak.chomens_bot.song.*;
import land.chipmunk.chayapak.chomens_bot.util.NumberUtilities;
import land.chipmunk.chayapak.chomens_bot.util.MathUtilities;
import lombok.Getter;
import lombok.Setter;
import net.kyori.adventure.text.Component;
@ -18,6 +18,7 @@ import java.nio.file.Path;
import java.text.DecimalFormat;
import java.util.LinkedList;
// Author: _ChipMC_ with some stuff added
public class MusicPlayerPlugin extends Bot.Listener {
private final Bot bot;
@ -274,7 +275,7 @@ public class MusicPlayerPlugin extends Bot.Listener {
" record @s ^" + blockPosition + " ^ ^ " +
note.volume +
" " +
NumberUtilities.clamp(floatingPitch, 0, 2)
MathUtilities.clamp(floatingPitch, 0, 2)
);
}
}

View file

@ -8,7 +8,7 @@ import land.chipmunk.chayapak.chomens_bot.Bot;
import land.chipmunk.chayapak.chomens_bot.data.BossBar;
import land.chipmunk.chayapak.chomens_bot.data.BossBarColor;
import land.chipmunk.chayapak.chomens_bot.data.BossBarStyle;
import land.chipmunk.chayapak.chomens_bot.util.NumberUtilities;
import land.chipmunk.chayapak.chomens_bot.util.MathUtilities;
import net.kyori.adventure.text.Component;
import net.kyori.adventure.text.format.NamedTextColor;
@ -94,7 +94,7 @@ public class TPSPlugin extends Bot.Listener {
public void packetReceived (ClientboundSetTimePacket ignoredPacket) {
long now = System.currentTimeMillis();
float timeElapsed = (float) (now - timeLastTimeUpdate) / 1000.0F;
tickRates[nextIndex] = NumberUtilities.clamp(20.0f / timeElapsed, 0.0f, 20.0f);
tickRates[nextIndex] = MathUtilities.clamp(20.0f / timeElapsed, 0.0f, 20.0f);
nextIndex = (nextIndex + 1) % tickRates.length;
timeLastTimeUpdate = now;
}

View file

@ -1,5 +1,6 @@
package land.chipmunk.chayapak.chomens_bot.song;
// Author: hhhzzzsss
public class Instrument {
public static final Instrument HARP = new Instrument(0, "harp", 54);
public static final Instrument BASEDRUM = new Instrument(1, "basedrum", 0);

View file

@ -9,6 +9,7 @@ import java.util.ArrayList;
import java.util.Comparator;
import java.util.HashMap;
// Author: hhhzzzsss
public class MidiConverter {
public static final int SET_INSTRUMENT = 0xC0;
public static final int SET_TEMPO = 0x51;

View file

@ -7,6 +7,7 @@ import java.nio.ByteBuffer;
import java.nio.ByteOrder;
import java.util.ArrayList;
// Author: hhhzzzsss
public class NBSConverter {
public static Instrument[] instrumentIndex = new Instrument[] {
Instrument.HARP,

View file

@ -2,6 +2,7 @@ package land.chipmunk.chayapak.chomens_bot.song;
import lombok.AllArgsConstructor;
// Author: hhhzzzsss
@AllArgsConstructor
public class Note implements Comparable<Note> {
public Instrument instrument;

View file

@ -5,6 +5,7 @@ import net.kyori.adventure.text.Component;
import java.util.ArrayList;
import java.util.Collections;
// Author: hhhzzzsss & _ChipMC_ but i changed most of the stuff
public class Song {
public ArrayList<Note> notes = new ArrayList<>();
public Component name;

View file

@ -4,6 +4,7 @@ import net.kyori.adventure.text.Component;
import lombok.Getter;
import land.chipmunk.chayapak.chomens_bot.util.ComponentUtilities;
// Author: _ChipMC_ or hhhzzzsss?
public class SongLoaderException extends Exception {
@Getter private final Component message;

View file

@ -10,6 +10,7 @@ import java.nio.file.Path;
import java.nio.file.Files;
import java.nio.file.Paths;
// Author: _ChipMC_ or hhhzzzsss?
public class SongLoaderThread extends Thread {
public String fileName;

View file

@ -2,6 +2,7 @@ package land.chipmunk.chayapak.chomens_bot.util;
import java.awt.*;
// Author: ChatGPT
public class ColorUtilities {
public static int hsvToRgb (int hue, int saturation, int value) {
Color color = Color.getHSBColor(hue / 360.0f, saturation / 100.0f, value / 100.0f);

View file

@ -4,6 +4,7 @@ import land.chipmunk.chayapak.chomens_bot.command.Command;
import java.util.List;
// Author: ChatGPT I guess
public class ElementUtilities {
public static Command findCommand(List<Command> commands, String searchTerm) {
for (Command command : commands) {

View file

@ -14,6 +14,7 @@ import java.security.KeyManagementException;
import java.security.NoSuchAlgorithmException;
import java.security.SecureRandom;
// Author: _ChipMC_ (well I added some stuff)
public class HttpUtilities {
// ig duplicate codes yup real

View file

@ -1,5 +1,6 @@
package land.chipmunk.chayapak.chomens_bot.util;
// Original code made by _ChipMC_ IIRC and I ported it to Java
public class IllegalCharactersUtilities {
public static boolean isAllowedCharacter (char character) {
return character != '\u00a7' && character != '\u007f';

View file

@ -1,6 +1,6 @@
package land.chipmunk.chayapak.chomens_bot.util;
public class NumberUtilities {
public class MathUtilities {
public static int between (int min, int max) {
return (int) Math.floor(
Math.random() * (max - min) + min

View file

@ -4,6 +4,7 @@ import com.github.steveice10.opennbt.tag.builtin.IntArrayTag;
import java.util.UUID;
import java.nio.ByteBuffer;
// Author: _ChipMC_ i guess
public class UUIDUtilities {
private UUIDUtilities () {}