Skip to content
This repository was archived by the owner on Apr 30, 2022. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
a9ab117
Initial Commit
JolTheGreat Oct 31, 2021
f4e28ec
Initial Commit for feature #70
JolTheGreat Oct 31, 2021
6d2eb97
Merge remote-tracking branch 'origin/feature/mob_purchase' into featu…
JolTheGreat Oct 31, 2021
727dabe
残高システム&モブを追加 feature #70
JolTheGreat Oct 31, 2021
1aed5dd
JavaDoc加筆
JolTheGreat Oct 31, 2021
ae0930b
訂正
JolTheGreat Oct 31, 2021
5a2159f
訂正コミット
JolTheGreat Nov 3, 2021
8825c7f
個数を1個から2個へ変更し、バグを防ぐ
JolTheGreat Nov 4, 2021
29a4d27
Merge pull request #91 from arainu-github/feature/mob_purchase
kumitatepazuru Nov 5, 2021
90e3416
バグ修正
kumitatepazuru Nov 9, 2021
5ed0cc8
Merge remote-tracking branch 'origin/develop' into develop
kumitatepazuru Nov 9, 2021
e71f713
バグ修正 fix #85
kumitatepazuru Nov 11, 2021
30d2ae0
Check Inventory Full
AreaEffectCloud Nov 12, 2021
0e2c0d0
バグ修正&全額入金できるように
kumitatepazuru Nov 13, 2021
f5004a7
コード整形
kumitatepazuru Nov 13, 2021
dc2985c
Merge pull request #95 from arainu-github/feature/all-money
kumitatepazuru Nov 13, 2021
72abb35
Merge pull request #93 from arainu-github/feature/ItemUtils
kumitatepazuru Nov 13, 2021
6fa7b01
コード整形
kumitatepazuru Nov 13, 2021
7674f96
mob-villagerの価格を修正
kumitatepazuru Nov 14, 2021
694238a
mob-villagerの価格が変更されるように
kumitatepazuru Nov 14, 2021
fa83e13
Merge branch 'master' into develop
kumitatepazuru Nov 14, 2021
1da19e4
バグ修正
kumitatepazuru Nov 14, 2021
744953e
Merge remote-tracking branch 'origin/develop' into develop
kumitatepazuru Nov 14, 2021
4c49683
javadoc加筆
kumitatepazuru Nov 14, 2021
286e49b
バグ修正
kumitatepazuru Nov 14, 2021
6f761af
バグ修正
kumitatepazuru Nov 19, 2021
bf3b534
バグ修正
kumitatepazuru Nov 24, 2021
14a9864
fix #96
kumitatepazuru Nov 24, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,12 @@
import org.bukkit.plugin.PluginManager;
import org.bukkit.plugin.RegisteredServiceProvider;
import org.bukkit.plugin.java.JavaPlugin;
//import org.dynmap.DynmapAPI;
import org.jetbrains.annotations.NotNull;
import world.arainu.core.metaverseplugin.commands.CommandBase;
import world.arainu.core.metaverseplugin.commands.CommandSpawn;
import world.arainu.core.metaverseplugin.commands.CommandiPhone;
import world.arainu.core.metaverseplugin.commands.CommandWhitelist;
import world.arainu.core.metaverseplugin.commands.CommandiPhone;
import world.arainu.core.metaverseplugin.gui.Gui;
import world.arainu.core.metaverseplugin.gui.MenuItem;
import world.arainu.core.metaverseplugin.iphone.Bank;
Expand All @@ -37,6 +38,7 @@
import world.arainu.core.metaverseplugin.listener.VillagerListener;
import world.arainu.core.metaverseplugin.scheduler.LateScheduler;
import world.arainu.core.metaverseplugin.scheduler.MoneyScheduler;
import world.arainu.core.metaverseplugin.scheduler.SqlScheduler;
import world.arainu.core.metaverseplugin.store.ServerStore;
import world.arainu.core.metaverseplugin.store.iPhoneStore;
import world.arainu.core.metaverseplugin.utils.sqlUtil;
Expand All @@ -58,6 +60,7 @@ public final class MetaversePlugin extends JavaPlugin {
private static MetaversePlugin Instance;
@Getter
private static FileConfiguration configuration;
// @Getter private static DynmapAPI dynmap;
private final HashMap<String, CommandBase> commands = new HashMap<>();

@Override
Expand All @@ -78,10 +81,12 @@ public void onEnable() {
private void setScheduler() {
new MoneyScheduler().runTaskTimer(this, 0, 20);
new LateScheduler().runTaskTimer(this, 0, 20);
new SqlScheduler().runTaskTimer(this, 0, 20 * 60 * 60);
createStairsYml();
}

private void EnablePlugins() {
// dynmap = (DynmapAPI) getServer().getPluginManager().getPlugin("Dynmap");
if (!setupEconomy()) {
getLogger().severe(String.format("[%s] - Vaultが依存する経済プラグインがなかったためメタバースプラグインを無効にしました!!!", getDescription().getName()));
getServer().getPluginManager().disablePlugin(this);
Expand Down Expand Up @@ -122,7 +127,7 @@ private void loadGuis() {
traptowerItem.setItemMeta(traptowerMeta);
iPhoneStore.addGuiItem(new MenuItem("トラップタワーに行く", new TrapTower()::executeGui, true, traptowerItem), (p) -> !p.getWorld().getName().equals(configuration.getString("world.traptower")) && Objects.equals(ServerStore.getServerName(), "survival"));
iPhoneStore.addGuiItem(new MenuItem("サバイバルサーバーに戻る", new MoveSurvival()::executeGui, true, Material.GRASS_BLOCK), (p) -> p.getWorld().getName().equals(configuration.getString("world.traptower")));
iPhoneStore.addGuiItem(new MenuItem("エンドラを復活させる", new iPhoneEnderDragon()::executeGui, true, Material.END_STONE), (p) -> Gui.isEnderDragonDead(p) && Gui.isPlayerInEnd(p));
iPhoneStore.addGuiItem(new MenuItem("エンドラを復活させる", new iPhoneEnderDragon()::executeGui, true, Material.END_STONE), (p) -> !Gui.isEnderDragonLiving(p) && Gui.isPlayerInEnd(p));
}

/**
Expand All @@ -136,13 +141,14 @@ public void setListener() {
PM.registerEvents(Gui.getInstance(), this);
PM.registerEvents(new PublicListener(), this);
PM.registerEvents(new VillagerListener(), this);
this.getServer().getMessenger().registerOutgoingPluginChannel(this, "BungeeCord");
PM.registerEvents(new CommandWhitelist(), this);
DiscordSRV.api.subscribe(this);
}

/**
* JDAがログインできてReadyになったときにServerListenerを定義する
* ぬるぽ対策
*
* @param event イベント
*/
@Subscribe
Expand Down Expand Up @@ -174,11 +180,10 @@ private void addCommand(String commandName, CommandBase command) {
*/
private void loadCommands() {
commands.clear();

addCommand("worldtp", new Worldteleport());
addCommand("iphone", new CommandiPhone());
addCommand("spawn", new CommandSpawn());
addCommand("whitelist",new CommandWhitelist());
addCommand("whitelist", new CommandWhitelist());
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -123,21 +123,12 @@ public boolean execute(Player player, Command command, String label, String[] ar
recipes.add(createRecipe(1, 5, new ItemStack(Material.STONE_BRICKS)));
recipes.add(createRecipe(1, 5, new ItemStack(Material.CRACKED_STONE_BRICKS)));
recipes.add(createRecipe(1, 5, new ItemStack(Material.CHISELED_STONE_BRICKS)));
recipes.add(createRecipe(1, 5, new ItemStack(Material.GRAVEL)));
recipes.add(createRecipe(1, 10, new ItemStack(Material.GRANITE)));
recipes.add(createRecipe(1, 10, new ItemStack(Material.POLISHED_GRANITE)));
recipes.add(createRecipe(1, 10, new ItemStack(Material.DIORITE)));
recipes.add(createRecipe(1, 10, new ItemStack(Material.POLISHED_DIORITE)));
recipes.add(createRecipe(1, 10, new ItemStack(Material.ANDESITE)));
recipes.add(createRecipe(1, 10, new ItemStack(Material.POLISHED_ANDESITE)));
recipes.add(createRecipe(1, 5, new ItemStack(Material.SANDSTONE)));
recipes.add(createRecipe(1, 5, new ItemStack(Material.CUT_SANDSTONE)));
recipes.add(createRecipe(1, 5, new ItemStack(Material.CHISELED_SANDSTONE)));
recipes.add(createRecipe(1, 5, new ItemStack(Material.SMOOTH_SANDSTONE)));
recipes.add(createRecipe(1, 5, new ItemStack(Material.RED_SANDSTONE)));
recipes.add(createRecipe(1, 5, new ItemStack(Material.CUT_RED_SANDSTONE)));
recipes.add(createRecipe(1, 5, new ItemStack(Material.CHISELED_RED_SANDSTONE)));
recipes.add(createRecipe(1, 5, new ItemStack(Material.SMOOTH_RED_SANDSTONE)));
recipes.add(createRecipe(1, 40, new ItemStack(Material.END_STONE)));
recipes.add(createRecipe(1, 40, new ItemStack(Material.END_STONE_BRICKS)));
recipes.add(createRecipe(1, 50, new ItemStack(Material.OBSIDIAN)));
Expand Down Expand Up @@ -185,21 +176,12 @@ public boolean execute(Player player, Command command, String label, String[] ar
recipes.add(createRecipe2(1, 5, new ItemStack(Material.STONE_BRICKS)));
recipes.add(createRecipe2(1, 5, new ItemStack(Material.CRACKED_STONE_BRICKS)));
recipes.add(createRecipe2(1, 5, new ItemStack(Material.CHISELED_STONE_BRICKS)));
recipes.add(createRecipe2(1, 5, new ItemStack(Material.GRAVEL)));
recipes.add(createRecipe2(1, 10, new ItemStack(Material.GRANITE)));
recipes.add(createRecipe2(1, 10, new ItemStack(Material.POLISHED_GRANITE)));
recipes.add(createRecipe2(1, 10, new ItemStack(Material.DIORITE)));
recipes.add(createRecipe2(1, 10, new ItemStack(Material.POLISHED_DIORITE)));
recipes.add(createRecipe2(1, 10, new ItemStack(Material.ANDESITE)));
recipes.add(createRecipe2(1, 10, new ItemStack(Material.POLISHED_ANDESITE)));
recipes.add(createRecipe2(1, 5, new ItemStack(Material.SANDSTONE)));
recipes.add(createRecipe2(1, 5, new ItemStack(Material.CUT_SANDSTONE)));
recipes.add(createRecipe2(1, 5, new ItemStack(Material.CHISELED_SANDSTONE)));
recipes.add(createRecipe2(1, 5, new ItemStack(Material.SMOOTH_SANDSTONE)));
recipes.add(createRecipe2(1, 5, new ItemStack(Material.RED_SANDSTONE)));
recipes.add(createRecipe2(1, 5, new ItemStack(Material.CUT_RED_SANDSTONE)));
recipes.add(createRecipe2(1, 5, new ItemStack(Material.CHISELED_RED_SANDSTONE)));
recipes.add(createRecipe2(1, 5, new ItemStack(Material.SMOOTH_RED_SANDSTONE)));
recipes.add(createRecipe2(1, 40, new ItemStack(Material.END_STONE)));
recipes.add(createRecipe2(1, 40, new ItemStack(Material.END_STONE_BRICKS)));
recipes.add(createRecipe2(1, 50, new ItemStack(Material.OBSIDIAN)));
Expand Down Expand Up @@ -236,22 +218,68 @@ public boolean execute(Player player, Command command, String label, String[] ar
recipes.add(createRecipe2(1, 5, new ItemStack(Material.POINTED_DRIPSTONE)));
villager.setRecipes(recipes);
}
case "money-villager" -> {
Villager villager = createVillager("両替店員", Villager.Profession.TOOLSMITH, player);
case "mob-villager" -> {
Villager villager = createVillager("モブ店員", Villager.Profession.FARMER, player);
sqlUtil.setuuidtype(villager.getUniqueId(), args[0]);
List<MerchantRecipe> recipes = new ArrayList<>();
recipes.add(createRecipe2(1000, 5, new ItemStack(Material.AXOLOTL_SPAWN_EGG)));
recipes.add(createRecipe2(500, 5, new ItemStack(Material.BEE_SPAWN_EGG)));
recipes.add(createRecipe2(500, 5, new ItemStack(Material.CAT_SPAWN_EGG)));
recipes.add(createRecipe2(150, 5, new ItemStack(Material.CHICKEN_SPAWN_EGG)));
recipes.add(createRecipe2(150, 5, new ItemStack(Material.COD_SPAWN_EGG)));
recipes.add(createRecipe2(150, 5, new ItemStack(Material.COW_SPAWN_EGG)));
recipes.add(createRecipe2(1000, 5, new ItemStack(Material.DOLPHIN_SPAWN_EGG)));
recipes.add(createRecipe2(1000, 5, new ItemStack(Material.DONKEY_SPAWN_EGG)));
recipes.add(createRecipe2(500, 5, new ItemStack(Material.FOX_SPAWN_EGG)));
recipes.add(createRecipe2(1000, 5, new ItemStack(Material.HORSE_SPAWN_EGG)));
recipes.add(createRecipe2(1000, 5, new ItemStack(Material.LLAMA_SPAWN_EGG)));
recipes.add(createRecipe2(500, 5, new ItemStack(Material.OCELOT_SPAWN_EGG)));
recipes.add(createRecipe2(1000, 5, new ItemStack(Material.PARROT_SPAWN_EGG)));
recipes.add(createRecipe2(500, 5, new ItemStack(Material.PANDA_SPAWN_EGG)));
recipes.add(createRecipe2(150, 5, new ItemStack(Material.PIG_SPAWN_EGG)));
recipes.add(createRecipe2(500, 5, new ItemStack(Material.POLAR_BEAR_SPAWN_EGG)));
recipes.add(createRecipe2(200, 5, new ItemStack(Material.PUFFERFISH_SPAWN_EGG)));
recipes.add(createRecipe2(500, 5, new ItemStack(Material.RABBIT_SPAWN_EGG)));
recipes.add(createRecipe2(150, 5, new ItemStack(Material.SALMON_SPAWN_EGG)));
recipes.add(createRecipe2(150, 5, new ItemStack(Material.SHEEP_SPAWN_EGG)));
recipes.add(createRecipe2(1000, 5, new ItemStack(Material.SKELETON_HORSE_SPAWN_EGG)));
recipes.add(createRecipe2(150, 5, new ItemStack(Material.SQUID_SPAWN_EGG)));
recipes.add(createRecipe2(1000, 5, new ItemStack(Material.STRIDER_SPAWN_EGG)));
recipes.add(createRecipe2(200, 5, new ItemStack(Material.TROPICAL_FISH_SPAWN_EGG)));
recipes.add(createRecipe2(300, 5, new ItemStack(Material.TURTLE_SPAWN_EGG)));
recipes.add(createRecipe2(500, 5, new ItemStack(Material.WOLF_SPAWN_EGG)));
recipes.add(createRecipe2(1000, 5, new ItemStack(Material.ZOMBIE_HORSE_SPAWN_EGG)));
villager.setRecipes(recipes);

}
case "sandstone-villager" -> {
Villager villager = createVillager("砂岩砂利店員", Villager.Profession.MASON, player);
sqlUtil.setuuidtype(villager.getUniqueId(), args[0]);
List<MerchantRecipe> recipes = new ArrayList<>();
recipes.add(createRecipe2(1, 5, Bank.getPluginMoneyEmerald(5,1)));
recipes.add(createRecipe2(5, 2, Bank.getPluginMoneyEmerald(10,1)));
recipes.add(createRecipe2(10, 5, Bank.getPluginMoneyEmerald(50,1)));
recipes.add(createRecipe2(50, 2, Bank.getPluginMoneyEmerald(100,1)));
recipes.add(createRecipe2(100, 5, Bank.getPluginMoneyEmerald(500,1)));
recipes.add(createRecipe2(500,2 , Bank.getPluginMoneyEmerald(1000,1)));
recipes.add(createRecipe(1, 5, Bank.getPluginMoneyEmerald(5,1)));
recipes.add(createRecipe(5, 2, Bank.getPluginMoneyEmerald(10,1)));
recipes.add(createRecipe(10, 5, Bank.getPluginMoneyEmerald(50,1)));
recipes.add(createRecipe(50, 2, Bank.getPluginMoneyEmerald(100,1)));
recipes.add(createRecipe(100, 5, Bank.getPluginMoneyEmerald(500,1)));
recipes.add(createRecipe(500,2 , Bank.getPluginMoneyEmerald(1000,1)));
recipes.add(createRecipe(1, 5, new ItemStack(Material.GRAVEL)));
recipes.add(createRecipe(1, 5, new ItemStack(Material.SANDSTONE)));
recipes.add(createRecipe(1, 5, new ItemStack(Material.CUT_SANDSTONE)));
recipes.add(createRecipe(1, 5, new ItemStack(Material.CHISELED_SANDSTONE)));
recipes.add(createRecipe(1, 5, new ItemStack(Material.SMOOTH_SANDSTONE)));
recipes.add(createRecipe(1, 5, new ItemStack(Material.RED_SANDSTONE)));
recipes.add(createRecipe(1, 5, new ItemStack(Material.CUT_RED_SANDSTONE)));
recipes.add(createRecipe(1, 5, new ItemStack(Material.CHISELED_RED_SANDSTONE)));
recipes.add(createRecipe(1, 5, new ItemStack(Material.SMOOTH_RED_SANDSTONE)));
villager.setRecipes(recipes);
}
case "sandstone-villager-shop" -> {
Villager villager = createVillager("お金店員(砂岩系&砂利)", Villager.Profession.MASON, player);
sqlUtil.setuuidtype(villager.getUniqueId(), args[0]);
List<MerchantRecipe> recipes = new ArrayList<>();
recipes.add(createRecipe2(1, 5, new ItemStack(Material.GRAVEL)));
recipes.add(createRecipe2(1, 5, new ItemStack(Material.SANDSTONE)));
recipes.add(createRecipe2(1, 5, new ItemStack(Material.CUT_SANDSTONE)));
recipes.add(createRecipe2(1, 5, new ItemStack(Material.CHISELED_SANDSTONE)));
recipes.add(createRecipe2(1, 5, new ItemStack(Material.SMOOTH_SANDSTONE)));
recipes.add(createRecipe2(1, 5, new ItemStack(Material.RED_SANDSTONE)));
recipes.add(createRecipe2(1, 5, new ItemStack(Material.CUT_RED_SANDSTONE)));
recipes.add(createRecipe2(1, 5, new ItemStack(Material.CHISELED_RED_SANDSTONE)));
recipes.add(createRecipe2(1, 5, new ItemStack(Material.SMOOTH_RED_SANDSTONE)));
villager.setRecipes(recipes);
}
default -> {
Expand All @@ -267,6 +295,6 @@ public boolean execute(Player player, Command command, String label, String[] ar
@Override
public List<String> onTabComplete(@NotNull CommandSender commandSender, @NotNull Command command, @NotNull String label,
String[] args) {
return List.of("mason-villager", "stone-villager", "mason-villager-shop", "stone-villager-shop", "money-villager");
return List.of("mason-villager", "stone-villager", "mason-villager-shop", "stone-villager-shop", "mob-villager");
}
}
Original file line number Diff line number Diff line change
@@ -1,22 +1,15 @@
package world.arainu.core.metaverseplugin.commands;

import com.destroystokyo.paper.profile.PlayerProfile;
import me.leoko.advancedban.manager.PunishmentManager;
import net.kyori.adventure.text.Component;
import net.kyori.adventure.text.format.NamedTextColor;
import org.bukkit.Bukkit;
import org.bukkit.OfflinePlayer;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.player.AsyncPlayerPreLoginEvent;
import org.jetbrains.annotations.NotNull;
import world.arainu.core.metaverseplugin.utils.ChatUtil;
import world.arainu.core.metaverseplugin.utils.sqlUtil;

import java.util.List;
import java.util.Objects;
import java.util.UUID;


Expand Down Expand Up @@ -71,7 +64,11 @@ public boolean execute(CommandSender sender, Command command, String label, Stri
assert whitelist != null;
for (UUID uuid : whitelist) {
//プレイヤーを表示する際にうるさくならないようにplaysoundをfalseに
ChatUtil.success(sender, Bukkit.getOfflinePlayer(uuid).getName(), false);
String name = Bukkit.getOfflinePlayer(uuid).getName();
if(name == null){
name = uuid.toString();
}
ChatUtil.success(sender, name, false);
}
ChatUtil.success(sender, "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━", false);
} else {
Expand Down
25 changes: 10 additions & 15 deletions src/main/java/world/arainu/core/metaverseplugin/gui/Gui.java
Original file line number Diff line number Diff line change
@@ -1,17 +1,16 @@
package world.arainu.core.metaverseplugin.gui;

import net.kyori.adventure.text.Component;
import net.kyori.adventure.text.format.TextDecoration;
import org.bukkit.*;
import net.kyori.adventure.text.TextComponent;
import net.kyori.adventure.text.TranslatableComponent;
import net.kyori.adventure.text.format.NamedTextColor;
import org.bukkit.Bukkit;
import org.bukkit.Sound;
import org.bukkit.SoundCategory;
import org.bukkit.World;
import org.bukkit.enchantments.Enchantment;
import org.bukkit.entity.EnderDragon;
import org.bukkit.entity.HumanEntity;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
Expand All @@ -29,7 +28,7 @@
import java.util.Collection;
import java.util.Comparator;
import java.util.HashMap;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.List;
import java.util.Objects;
import java.util.function.Consumer;

Expand Down Expand Up @@ -118,7 +117,8 @@ public void onInventoryClose(InventoryCloseEvent e) {

private void openMenuJavaImpl(Player player, String title, MenuItem[] items) {
Integer max = Arrays.stream(items).map(MenuItem::getY).max(Comparator.naturalOrder()).orElse(0);
final Inventory inv = Bukkit.createInventory(null, Math.max(1 + items.length / 9, max) * 9, Component.text(title));
final int size = Math.max(1 + (items.length-1) / 9, max) * 9;
final Inventory inv = Bukkit.createInventory(null, size, Component.text(title));
final HashMap<Integer, MenuItem> itemmap = new HashMap<>();
final int[] count = {0};

Expand Down Expand Up @@ -208,16 +208,11 @@ public static boolean isPlayerInEnd(Player player) {
* @return エンドラが死んでる場合はtrue
*/

public static boolean isEnderDragonDead(Player player) {
if (isPlayerInEnd(player)) {
AtomicBoolean alive = new AtomicBoolean(false);
player.getWorld().getLivingEntities().forEach((livingEntity -> {
alive.set(livingEntity instanceof EnderDragon);
}));
return alive.get();
} else {
return false;
}
public static boolean isEnderDragonLiving(Player player) {
List<LivingEntity> entity = player.getWorld().getLivingEntities();
for (LivingEntity i : entity) {
if (i instanceof EnderDragon) return true;
} return false;
}

private final HashMap<Inventory, HashMap<Integer, MenuItem>> invMap = new HashMap<>();
Expand Down
Loading