|
1 | | -/* |
2 | | - * This file is a part of project QuickShop, the name is FabledIntegration.java |
3 | | - * Copyright (C) PotatoCraft Studio and contributors |
4 | | - * |
5 | | - * This program is free software: you can redistribute it and/or modify it |
6 | | - * under the terms of the GNU General Public License as published by the |
7 | | - * Free Software Foundation, either version 3 of the License, or |
8 | | - * (at your option) any later version. |
9 | | - * |
10 | | - * This program is distributed in the hope that it will be useful, but WITHOUT |
11 | | - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
12 | | - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
13 | | - * for more details. |
14 | | - * |
15 | | - * You should have received a copy of the GNU General Public License |
16 | | - * along with this program. If not, see <http://www.gnu.org/licenses/>. |
17 | | - * |
18 | | - */ |
19 | | - |
20 | | -package org.maxgamer.quickshop.integration.fabledskyblock; |
21 | | - |
22 | | -import com.songoda.skyblock.SkyBlock; |
23 | | -import com.songoda.skyblock.island.Island; |
24 | | -import com.songoda.skyblock.island.IslandRole; |
25 | | -import org.bukkit.Location; |
26 | | -import org.bukkit.entity.Player; |
27 | | -import org.jetbrains.annotations.NotNull; |
28 | | -import org.maxgamer.quickshop.QuickShop; |
29 | | -import org.maxgamer.quickshop.integration.IntegrateStage; |
30 | | -import org.maxgamer.quickshop.integration.IntegrationStage; |
31 | | -import org.maxgamer.quickshop.integration.QSIntegratedPlugin; |
32 | | -import org.maxgamer.quickshop.util.reload.ReloadResult; |
33 | | -import org.maxgamer.quickshop.util.reload.ReloadStatus; |
34 | | - |
35 | | -@IntegrationStage(loadStage = IntegrateStage.onEnableAfter) |
36 | | -public class FabledIntegration extends QSIntegratedPlugin { |
37 | | - |
38 | | - private boolean ignoreDisabledWorlds; |
39 | | - private boolean whitelist; |
40 | | - |
41 | | - public FabledIntegration(QuickShop plugin) { |
42 | | - super(plugin); |
43 | | - plugin.getReloadManager().register(this); |
44 | | - loadConfiguration(); |
45 | | - registerListener(); |
46 | | - } |
47 | | - |
48 | | - private void loadConfiguration() { |
49 | | - ignoreDisabledWorlds = plugin.getConfig().getBoolean("integration.fabledskyblock.ignore-disabled-worlds"); |
50 | | - whitelist = plugin.getConfig().getBoolean("integration.fabledskyblock.whitelist-mode"); |
51 | | - } |
52 | | - |
53 | | - /** |
54 | | - * Return the integrated plugin name. |
55 | | - * For example, Residence |
56 | | - * |
57 | | - * @return integrated plugin |
58 | | - */ |
59 | | - @Override |
60 | | - public @NotNull String getName() { |
61 | | - return "FabledSkyblock"; |
62 | | - } |
63 | | - |
64 | | - /** |
65 | | - * Check if a player can create shop here |
66 | | - * |
67 | | - * @param player the player want to create shop |
68 | | - * @param location shop location |
69 | | - * @return If you can create shop here |
70 | | - */ |
71 | | - @Override |
72 | | - public boolean canCreateShopHere(@NotNull Player player, @NotNull Location location) { |
73 | | - Island island = SkyBlock.getInstance().getIslandManager().getIslandAtLocation(location); |
74 | | - if (island == null) return whitelist; |
75 | | - return island.getRole(player).equals(IslandRole.Member) || island.getRole(player).equals(IslandRole.Owner) |
76 | | - || island.getRole(player).equals(IslandRole.Operator); |
77 | | - } |
78 | | - |
79 | | - /** |
80 | | - * Check if a player can trade with shop here |
81 | | - * |
82 | | - * @param player the player want to trade with shop |
83 | | - * @param location shop location |
84 | | - * @return If you can trade with shop here |
85 | | - */ |
86 | | - @Override |
87 | | - public boolean canTradeShopHere(@NotNull Player player, @NotNull Location location) { |
88 | | - if (SkyBlock.getInstance().getIslandManager().getIslandAtLocation(location) == null) { |
89 | | - return ignoreDisabledWorlds; |
90 | | - } |
91 | | - return true; |
92 | | - } |
93 | | - |
94 | | - /** |
95 | | - * Check if a player can delete a shop here |
96 | | - * |
97 | | - * @param player the player want to delete the shop |
98 | | - * @param location shop location |
99 | | - * @return If you can delete the shop here |
100 | | - */ |
101 | | - @Override |
102 | | - public boolean canDeleteShopHere(@NotNull Player player, @NotNull Location location) { |
103 | | - Island island = SkyBlock.getInstance().getIslandManager().getIslandAtLocation(location); |
104 | | - if (island == null) return whitelist; |
105 | | - return island.getRole(player).equals(IslandRole.Member) || island.getRole(player).equals(IslandRole.Owner) |
106 | | - || island.getRole(player).equals(IslandRole.Operator); |
107 | | - } |
108 | | - |
109 | | - /** |
110 | | - * Loading logic |
111 | | - * Execute Stage defined by IntegrationStage |
112 | | - */ |
113 | | - @Override |
114 | | - public void load() { |
115 | | - |
116 | | - } |
117 | | - |
118 | | - /** |
119 | | - * Unloding logic |
120 | | - * Will execute when Quickshop unloading |
121 | | - */ |
122 | | - @Override |
123 | | - public void unload() { |
124 | | - |
125 | | - } |
126 | | - |
127 | | - @Override |
128 | | - public ReloadResult reloadModule() throws Exception { |
129 | | - loadConfiguration(); |
130 | | - return ReloadResult.builder().status(ReloadStatus.SUCCESS).build(); |
131 | | - } |
132 | | -} |
| 1 | +///* |
| 2 | +// * This file is a part of project QuickShop, the name is FabledIntegration.java |
| 3 | +// * Copyright (C) PotatoCraft Studio and contributors |
| 4 | +// * |
| 5 | +// * This program is free software: you can redistribute it and/or modify it |
| 6 | +// * under the terms of the GNU General Public License as published by the |
| 7 | +// * Free Software Foundation, either version 3 of the License, or |
| 8 | +// * (at your option) any later version. |
| 9 | +// * |
| 10 | +// * This program is distributed in the hope that it will be useful, but WITHOUT |
| 11 | +// * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
| 12 | +// * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
| 13 | +// * for more details. |
| 14 | +// * |
| 15 | +// * You should have received a copy of the GNU General Public License |
| 16 | +// * along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 17 | +// * |
| 18 | +// */ |
| 19 | +// |
| 20 | +//package org.maxgamer.quickshop.integration.fabledskyblock; |
| 21 | +// |
| 22 | +//import com.songoda.skyblock.SkyBlock; |
| 23 | +//import com.songoda.skyblock.island.Island; |
| 24 | +//import com.songoda.skyblock.island.IslandRole; |
| 25 | +//import org.bukkit.Location; |
| 26 | +//import org.bukkit.entity.Player; |
| 27 | +//import org.jetbrains.annotations.NotNull; |
| 28 | +//import org.maxgamer.quickshop.QuickShop; |
| 29 | +//import org.maxgamer.quickshop.integration.IntegrateStage; |
| 30 | +//import org.maxgamer.quickshop.integration.IntegrationStage; |
| 31 | +//import org.maxgamer.quickshop.integration.QSIntegratedPlugin; |
| 32 | +//import org.maxgamer.quickshop.util.reload.ReloadResult; |
| 33 | +//import org.maxgamer.quickshop.util.reload.ReloadStatus; |
| 34 | +// |
| 35 | +//@IntegrationStage(loadStage = IntegrateStage.onEnableAfter) |
| 36 | +//public class FabledIntegration extends QSIntegratedPlugin { |
| 37 | +// |
| 38 | +// private boolean ignoreDisabledWorlds; |
| 39 | +// private boolean whitelist; |
| 40 | +// |
| 41 | +// public FabledIntegration(QuickShop plugin) { |
| 42 | +// super(plugin); |
| 43 | +// plugin.getReloadManager().register(this); |
| 44 | +// loadConfiguration(); |
| 45 | +// registerListener(); |
| 46 | +// } |
| 47 | +// |
| 48 | +// private void loadConfiguration() { |
| 49 | +// ignoreDisabledWorlds = plugin.getConfig().getBoolean("integration.fabledskyblock.ignore-disabled-worlds"); |
| 50 | +// whitelist = plugin.getConfig().getBoolean("integration.fabledskyblock.whitelist-mode"); |
| 51 | +// } |
| 52 | +// |
| 53 | +// /** |
| 54 | +// * Return the integrated plugin name. |
| 55 | +// * For example, Residence |
| 56 | +// * |
| 57 | +// * @return integrated plugin |
| 58 | +// */ |
| 59 | +// @Override |
| 60 | +// public @NotNull String getName() { |
| 61 | +// return "FabledSkyblock"; |
| 62 | +// } |
| 63 | +// |
| 64 | +// /** |
| 65 | +// * Check if a player can create shop here |
| 66 | +// * |
| 67 | +// * @param player the player want to create shop |
| 68 | +// * @param location shop location |
| 69 | +// * @return If you can create shop here |
| 70 | +// */ |
| 71 | +// @Override |
| 72 | +// public boolean canCreateShopHere(@NotNull Player player, @NotNull Location location) { |
| 73 | +// Island island = SkyBlock.getInstance().getIslandManager().getIslandAtLocation(location); |
| 74 | +// if (island == null) return whitelist; |
| 75 | +// return island.getRole(player).equals(IslandRole.Member) || island.getRole(player).equals(IslandRole.Owner) |
| 76 | +// || island.getRole(player).equals(IslandRole.Operator); |
| 77 | +// } |
| 78 | +// |
| 79 | +// /** |
| 80 | +// * Check if a player can trade with shop here |
| 81 | +// * |
| 82 | +// * @param player the player want to trade with shop |
| 83 | +// * @param location shop location |
| 84 | +// * @return If you can trade with shop here |
| 85 | +// */ |
| 86 | +// @Override |
| 87 | +// public boolean canTradeShopHere(@NotNull Player player, @NotNull Location location) { |
| 88 | +// if (SkyBlock.getInstance().getIslandManager().getIslandAtLocation(location) == null) { |
| 89 | +// return ignoreDisabledWorlds; |
| 90 | +// } |
| 91 | +// return true; |
| 92 | +// } |
| 93 | +// |
| 94 | +// /** |
| 95 | +// * Check if a player can delete a shop here |
| 96 | +// * |
| 97 | +// * @param player the player want to delete the shop |
| 98 | +// * @param location shop location |
| 99 | +// * @return If you can delete the shop here |
| 100 | +// */ |
| 101 | +// @Override |
| 102 | +// public boolean canDeleteShopHere(@NotNull Player player, @NotNull Location location) { |
| 103 | +// Island island = SkyBlock.getInstance().getIslandManager().getIslandAtLocation(location); |
| 104 | +// if (island == null) return whitelist; |
| 105 | +// return island.getRole(player).equals(IslandRole.Member) || island.getRole(player).equals(IslandRole.Owner) |
| 106 | +// || island.getRole(player).equals(IslandRole.Operator); |
| 107 | +// } |
| 108 | +// |
| 109 | +// /** |
| 110 | +// * Loading logic |
| 111 | +// * Execute Stage defined by IntegrationStage |
| 112 | +// */ |
| 113 | +// @Override |
| 114 | +// public void load() { |
| 115 | +// |
| 116 | +// } |
| 117 | +// |
| 118 | +// /** |
| 119 | +// * Unloding logic |
| 120 | +// * Will execute when Quickshop unloading |
| 121 | +// */ |
| 122 | +// @Override |
| 123 | +// public void unload() { |
| 124 | +// |
| 125 | +// } |
| 126 | +// |
| 127 | +// @Override |
| 128 | +// public ReloadResult reloadModule() throws Exception { |
| 129 | +// loadConfiguration(); |
| 130 | +// return ReloadResult.builder().status(ReloadStatus.SUCCESS).build(); |
| 131 | +// } |
| 132 | +//} |
0 commit comments