From fdada8f44fcd2fba345eb473e00d3d4588d3beac Mon Sep 17 00:00:00 2001 From: ineanto Date: Thu, 21 Dec 2023 17:40:57 +0100 Subject: [PATCH] feat: start working on random skin --- build.gradle.kts | 25 +- .../appearance/random/RandomNameFetcher.java | 36 ++ .../xyz/ineanto/nicko/gui/SettingsGUI.java | 13 +- .../items/settings/LanguageCyclingItem.java | 2 +- ...ngItem.java => RandomSkinCyclingItem.java} | 42 +- .../java/xyz/ineanto/nicko/i18n/I18NDict.java | 2 +- .../nicko/placeholder/NickoExpansion.java | 8 +- .../ineanto/nicko/profile/NickoProfile.java | 16 +- .../nicko/storage/mariadb/MariaDBStorage.java | 4 +- .../nicko/storage/mysql/MySQLStorage.java | 4 +- src/main/resources/en.yml | 6 +- src/main/resources/fr.yml | 6 +- src/main/resources/names.csv | 490 ++++++++++++++++++ .../nicko/test/appearance/RandomNameTest.java | 35 ++ .../nicko/test/storage/SQLStorageTest.java | 6 +- 15 files changed, 636 insertions(+), 59 deletions(-) create mode 100644 src/main/java/xyz/ineanto/nicko/appearance/random/RandomNameFetcher.java rename src/main/java/xyz/ineanto/nicko/gui/items/settings/{BungeeCordCyclingItem.java => RandomSkinCyclingItem.java} (59%) create mode 100644 src/main/resources/names.csv create mode 100644 src/test/java/xyz/ineanto/nicko/test/appearance/RandomNameTest.java diff --git a/build.gradle.kts b/build.gradle.kts index f1838b6..6dbf254 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -2,10 +2,11 @@ plugins { id("java") id("io.github.goooler.shadow") version "8.1.2" id("xyz.jpenilla.run-paper") version "2.2.2" + id("jvm-test-suite") } group = "xyz.ineanto" -version = "1.0.8-RC1" +version = "1.1.0-RC1" val shadowImplementation: Configuration by configurations.creating configurations["implementation"].extendsFrom(shadowImplementation) @@ -144,4 +145,24 @@ tasks.named("jar").configure { tasks.test { useJUnitPlatform() -} \ No newline at end of file +} + +// For when Gradle 9.0 releases. +/** +testing { + suites { + val test by getting(JvmTestSuite::class) { + targets { + useJUnitJupiter() + } + + dependencies { + implementation(project()) + implementation("com.github.seeseemelk:MockBukkit-v1.20:3.58.0") + implementation("org.junit.jupiter:junit-jupiter-api:5.10.1") + implementation("org.junit.jupiter:junit-jupiter-engine:5.10.1") + implementation("org.junit.jupiter:junit-jupiter:5.10.1") + } + } + } +} */ \ No newline at end of file diff --git a/src/main/java/xyz/ineanto/nicko/appearance/random/RandomNameFetcher.java b/src/main/java/xyz/ineanto/nicko/appearance/random/RandomNameFetcher.java new file mode 100644 index 0000000..0557047 --- /dev/null +++ b/src/main/java/xyz/ineanto/nicko/appearance/random/RandomNameFetcher.java @@ -0,0 +1,36 @@ +package xyz.ineanto.nicko.appearance.random; + +import xyz.ineanto.nicko.NickoBukkit; + +import java.io.BufferedReader; +import java.io.IOException; +import java.io.InputStream; +import java.io.InputStreamReader; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import java.util.Random; + +public class RandomNameFetcher { + private final NickoBukkit instance; + + public RandomNameFetcher(NickoBukkit instance) { + this.instance = instance; + } + + public String getRandomUsername() { + final InputStream resource = instance.getResource("names.csv"); + final List> records = new ArrayList<>(); + try (BufferedReader reader = new BufferedReader(new InputStreamReader(resource))) { + String line; + while ((line = reader.readLine()) != null) { + String[] values = line.split("\n"); + records.add(Arrays.asList(values)); + } + } catch (IOException e) { + throw new RuntimeException(e); + } + + return records.get(new Random().nextInt(records.size() -1)).get(0); + } +} diff --git a/src/main/java/xyz/ineanto/nicko/gui/SettingsGUI.java b/src/main/java/xyz/ineanto/nicko/gui/SettingsGUI.java index f887c6d..76079b7 100644 --- a/src/main/java/xyz/ineanto/nicko/gui/SettingsGUI.java +++ b/src/main/java/xyz/ineanto/nicko/gui/SettingsGUI.java @@ -1,14 +1,12 @@ package xyz.ineanto.nicko.gui; import org.bukkit.entity.Player; -import xyz.ineanto.nicko.gui.items.ItemDefaults; import xyz.ineanto.nicko.gui.items.common.GoBackItem; -import xyz.ineanto.nicko.gui.items.settings.BungeeCordCyclingItem; import xyz.ineanto.nicko.gui.items.settings.LanguageCyclingItem; +import xyz.ineanto.nicko.gui.items.settings.RandomSkinCyclingItem; import xyz.ineanto.nicko.i18n.I18N; import xyz.ineanto.nicko.i18n.I18NDict; import xyz.xenondevs.invui.gui.Gui; -import xyz.xenondevs.invui.item.impl.SimpleItem; import xyz.xenondevs.invui.window.Window; public class SettingsGUI { @@ -19,26 +17,23 @@ public class SettingsGUI { public SettingsGUI(Player player) { final String[] dynamicStructure = new String[]{ "# # # # # # # # #", - "# # # L T U # # #", + "# # # L # R # # #", "B # # # # # # # #" }; - dynamicStructure[1] = dynamicStructure[1].replace("T", "U"); - final I18N i18n = new I18N(player); this.title = i18n.translatePrefixless(I18NDict.GUI.Titles.SETTINGS); final HomeGUI parent = new HomeGUI(player); final LanguageCyclingItem languageItem = new LanguageCyclingItem(player); - final BungeeCordCyclingItem bungeeCordItem = new BungeeCordCyclingItem(player); + final RandomSkinCyclingItem skinItem = new RandomSkinCyclingItem(player); final GoBackItem backItem = new GoBackItem(player); this.gui = Gui.normal() .setStructure(dynamicStructure) .addIngredient('B', backItem.get(parent.getGUI(), parent.getTitle())) .addIngredient('L', languageItem.get()) - .addIngredient('U', new SimpleItem(ItemDefaults.getUnavailableItem(i18n))) - .addIngredient('T', bungeeCordItem.get()) + .addIngredient('R', skinItem.get()) .build(); this.player = player; } diff --git a/src/main/java/xyz/ineanto/nicko/gui/items/settings/LanguageCyclingItem.java b/src/main/java/xyz/ineanto/nicko/gui/items/settings/LanguageCyclingItem.java index 906f118..de5a31e 100644 --- a/src/main/java/xyz/ineanto/nicko/gui/items/settings/LanguageCyclingItem.java +++ b/src/main/java/xyz/ineanto/nicko/gui/items/settings/LanguageCyclingItem.java @@ -40,8 +40,8 @@ public class LanguageCyclingItem { final NickoProfile nickoProfile = profile.get(); int localeOrdinal = nickoProfile.getLocale().ordinal(); return CycleItem.withStateChangeHandler((observer, integer) -> { - nickoProfile.setLocale(Locale.values()[integer]); observer.playSound(player, Sound.UI_BUTTON_CLICK, 1f, 0.707107f); // 0.707107 ~= C + nickoProfile.setLocale(Locale.values()[integer]); player.getOpenInventory().close(); if (dataStore.updateCache(player.getUniqueId(), nickoProfile).isError()) { player.sendMessage(i18n.translate(I18NDict.Event.Settings.ERROR)); diff --git a/src/main/java/xyz/ineanto/nicko/gui/items/settings/BungeeCordCyclingItem.java b/src/main/java/xyz/ineanto/nicko/gui/items/settings/RandomSkinCyclingItem.java similarity index 59% rename from src/main/java/xyz/ineanto/nicko/gui/items/settings/BungeeCordCyclingItem.java rename to src/main/java/xyz/ineanto/nicko/gui/items/settings/RandomSkinCyclingItem.java index 520ebd6..2261a8e 100644 --- a/src/main/java/xyz/ineanto/nicko/gui/items/settings/BungeeCordCyclingItem.java +++ b/src/main/java/xyz/ineanto/nicko/gui/items/settings/RandomSkinCyclingItem.java @@ -1,6 +1,5 @@ package xyz.ineanto.nicko.gui.items.settings; -import org.bukkit.Material; import org.bukkit.Sound; import org.bukkit.entity.Player; import xyz.ineanto.nicko.NickoBukkit; @@ -10,19 +9,19 @@ import xyz.ineanto.nicko.i18n.ItemTranslation; import xyz.ineanto.nicko.profile.NickoProfile; import xyz.ineanto.nicko.storage.PlayerDataStore; import xyz.xenondevs.invui.item.ItemProvider; -import xyz.xenondevs.invui.item.builder.ItemBuilder; +import xyz.xenondevs.invui.item.builder.SkullBuilder; import xyz.xenondevs.invui.item.impl.AbstractItem; import xyz.xenondevs.invui.item.impl.CycleItem; import xyz.xenondevs.invui.item.impl.SimpleItem; import java.util.Optional; -public class BungeeCordCyclingItem { +public class RandomSkinCyclingItem { private final Player player; - private final I18N i18n; private final ItemProvider[] providers; + private final I18N i18n; - public BungeeCordCyclingItem(Player player) { + public RandomSkinCyclingItem(Player player) { this.player = player; this.i18n = new I18N(player); this.providers = new ItemProvider[]{ @@ -36,33 +35,30 @@ public class BungeeCordCyclingItem { final Optional profile = dataStore.getData(player.getUniqueId()); if (profile.isPresent()) { final NickoProfile nickoProfile = profile.get(); - int startingState = nickoProfile.isBungeecordTransfer() ? 0 : 1; + int localeOrdinal = nickoProfile.isRandomSkin() ? 0 : 1; return CycleItem.withStateChangeHandler((observer, integer) -> { - nickoProfile.setBungeecordTransfer(integer != 1); - dataStore.updateCache(player.getUniqueId(), nickoProfile); observer.playSound(player, Sound.UI_BUTTON_CLICK, 1f, 0.707107f); // 0.707107 ~= C - }, startingState, providers); + nickoProfile.setRandomSkin(integer != 1); + if (dataStore.updateCache(player.getUniqueId(), nickoProfile).isError()) { + player.sendMessage(i18n.translate(I18NDict.Event.Settings.ERROR)); + player.getOpenInventory().close(); + } + }, localeOrdinal, providers); } return new SimpleItem(ItemProvider.EMPTY); } - private ItemProvider getItemProviderForValue(boolean ignored) { - final ItemBuilder builder = new ItemBuilder(Material.COMPASS); - final ItemTranslation translation = i18n.fetchTranslation(I18NDict.GUI.Settings.BUNGEECORD); + private ItemProvider getItemProviderForValue(boolean enabled) { + final SkullBuilder.HeadTexture texture = new SkullBuilder.HeadTexture("eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvYzgzMTEzOGMyMDYxMWQzMDJjNDIzZmEzMjM3MWE3NDNkMTc0MzdhMTg5NzNjMzUxOTczNDQ3MGE3YWJiNCJ9fX0="); + final SkullBuilder builder = new SkullBuilder(texture); + final ItemTranslation translation = i18n.fetchTranslation(I18NDict.GUI.Settings.RANDOM_SKIN, + (enabled ? "§7> §cDisabled" : "§6§l> §c§lDisabled"), + (enabled ? "§6§l> §a§lEnabled" : "§7> §aEnabled") + ); builder.setDisplayName(translation.name()); translation.lore().forEach(builder::addLoreLines); - /* - if (enabled) { - builder.addLoreLines("§7> §cDisabled"); - builder.addLoreLines("§6§l> §a§lEnabled"); - } else { - builder.addLoreLines("§6§l> §c§lDisabled"); - builder.addLoreLines("§7> §aEnabled"); - } - builder.addLoreLines("§7§oCycle through the values by", "§7§oleft and right clicking."); - */ return builder; } -} +} \ No newline at end of file diff --git a/src/main/java/xyz/ineanto/nicko/i18n/I18NDict.java b/src/main/java/xyz/ineanto/nicko/i18n/I18NDict.java index 020154f..4ce1f45 100644 --- a/src/main/java/xyz/ineanto/nicko/i18n/I18NDict.java +++ b/src/main/java/xyz/ineanto/nicko/i18n/I18NDict.java @@ -112,7 +112,7 @@ public class I18NDict { private static final String SETTINGS_KEY = GUI_KEY + "settings."; public static final String LANGUAGE = SETTINGS_KEY + "language"; - public static final String BUNGEECORD = SETTINGS_KEY + "bungeecord"; + public static final String RANDOM_SKIN = SETTINGS_KEY + "random_skin"; } public static class Admin { diff --git a/src/main/java/xyz/ineanto/nicko/placeholder/NickoExpansion.java b/src/main/java/xyz/ineanto/nicko/placeholder/NickoExpansion.java index 1f3f9fe..1200110 100644 --- a/src/main/java/xyz/ineanto/nicko/placeholder/NickoExpansion.java +++ b/src/main/java/xyz/ineanto/nicko/placeholder/NickoExpansion.java @@ -42,11 +42,11 @@ public class NickoExpansion extends PlaceholderExpansion { if (player == null) return null; String name, skin, locale; - boolean bungeecord; + boolean randomSkin; name = skin = player.getName(); locale = "N/A"; - bungeecord = true; + randomSkin = false; final Optional optionalProfile = instance.getDataStore().getData(player.getUniqueId()); if (optionalProfile.isPresent()) { @@ -61,14 +61,14 @@ public class NickoExpansion extends PlaceholderExpansion { } } locale = profile.getLocale().getName(); - bungeecord = profile.isBungeecordTransfer(); + randomSkin = profile.isRandomSkin(); } return switch (params) { case "name" -> name; case "skin" -> skin; case "locale" -> locale; - case "bungeecord" -> String.valueOf(bungeecord); + case "bungeecord" -> String.valueOf(randomSkin); default -> null; }; } diff --git a/src/main/java/xyz/ineanto/nicko/profile/NickoProfile.java b/src/main/java/xyz/ineanto/nicko/profile/NickoProfile.java index 0dd8b6c..d70f7ff 100644 --- a/src/main/java/xyz/ineanto/nicko/profile/NickoProfile.java +++ b/src/main/java/xyz/ineanto/nicko/profile/NickoProfile.java @@ -15,13 +15,13 @@ public class NickoProfile implements Cloneable { private String name; private String skin; private Locale locale; - private boolean bungeecordTransfer; + private boolean randomSkin; - public NickoProfile(String name, String skin, Locale locale, boolean bungeecordTransfer) { + public NickoProfile(String name, String skin, Locale locale, boolean randomSkin) { this.name = name; this.skin = skin; this.locale = locale; - this.bungeecordTransfer = bungeecordTransfer; + this.randomSkin = randomSkin; } public static Optional get(Player player) { @@ -60,12 +60,12 @@ public class NickoProfile implements Cloneable { this.locale = locale; } - public boolean isBungeecordTransfer() { - return bungeecordTransfer; + public boolean isRandomSkin() { + return randomSkin; } - public void setBungeecordTransfer(boolean bungeecordTransfer) { - this.bungeecordTransfer = bungeecordTransfer; + public void setRandomSkin(boolean randomSkin) { + this.randomSkin = randomSkin; } @Override @@ -74,7 +74,7 @@ public class NickoProfile implements Cloneable { "name='" + name + '\'' + ", skin='" + skin + '\'' + ", locale=" + locale + - ", bungeecordTransfer=" + bungeecordTransfer + + ", randomSkin=" + randomSkin + '}'; } diff --git a/src/main/java/xyz/ineanto/nicko/storage/mariadb/MariaDBStorage.java b/src/main/java/xyz/ineanto/nicko/storage/mariadb/MariaDBStorage.java index c4fc100..f761f56 100644 --- a/src/main/java/xyz/ineanto/nicko/storage/mariadb/MariaDBStorage.java +++ b/src/main/java/xyz/ineanto/nicko/storage/mariadb/MariaDBStorage.java @@ -124,7 +124,7 @@ public class MariaDBStorage extends Storage { statement.setString(2, profile.getName() == null ? null : profile.getName()); statement.setString(3, profile.getSkin() == null ? null : profile.getSkin()); statement.setString(4, profile.getLocale().getCode()); - statement.setBoolean(5, profile.isBungeecordTransfer()); + statement.setBoolean(5, profile.isRandomSkin()); return statement; } @@ -134,7 +134,7 @@ public class MariaDBStorage extends Storage { statement.setString(1, profile.getName() == null ? null : profile.getName()); statement.setString(2, profile.getSkin() == null ? null : profile.getSkin()); statement.setString(3, profile.getLocale().getCode()); - statement.setBoolean(4, profile.isBungeecordTransfer()); + statement.setBoolean(4, profile.isRandomSkin()); statement.setString(5, uuid.toString()); return statement; } diff --git a/src/main/java/xyz/ineanto/nicko/storage/mysql/MySQLStorage.java b/src/main/java/xyz/ineanto/nicko/storage/mysql/MySQLStorage.java index 85c8d9e..490c8e1 100644 --- a/src/main/java/xyz/ineanto/nicko/storage/mysql/MySQLStorage.java +++ b/src/main/java/xyz/ineanto/nicko/storage/mysql/MySQLStorage.java @@ -124,7 +124,7 @@ public class MySQLStorage extends Storage { statement.setString(2, profile.getName() == null ? null : profile.getName()); statement.setString(3, profile.getSkin() == null ? null : profile.getSkin()); statement.setString(4, profile.getLocale().getCode()); - statement.setBoolean(5, profile.isBungeecordTransfer()); + statement.setBoolean(5, profile.isRandomSkin()); return statement; } @@ -134,7 +134,7 @@ public class MySQLStorage extends Storage { statement.setString(1, profile.getName() == null ? null : profile.getName()); statement.setString(2, profile.getSkin() == null ? null : profile.getSkin()); statement.setString(3, profile.getLocale().getCode()); - statement.setBoolean(4, profile.isBungeecordTransfer()); + statement.setBoolean(4, profile.isRandomSkin()); statement.setString(5, uuid.toString()); return statement; } diff --git a/src/main/resources/en.yml b/src/main/resources/en.yml index 84e6d82..7297af5 100644 --- a/src/main/resources/en.yml +++ b/src/main/resources/en.yml @@ -133,8 +133,10 @@ gui: lore: - "§7§oGet through the values" - "§7§oby left or right clicking." - bungeecord: - name: "Bungeecord Transfer" + random_skin: + name: "Random skin on join" lore: + - "{0}" + - "{1}" - "§7§oGet through the values" - "§7§oby left or right clicking." \ No newline at end of file diff --git a/src/main/resources/fr.yml b/src/main/resources/fr.yml index 02783c6..38a568a 100644 --- a/src/main/resources/fr.yml +++ b/src/main/resources/fr.yml @@ -130,8 +130,10 @@ gui: lore: - "§7§oParcourez les valeurs" - "§7§oavec un clique gauche/droit." - bungeecord: - name: "Transfert Bungeecord" + random_skin: + name: "Apparence aléatoire à la connexion" lore: + - "{0}" + - "{1}" - "§7§oParcourez les valeurs" - "§7§oavec un clique gauche/droit." \ No newline at end of file diff --git a/src/main/resources/names.csv b/src/main/resources/names.csv new file mode 100644 index 0000000..4eae88f --- /dev/null +++ b/src/main/resources/names.csv @@ -0,0 +1,490 @@ +w4nderlost +TooParanoids +Der_OG_31er +9xxDaRkShAdOwxx9 +giiiaan_ +Jqstinnn +Tillysboy92 +AlwaysCello +SyndrexG0D +Peypeycake +ThePerjurer +Tioe +Elternbaum +BarkersRover_16 +pebsso +cyrus6950 +Bigest_guy +RV0REU +R379 +Shetell +_HEAPASS_ +Iamaloner21 +TheFardoxGamerHD +Flyboi43 +Cha0smusik +kat00 +Infreat +Crummymoofin +MijnVriend +momsrightkidney +dmacrado +Elephantman321 +ii_hamoudi_YT +FaurePavane +ambiezzz +XD_Bandit695_XD +Nabingo +Cyl0re +ku5 +SrAragon +StarlightDream9 +CJ5370 +rainbees +KeroTheWolf +Andrews9722 +cursed_Assyrian +yamateni +ProgramEXE +exprso +harrypanda +LookerMD +migykins +Wintrous +ZzGaBi +Flayber +Grenixal +maeve_wells +Creeper10fr +10Chairs +2525lock +Shqipe +XenitsuZen +Berno17_ +wolle1313 +HalfDogHalfCat1 +NachoGarcia +popsicoal +NemesiSevil2006 +AnywayOj +Tanko12345 +Samdweck +LYRECODE123 +Resulten +SirBastii +Maku056 +ItzArnizzz +Brsh3620 +Masonita +kapplanium +shoezo +Mansur203 +Waterboy15217 +redragonne +ghko325 +HopePVP_tw7 +xtka +NimwenxZ +Hiro0408 +PanderaWz +Shesu +_Aniste_NY_ +Besceste +3ee3 +ArcticGalaxy123 +snooze_mingo +LizzyLomnh +FaZeChulupa +LineZeeK +liabilaty +BlackSheep1610 +Simif69 +Aficionado +riekin +XLuggas +MathExams +6fq +Marveel +lolme51 +TaioSayUwU +Fonklift +blvw +Po1204 +Pierre_Rabbit +mifimasters +MrRidge1 +arnqen +Nick_cage102 +Geo_9918 +SSShudder +Nicolas_Mom +WolfMatrix101 +frictionless_ +Gughik +gold_dragon_4 +nealxero +ClonedPickle +SourWatermelonxX +devilunion +Daryifuny +joaomarcos11 +Dekeef +PadfootTheDog +DarkScopez80 +flowers220 +Gaiiya +The_Yeet_ +juuuuwu +MrMafioz +Surpasses +TypicalOwen +0lober +Zerfixy +Sunny3803b +neostanley +Creeper_Kart +minestin +Goldenfredster +Vju +MrArchI_YT +Casper1709 +Backiii_ +DrCreate +Nova_Lux1 +Jayvin_Blanco +ShadowMan1770 +0KOPO40K +Silk_Altermann69 +Alu____ +Honey_MilkExe112 +T0XEI +CB_13 +Paragorn +HaGiang +Shivendra8i +Mayflower47 +Not_Someguy +raxx111bg +IceyGlaceon +grasseffect +PoopTNTpvp +codecyber +Shrumpkin13 +Shqdown +Cmartin82 +KTCXD_5p0tty +rockesalt +goldjeong +TheRealAKD +NamiSwaaan +yaaratol +Dikiy_Flexer +PoLecker24 +_SakuraTree +PikkOgP0rno +HawksFang +BlueWinterWolf +hskmerk +gurmaw +Lunggor +clashfield +Zelaste +ACommonMouse +TJ_Mystery +Dizzy3312 +Raindropsss +minecraftxiaoju +sachilovebbh +Celina_LaZyCxt +firered6 +55000000 +Illunarnati +Jedidiah2003 +setomz1 +basically_e +TommyGreif02 +Bongrip42069 +Coco_Keopi +Lt_Colt +Kuurotta +GqmeKnight +WinCo_Foods +FKDLZ +IanPumpkin +tastywtf +natedawg0 +ZQLFenyx +GamerMaster110 +papajobi9 +Yucaroon +Xion_69 +AirJaw +funfun321234 +khalleesii +Pozisch +thorso15 +kyumisoup +Leonqrd +BmwDreamer +TehRos +pitplayer69 +_ve0 +Miss_Yuka +I_am_a_Bucket +nicolas_bean +xHorizonGC +RTX3060_ +Borec188 +c8to +megan3groCENG +ventriloquize +galczin +Scorch3dEarth3d +nightstarLP +VittyGam3r +GLaDOS__ +hydrelo +JustACarter +MikeDropperPlay +NorthernWest +_Skelesam_ +ZX_Style +Tamas_Boi +taylub +VyacheslavO_O +trippyaubs +udtpic +Lunarglow +Stoolman +legendary_meow +Loganii +CaptainStain56 +FoofieGeto +Judgeavapl +OneBigDigger +Sorem13 +Raisonneur +IlkoalI +Naxa +craigbabyonebay +NicholasG04 +UtopianCrisi +CalamarPasGenti +ryluh_ +Aceslimz +Howardygh99927 +brandon257 +MarcoswildHD +x_XSkylerX_x +Bronco09 +That_Kookie_ +Danigtz +Ricky_lol +999keyt +Thilow15 +Difesito +ostehovl +isacano_12 +big_esra +secretbaguette +MrCommunism +Jekube +GrandeMaster +DrGrip +TheArnek +JacsMars +Lliam14 +MrGameandWatch84 +Rinzap +XrazzeD +ukknown +ZohanPrent +Naspo +Rajem +VepiGHG +matoureal +BrianChen87 +Jrocky +stivo999 +Des_cole +ReqGames +Kingja1912 +issssyy +Apache424 +Nick_Zockt_ +Mr_Haider_10 +ValentineBun +fedorPro228 +xTilz +blockbuster02k +4ck +FrostedTree +VegasTortoise +ZBellaV12121 +paypales +qDread +itsRiven +i8oreo +_kimcream_ +Phisuss +Oscargray +Elsiff +callofdutydog00 +BruhTheMoment +Pazmaa +MythicalOak +komuchi33 +awf4 +Jacobsaurus21 +itsjohannaa +Jello12 +Adrien183 +jajazzywazzy +Jorjie22 +SuperBrawlr5788 +KaraageV +_Hanime_tv +Padilhao +Tikkas +ordinaryducky +Mothytix95 +renopotouwu +1000voices +niclas05 +Felipstein +DoutorBauer +FireballPlaysMC +vapelordsheep +Aboain +ImGrexy +Aivokolo +SuperAmazing101 +va75a77a +_DawYans_ +AceT1223 +Livvyboo7 +Saaaaaaaaaaaaans +okaychill +AwesomeBro1122 +absolutesnek +jogie5000 +curtainSenpai +gabbyisaloser +gamergurl6969 +ZeusDk +FranaRibas +Discoboss +SYZ_1 +Nakoe +FIU_Captive +xSiFan_ +ilyDeathxz +da_fipsi +Lochy +The_Lavie37 +Tonion +vnvrchy +xX0meg4Xx +haohxtheone +VtTronic +xDaniGum +tikkelill +DatYoshi +eyehamstewpit +nicholas460_ +Memsly445 +nugunugu +AndreSlayz +jashik1 +Qweenoftheocean +Coltable +treblaclef +Kisaxx +69Dxddy69 +RaulCuh +3Wheat +_OscarTheGrouch +oIsqk +Blockbusterweng +AntoineDegauss +ValeIsTheBest +SwaggyCrabby +DieOfSanity +SirenMC +Jade_Jewel +Tropic44 +666splendor +TallnessTallness +breadgang9827 +Muffin_Worlds +DedicatedVeggie +Gonzalox_7 +datrandomasian +Chasemon01 +Nyavix +Lonely_Summers +_RoveN +ok_kyro +LN_hunter +saharsabz +Roselilianna +Gadx +xtytan +RoRo_levosgien88 +Bowsesqe_21 +Bennett528 +TheShipSailsWest +KaiserGaming +Layna_Shinozaki +OP_greatly +D3rpTaco +Loufink +Jorlmungus +Snichol1801 +Ludixeo +Imoeto +MarshallNebunu +crazycrystals +Parapatus +HahaDani +MrQuaring +DonTurnt +SailorRoberts101 +FluffieBear +TripleThick +KingSparta +MummysHome +Cooga3 +Technosista +Youmerstudios +SkyyRaine +criss102 +mrfailt +CraftingBasic +qnxkdifh +Igorex2k20 +LaLisette +ReBoredGamer +warlordwest +ExoTemporal +KingLonmc +666Horus +IslandCity2 +TheBigSavage1 +Trishke2003 +skyrowin +Krissy3D +AntonWTobias +SaddyWasTaken +Ahoy_Peko_Hao_Yo +T4nTr1Ss +aleciolike +ninja_shenley +Lordmord1337 +eatmypoopfather +Ktanner +The42OWeedGOD +CooperBee +_MikuMiku_ +althume +Tr3bba93 diff --git a/src/test/java/xyz/ineanto/nicko/test/appearance/RandomNameTest.java b/src/test/java/xyz/ineanto/nicko/test/appearance/RandomNameTest.java new file mode 100644 index 0000000..c5486b6 --- /dev/null +++ b/src/test/java/xyz/ineanto/nicko/test/appearance/RandomNameTest.java @@ -0,0 +1,35 @@ +package xyz.ineanto.nicko.test.appearance; + +import be.seeseemelk.mockbukkit.MockBukkit; +import org.junit.jupiter.api.AfterAll; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.DisplayName; +import org.junit.jupiter.api.Test; +import xyz.ineanto.nicko.NickoBukkit; +import xyz.ineanto.nicko.appearance.random.RandomNameFetcher; +import xyz.ineanto.nicko.config.Configuration; + +import static org.junit.jupiter.api.Assertions.assertNotNull; + +public class RandomNameTest { + private static NickoBukkit plugin; + + @BeforeAll + public static void setup() { + final Configuration config = Configuration.DEFAULT; + MockBukkit.mock(); + plugin = MockBukkit.load(NickoBukkit.class, config); + } + + @Test + @DisplayName("Get random name") + public void getRandomName() { + final RandomNameFetcher randomNameFetcher = new RandomNameFetcher(plugin); + assertNotNull(randomNameFetcher.getRandomUsername()); + } + + @AfterAll + public static void shutdown() { + MockBukkit.unmock(); + } +} diff --git a/src/test/java/xyz/ineanto/nicko/test/storage/SQLStorageTest.java b/src/test/java/xyz/ineanto/nicko/test/storage/SQLStorageTest.java index 774059e..6f79018 100644 --- a/src/test/java/xyz/ineanto/nicko/test/storage/SQLStorageTest.java +++ b/src/test/java/xyz/ineanto/nicko/test/storage/SQLStorageTest.java @@ -63,12 +63,12 @@ public class SQLStorageTest { assertNull(profile.getName()); assertNull(profile.getSkin()); assertEquals(profile.getLocale(), Locale.ENGLISH); - assertTrue(profile.isBungeecordTransfer()); + assertTrue(profile.isRandomSkin()); profile.setName("Notch"); profile.setSkin("Notch"); profile.setLocale(Locale.FRENCH); - profile.setBungeecordTransfer(false); + profile.setRandomSkin(false); final ActionResult result = dataStore.getStorage().store(uuid, profile); assertFalse(result.isError()); @@ -85,7 +85,7 @@ public class SQLStorageTest { assertEquals(updatedProfile.getName(), "Notch"); assertEquals(updatedProfile.getSkin(), "Notch"); assertEquals(updatedProfile.getLocale(), Locale.FRENCH); - assertFalse(updatedProfile.isBungeecordTransfer()); + assertFalse(updatedProfile.isRandomSkin()); } @Test