mirror of
https://github.com/songoda/EpicFurnaces.git
synced 2024-11-27 20:35:24 +01:00
Merge branch 'development'
This commit is contained in:
commit
5f0dd80a73
2
pom.xml
2
pom.xml
@ -2,7 +2,7 @@
|
||||
<groupId>com.songoda</groupId>
|
||||
<artifactId>EpicFurnaces</artifactId>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<version>4.7</version>
|
||||
<version>4.7.1</version>
|
||||
<build>
|
||||
<defaultGoal>clean install</defaultGoal>
|
||||
<finalName>EpicFurnaces-${project.version}</finalName>
|
||||
|
@ -268,8 +268,8 @@ public class Furnace {
|
||||
return accessList.add(uuid);
|
||||
}
|
||||
|
||||
public boolean removeFromAccessList(String string) {
|
||||
return accessList.remove(string);
|
||||
public boolean removeFromAccessList(UUID uuid) {
|
||||
return accessList.remove(uuid);
|
||||
}
|
||||
|
||||
public boolean isOnAccessList(OfflinePlayer player) {
|
||||
|
@ -136,8 +136,6 @@ public class GUIOverview extends CustomizableGui {
|
||||
plugin.getLocale().getMessage("interface.furnace.remotefurnace").getMessage(),
|
||||
getFurnaceRemoteLore(furnace)),
|
||||
ClickType.LEFT, (event) -> {
|
||||
|
||||
player.sendMessage(furnace.getNickname() == null ? "Enter a nickname" : furnace.getNickname());
|
||||
ChatPrompt.showPrompt(plugin, event.player, plugin.getLocale().getMessage("event.remote.enter").getMessage(),
|
||||
promptEvent -> {
|
||||
for (Furnace other : plugin.getFurnaceManager().getFurnaces().values()) {
|
||||
@ -154,14 +152,10 @@ public class GUIOverview extends CustomizableGui {
|
||||
plugin.getDataManager().updateFurnace(furnace);
|
||||
furnace.setNickname(promptEvent.getMessage());
|
||||
plugin.getLocale().getMessage("event.remote.nicknamesuccess").sendPrefixedMessage(player);
|
||||
}).setOnClose(this::constructGUI);
|
||||
}).setOnClose(() -> guiManager.showGUI(player, new GUIOverview(plugin, furnace, player)));
|
||||
|
||||
}).setAction(4, ClickType.RIGHT, (event) -> {
|
||||
if (!furnace.isOnAccessList(player)) {
|
||||
furnace.addToAccessList(player);
|
||||
plugin.getDataManager().createAccessPlayer(furnace, player.getUniqueId());
|
||||
}
|
||||
constructGUI();
|
||||
guiManager.showGUI(player, new GUIRemoteAccess(plugin, furnace, player));
|
||||
});
|
||||
}
|
||||
|
||||
|
116
src/main/java/com/songoda/epicfurnaces/gui/GUIRemoteAccess.java
Normal file
116
src/main/java/com/songoda/epicfurnaces/gui/GUIRemoteAccess.java
Normal file
@ -0,0 +1,116 @@
|
||||
package com.songoda.epicfurnaces.gui;
|
||||
|
||||
import com.songoda.core.compatibility.CompatibleMaterial;
|
||||
import com.songoda.core.compatibility.ServerVersion;
|
||||
import com.songoda.core.gui.CustomizableGui;
|
||||
import com.songoda.core.gui.GuiUtils;
|
||||
import com.songoda.core.input.ChatPrompt;
|
||||
import com.songoda.core.utils.TextUtils;
|
||||
import com.songoda.epicfurnaces.EpicFurnaces;
|
||||
import com.songoda.epicfurnaces.furnace.Furnace;
|
||||
import com.songoda.epicfurnaces.settings.Settings;
|
||||
import com.songoda.epicfurnaces.utils.Methods;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.OfflinePlayer;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.inventory.meta.SkullMeta;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
public class GUIRemoteAccess extends CustomizableGui {
|
||||
|
||||
private final EpicFurnaces plugin;
|
||||
private final Furnace furnace;
|
||||
private final Player player;
|
||||
|
||||
public GUIRemoteAccess(EpicFurnaces plugin, Furnace furnace, Player player) {
|
||||
super(plugin, "remoteAccess");
|
||||
this.plugin = plugin;
|
||||
this.furnace = furnace;
|
||||
this.player = player;
|
||||
|
||||
setRows(6);
|
||||
setTitle(Methods.formatName(furnace.getLevel().getLevel()));
|
||||
showPage();
|
||||
}
|
||||
|
||||
private void showPage() {
|
||||
reset();
|
||||
|
||||
ItemStack glass2 = GuiUtils.getBorderItem(Settings.GLASS_TYPE_2.getMaterial(CompatibleMaterial.BLUE_STAINED_GLASS_PANE));
|
||||
ItemStack glass3 = GuiUtils.getBorderItem(Settings.GLASS_TYPE_3.getMaterial(CompatibleMaterial.LIGHT_BLUE_STAINED_GLASS_PANE));
|
||||
|
||||
// edges will be type 3
|
||||
mirrorFill("mirrorfill_1", 0, 2, true, true, glass3);
|
||||
mirrorFill("mirrorfill_2", 1, 1, true, true, glass3);
|
||||
|
||||
// decorate corners with type 2
|
||||
mirrorFill("mirrorfill_3", 0, 0, true, true, glass2);
|
||||
mirrorFill("mirrorfill_4", 1, 0, true, true, glass2);
|
||||
mirrorFill("mirrorfill_5", 0, 1, true, true, glass2);
|
||||
|
||||
pages = (int) Math.max(1, Math.ceil(furnace.getAccessList().size() / ((double) 28)));
|
||||
|
||||
setNextPage(5, 7, GuiUtils.createButtonItem(CompatibleMaterial.ARROW, plugin.getLocale().getMessage("general.nametag.next").getMessage()));
|
||||
setPrevPage(5, 1, GuiUtils.createButtonItem(CompatibleMaterial.ARROW, plugin.getLocale().getMessage("general.nametag.back").getMessage()));
|
||||
setOnPage((event) -> showPage());
|
||||
|
||||
setButton("exit", 8, GuiUtils.createButtonItem(CompatibleMaterial.OAK_DOOR,
|
||||
plugin.getLocale().getMessage("general.nametag.exit").getMessage()), (event) -> player.closeInventory());
|
||||
|
||||
setButton("addplayer", 4, GuiUtils.createButtonItem(CompatibleMaterial.EMERALD,
|
||||
plugin.getLocale().getMessage("interface.remoteaccess.addplayertitle").getMessage()), (event) -> {
|
||||
plugin.getLocale().getMessage("event.remote.enterplayer").sendPrefixedMessage(player);
|
||||
ChatPrompt.showPrompt(plugin, player, chat -> {
|
||||
Player toAdd = Bukkit.getPlayer(chat.getMessage());
|
||||
if (toAdd == null) {
|
||||
plugin.getLocale().getMessage("event.remote.invalidplayer").sendPrefixedMessage(player);
|
||||
return;
|
||||
}
|
||||
|
||||
if (furnace.getAccessList().contains(toAdd.getUniqueId())) {
|
||||
plugin.getLocale().getMessage("event.remote.playeralreadyadded").sendPrefixedMessage(player);
|
||||
return;
|
||||
}
|
||||
|
||||
furnace.addToAccessList(toAdd);
|
||||
plugin.getDataManager().createAccessPlayer(furnace, toAdd.getUniqueId());
|
||||
plugin.getLocale().getMessage("event.remote.playeradded").sendPrefixedMessage(player);
|
||||
}).setOnClose(() -> guiManager.showGUI(player, new GUIRemoteAccess(plugin, furnace, player)));
|
||||
});
|
||||
|
||||
List<UUID> entries = furnace.getAccessList().stream().skip((page - 1) * 28).limit(28).collect(Collectors.toList());
|
||||
Bukkit.getScheduler().runTaskAsynchronously(plugin, () -> {
|
||||
int num = 11;
|
||||
for (UUID entry : entries) {
|
||||
if (num == 16 || num == 36)
|
||||
num = num + 2;
|
||||
OfflinePlayer offlinePlayer = Bukkit.getOfflinePlayer(entry);
|
||||
ItemStack itemStack = GuiUtils.createButtonItem(CompatibleMaterial.PLAYER_HEAD, TextUtils.formatText("&6" + offlinePlayer.getName()),
|
||||
plugin.getLocale().getMessage("interface.remoteaccess.playerinfo")
|
||||
.getMessage().split("\\|"));
|
||||
SkullMeta meta = (SkullMeta)itemStack.getItemMeta();
|
||||
|
||||
if (ServerVersion.isServerVersionAtLeast(ServerVersion.V1_13))
|
||||
meta.setOwningPlayer(offlinePlayer);
|
||||
else
|
||||
meta.setOwner(offlinePlayer.getName());
|
||||
|
||||
itemStack.setItemMeta(meta);
|
||||
|
||||
setButton(num, itemStack, event -> {
|
||||
furnace.removeFromAccessList(entry);
|
||||
plugin.getDataManager().deleteAccessPlayer(furnace, entry);
|
||||
guiManager.showGUI(player, new GUIRemoteAccess(plugin, furnace, player));
|
||||
});
|
||||
num++;
|
||||
}
|
||||
|
||||
update();
|
||||
});
|
||||
}
|
||||
}
|
@ -5,6 +5,7 @@ general:
|
||||
prefix: '&8[&6EpicFurnaces&8]'
|
||||
next: '&9Next'
|
||||
back: '&9Back'
|
||||
exit: '&cExit'
|
||||
nameformat: '&eLevel %level% &fFurnace'
|
||||
hologram:
|
||||
outoffuel: '&cNo Fuel'
|
||||
@ -39,12 +40,15 @@ interface:
|
||||
itemsneeded: '&7You need one of the following to level up:'
|
||||
neededitem: '&6%amount% %type%s'
|
||||
remotefurnace: '&5&lRemote Control'
|
||||
remotefurnacelore: '&7Left-Click to assign a nickname.|&7Right-Click to give yourself |&7remote access.|&7Current nickname is: &6%nickname%&7.'
|
||||
remotefurnacelore: '&7Left-Click to assign a nickname.|&7Right-Click to open the menu.|&7Current nickname is: &6%nickname%&7.'
|
||||
utilize: '|&7To utilize remote access|&7use the command:|&6/EF Remote %nickname%'
|
||||
remotelist: '&7Players with remote access:'
|
||||
alreadymaxed: '&7This furnace is already maxed out!'
|
||||
button:
|
||||
boostedstats: '&a&lCurrently boosted!|&7Reward multiplied by &6%amount%x&7.|&7Expires in &6%time%&7.'
|
||||
remoteaccess:
|
||||
addplayertitle: '&aAdd Player'
|
||||
playerinfo: '&7Click to remove this player.'
|
||||
|
||||
# Command Messages
|
||||
|
||||
@ -68,3 +72,7 @@ event:
|
||||
notloaded: '&cThat furnace isn''t in a loaded chunk...'
|
||||
nicknamesuccess: '&aNickname set successfully.'
|
||||
nicknameinuse: '&cThat nickname is already in use.'
|
||||
enterplayer: '&7Enter a player to add to this furnace.'
|
||||
playeralreadyadded: '&cThis player has already been added to this furnace.'
|
||||
playeradded: '&aPlayer successfully added!'
|
||||
invalidplayer: '&cInvalid player. Are they online?'
|
||||
|
Loading…
Reference in New Issue
Block a user