Initial commit.

This commit is contained in:
Trixkz 2024-09-19 21:44:23 -04:00
parent 359672f599
commit 4bac53f568
140 changed files with 864 additions and 42 deletions

3
.gitignore vendored Normal file
View File

@ -0,0 +1,3 @@
target
.gitignore
.idea

3
.idea/.gitignore vendored Normal file
View File

@ -0,0 +1,3 @@
# Default ignored files
/shelf/
/workspace.xml

13
.idea/compiler.xml Normal file
View File

@ -0,0 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="CompilerConfiguration">
<annotationProcessing>
<profile name="Maven default annotation processors profile" enabled="true">
<sourceOutputDir name="target/generated-sources/annotations" />
<sourceTestOutputDir name="target/generated-test-sources/test-annotations" />
<outputRelativeToContentRoot value="true" />
<module name="EventCore" />
</profile>
</annotationProcessing>
</component>
</project>

7
.idea/encodings.xml Normal file
View File

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="Encoding">
<file url="file://$PROJECT_DIR$/src/main/java" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/src/main/resources" charset="UTF-8" />
</component>
</project>

45
.idea/jarRepositories.xml Normal file
View File

@ -0,0 +1,45 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="RemoteRepositoriesConfiguration">
<remote-repository>
<option name="id" value="codemc-snapshots" />
<option name="name" value="codemc-snapshots" />
<option name="url" value="https://repo.codemc.io/repository/maven-snapshots/" />
</remote-repository>
<remote-repository>
<option name="id" value="central" />
<option name="name" value="Central Repository" />
<option name="url" value="https://repo.maven.apache.org/maven2" />
</remote-repository>
<remote-repository>
<option name="id" value="sonatype" />
<option name="name" value="sonatype" />
<option name="url" value="https://oss.sonatype.org/content/groups/public/" />
</remote-repository>
<remote-repository>
<option name="id" value="fawe-repo" />
<option name="name" value="fawe-repo" />
<option name="url" value="https://ci.athion.net/job/FastAsyncWorldEdit/ws/mvn/" />
</remote-repository>
<remote-repository>
<option name="id" value="central" />
<option name="name" value="Maven Central repository" />
<option name="url" value="https://repo1.maven.org/maven2" />
</remote-repository>
<remote-repository>
<option name="id" value="placeholderapi" />
<option name="name" value="placeholderapi" />
<option name="url" value="https://repo.extendedclip.com/content/repositories/placeholderapi/" />
</remote-repository>
<remote-repository>
<option name="id" value="jboss.community" />
<option name="name" value="JBoss Community repository" />
<option name="url" value="https://repository.jboss.org/nexus/content/repositories/public/" />
</remote-repository>
<remote-repository>
<option name="id" value="papermc" />
<option name="name" value="papermc" />
<option name="url" value="https://repo.papermc.io/repository/maven-public/" />
</remote-repository>
</component>
</project>

19
.idea/misc.xml Normal file
View File

@ -0,0 +1,19 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="EntryPointsManager">
<list size="1">
<item index="0" class="java.lang.String" itemvalue="org.bukkit.event.EventHandler" />
</list>
</component>
<component name="ExternalStorageConfigurationManager" enabled="true" />
<component name="MavenProjectsManager">
<option name="originalFiles">
<list>
<option value="$PROJECT_DIR$/pom.xml" />
</list>
</option>
</component>
<component name="ProjectRootManager" version="2" languageLevel="JDK_17" default="true" project-jdk-name="17" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/out" />
</component>
</project>

124
.idea/uiDesigner.xml Normal file
View File

@ -0,0 +1,124 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="Palette2">
<group name="Swing">
<item class="com.intellij.uiDesigner.HSpacer" tooltip-text="Horizontal Spacer" icon="/com/intellij/uiDesigner/icons/hspacer.png" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="1" hsize-policy="6" anchor="0" fill="1" />
</item>
<item class="com.intellij.uiDesigner.VSpacer" tooltip-text="Vertical Spacer" icon="/com/intellij/uiDesigner/icons/vspacer.png" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="6" hsize-policy="1" anchor="0" fill="2" />
</item>
<item class="javax.swing.JPanel" icon="/com/intellij/uiDesigner/icons/panel.png" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3" />
</item>
<item class="javax.swing.JScrollPane" icon="/com/intellij/uiDesigner/icons/scrollPane.png" removable="false" auto-create-binding="false" can-attach-label="true">
<default-constraints vsize-policy="7" hsize-policy="7" anchor="0" fill="3" />
</item>
<item class="javax.swing.JButton" icon="/com/intellij/uiDesigner/icons/button.png" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="3" anchor="0" fill="1" />
<initial-values>
<property name="text" value="Button" />
</initial-values>
</item>
<item class="javax.swing.JRadioButton" icon="/com/intellij/uiDesigner/icons/radioButton.png" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="3" anchor="8" fill="0" />
<initial-values>
<property name="text" value="RadioButton" />
</initial-values>
</item>
<item class="javax.swing.JCheckBox" icon="/com/intellij/uiDesigner/icons/checkBox.png" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="3" anchor="8" fill="0" />
<initial-values>
<property name="text" value="CheckBox" />
</initial-values>
</item>
<item class="javax.swing.JLabel" icon="/com/intellij/uiDesigner/icons/label.png" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="0" anchor="8" fill="0" />
<initial-values>
<property name="text" value="Label" />
</initial-values>
</item>
<item class="javax.swing.JTextField" icon="/com/intellij/uiDesigner/icons/textField.png" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
<preferred-size width="150" height="-1" />
</default-constraints>
</item>
<item class="javax.swing.JPasswordField" icon="/com/intellij/uiDesigner/icons/passwordField.png" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
<preferred-size width="150" height="-1" />
</default-constraints>
</item>
<item class="javax.swing.JFormattedTextField" icon="/com/intellij/uiDesigner/icons/formattedTextField.png" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
<preferred-size width="150" height="-1" />
</default-constraints>
</item>
<item class="javax.swing.JTextArea" icon="/com/intellij/uiDesigner/icons/textArea.png" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
<preferred-size width="150" height="50" />
</default-constraints>
</item>
<item class="javax.swing.JTextPane" icon="/com/intellij/uiDesigner/icons/textPane.png" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
<preferred-size width="150" height="50" />
</default-constraints>
</item>
<item class="javax.swing.JEditorPane" icon="/com/intellij/uiDesigner/icons/editorPane.png" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
<preferred-size width="150" height="50" />
</default-constraints>
</item>
<item class="javax.swing.JComboBox" icon="/com/intellij/uiDesigner/icons/comboBox.png" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="0" hsize-policy="2" anchor="8" fill="1" />
</item>
<item class="javax.swing.JTable" icon="/com/intellij/uiDesigner/icons/table.png" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
<preferred-size width="150" height="50" />
</default-constraints>
</item>
<item class="javax.swing.JList" icon="/com/intellij/uiDesigner/icons/list.png" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="6" hsize-policy="2" anchor="0" fill="3">
<preferred-size width="150" height="50" />
</default-constraints>
</item>
<item class="javax.swing.JTree" icon="/com/intellij/uiDesigner/icons/tree.png" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
<preferred-size width="150" height="50" />
</default-constraints>
</item>
<item class="javax.swing.JTabbedPane" icon="/com/intellij/uiDesigner/icons/tabbedPane.png" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3">
<preferred-size width="200" height="200" />
</default-constraints>
</item>
<item class="javax.swing.JSplitPane" icon="/com/intellij/uiDesigner/icons/splitPane.png" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3">
<preferred-size width="200" height="200" />
</default-constraints>
</item>
<item class="javax.swing.JSpinner" icon="/com/intellij/uiDesigner/icons/spinner.png" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1" />
</item>
<item class="javax.swing.JSlider" icon="/com/intellij/uiDesigner/icons/slider.png" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1" />
</item>
<item class="javax.swing.JSeparator" icon="/com/intellij/uiDesigner/icons/separator.png" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3" />
</item>
<item class="javax.swing.JProgressBar" icon="/com/intellij/uiDesigner/icons/progressbar.png" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="6" anchor="0" fill="1" />
</item>
<item class="javax.swing.JToolBar" icon="/com/intellij/uiDesigner/icons/toolbar.png" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="6" anchor="0" fill="1">
<preferred-size width="-1" height="20" />
</default-constraints>
</item>
<item class="javax.swing.JToolBar$Separator" icon="/com/intellij/uiDesigner/icons/toolbarSeparator.png" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="0" anchor="0" fill="1" />
</item>
<item class="javax.swing.JScrollBar" icon="/com/intellij/uiDesigner/icons/scrollbar.png" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="6" hsize-policy="0" anchor="0" fill="2" />
</item>
</group>
</component>
</project>

6
.idea/vcs.xml Normal file
View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="$PROJECT_DIR$" vcs="Git" />
</component>
</project>

13
EventCore.iml Normal file
View File

@ -0,0 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?>
<module version="4">
<component name="FacetManager">
<facet type="minecraft" name="Minecraft">
<configuration>
<autoDetectTypes>
<platformType>PAPER</platformType>
<platformType>ADVENTURE</platformType>
</autoDetectTypes>
</configuration>
</facet>
</component>
</module>

View File

@ -109,5 +109,10 @@
<version>2.10.9</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>net.wesjd</groupId>
<artifactId>anvilgui</artifactId>
<version>1.5.3-SNAPSHOT</version>
</dependency>
</dependencies>
</project>

View File

@ -6,7 +6,6 @@ import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.RequiredArgsConstructor;
import lombok.Setter;
import java.util.List;
@Getter
@ -18,7 +17,7 @@ public class Event {
// General Information
private String name;
private CustomLocation spawnPoint;
private String duration;
private int duration;
// Teams Information
private List<Team> teams;

View File

@ -37,25 +37,31 @@ public class EventManager {
ConfigurationSection configurationSection = this.config.getConfigurationSection("EVENT.TEAMS");
if (configurationSection != null) {
configurationSection.getKeys(false).forEach((name) -> {
configurationSection.getKeys(false).forEach((index) -> {
String name = "";
UUID leader = null;
List<UUID> allPlayers = new ArrayList<UUID>();
List<UUID> playingPlayers = new ArrayList<UUID>();
if (configurationSection.getString(name + ".LEADER") != null) {
leader = UUID.fromString(configurationSection.getString(name + ".LEADER"));
if (configurationSection.getString(index + ".NAME") != null) {
name = configurationSection.getString(index + ".LEADER");
}
for (String allPlayerUUID : configurationSection.getStringList(name + ".ALL-PLAYERS")) {
if (configurationSection.getString(index + ".LEADER") != null) {
leader = UUID.fromString(configurationSection.getString(index + ".LEADER"));
}
for (String allPlayerUUID : configurationSection.getStringList(index + ".ALL-PLAYERS")) {
allPlayers.add(UUID.fromString(allPlayerUUID));
}
for (String playingPlayerUUID : configurationSection.getStringList(name + ".PLAYING-PLAYERS")) {
for (String playingPlayerUUID : configurationSection.getStringList(index + ".PLAYING-PLAYERS")) {
playingPlayers.add(UUID.fromString(playingPlayerUUID));
}
teams.add(new Team(leader, allPlayers, playingPlayers));
teams.add(new Team(name, leader, allPlayers, playingPlayers));
});
}
}
@ -68,7 +74,7 @@ public class EventManager {
this.event = new Event(
this.config.getString("EVENT.NAME"),
CustomLocation.stringToLocation(this.config.getString("EVENT.SPAWN-POINT")),
this.config.getString("EVENT.DURATION"),
this.config.getInt("EVENT.DURATION"),
teams,
this.config.getInt("EVENT.AMOUNT-OF-TEAMS"),
this.config.getInt("EVENT.AMOUNT-PER-TEAM"),
@ -87,7 +93,7 @@ public class EventManager {
this.event = new Event(
"Event",
this.main.getSpawnManager().getSpawnLocation(),
"10m",
600,
new ArrayList<Team>(),
2,
10,
@ -122,6 +128,7 @@ public class EventManager {
playingPlayers.add(playingPlayerUUID.toString());
}
this.config.set("EVENT.TEAMS." + index + ".NAME", team.getName());
this.config.set("EVENT.TEAMS." + index + ".LEADER", team.getLeader().toString());
this.config.set("EVENT.TEAMS." + index + ".ALL-PLAYERS", allPlayers);
this.config.set("EVENT.TEAMS." + index + ".PLAYING-PLAYERS", playingPlayers);

View File

@ -16,17 +16,20 @@ public class Team {
private EventCore main = EventCore.getInstance();
private String name;
private List<UUID> allPlayers;
private List<UUID> playingPlayers = new ArrayList<>();
private UUID leader;
public Team(UUID leader, List<UUID> allPlayers) {
public Team(String name, UUID leader, List<UUID> allPlayers) {
this.name = name;
this.leader = leader;
this.allPlayers = allPlayers;
this.playingPlayers.addAll(allPlayers);
}
public Team(UUID leader, List<UUID> allPlayers, List<UUID> playingPlayers) {
public Team(String name, UUID leader, List<UUID> allPlayers, List<UUID> playingPlayers) {
this.name = name;
this.leader = leader;
this.allPlayers = allPlayers;
this.playingPlayers = playingPlayers;

View File

@ -4,7 +4,6 @@ import com.loganmagnan.eventcore.EventCore;
import lombok.Getter;
import lombok.Setter;
import org.bukkit.entity.Player;
import org.bukkit.scheduler.BukkitRunnable;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;

View File

@ -38,6 +38,10 @@ public class ChatManageMenu extends Menu {
public void handleMenu(InventoryClickEvent event) {
Player player = (Player) event.getWhoClicked();
if (event.getCurrentItem() == null) {
return;
}
if (event.getView().getTitle().equalsIgnoreCase(ColorUtils.getMessageType("&b&lChat Management"))) {
switch (event.getCurrentItem().getType()) {
case DIAMOND_SWORD:
@ -45,16 +49,24 @@ public class ChatManageMenu extends Menu {
break;
case SOUL_SAND:
if (event.getClick().isShiftClick()) {
this.main.getChatManager().slowChat(player, this.delayAmount);
} else if (event.getClick().isLeftClick()) {
this.delayAmount++;
} else if (event.getClick().isRightClick()) {
if (this.delayAmount <= 0) {
return;
}
switch (event.getClick()) {
case LEFT:
this.delayAmount++;
this.delayAmount--;
break;
case RIGHT:
if (this.delayAmount <= 0) {
return;
}
this.delayAmount--;
break;
case SHIFT_LEFT:
case SHIFT_RIGHT:
this.main.getChatManager().slowChat(player, this.delayAmount);
break;
}
break;

View File

@ -1,18 +1,18 @@
package com.loganmagnan.eventcore.menusystem.menus;
import com.loganmagnan.eventcore.EventCore;
import com.loganmagnan.eventcore.managers.event.teams.Team;
import com.loganmagnan.eventcore.menusystem.ItemStackButton;
import com.loganmagnan.eventcore.menusystem.Menu;
import com.loganmagnan.eventcore.menusystem.PlayerMenuUtil;
import com.loganmagnan.eventcore.utils.ColorUtils;
import com.loganmagnan.eventcore.utils.CustomLocation;
import com.loganmagnan.eventcore.utils.TimeUtils;
import com.loganmagnan.eventcore.utils.Utils;
import net.wesjd.anvilgui.AnvilGUI;
import org.bukkit.Material;
import org.bukkit.entity.Player;
import org.bukkit.event.inventory.InventoryClickEvent;
import org.bukkit.inventory.ItemStack;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
@ -21,6 +21,8 @@ public class EventManageMenu extends Menu {
private EventCore main = EventCore.getInstance();
// To Do: Fix The Anvil Menu
public EventManageMenu(PlayerMenuUtil playerMenuUtil) {
super(playerMenuUtil);
}
@ -39,9 +41,141 @@ public class EventManageMenu extends Menu {
public void handleMenu(InventoryClickEvent event) {
Player player = (Player) event.getWhoClicked();
if (event.getCurrentItem() == null) {
return;
}
if (event.getView().getTitle().equalsIgnoreCase(ColorUtils.getMessageType("&b&lEvent Management"))) {
switch (event.getCurrentItem().getType()) {
case NAME_TAG:
new AnvilGUI.Builder().onComplete((anvilGUIPlayer, string) -> {
this.main.getEventManager().getEvent().setName(string);
return AnvilGUI.Response.close();
}).onClose(anvilGUIPlayer -> {
}).title(ColorUtils.getMessageType("&b&lEvent Management")).text(ColorUtils.getMessageType("Enter it here")).plugin(this.main).open(player);
break;
case COMPASS:
switch (event.getClick()) {
case LEFT:
player.teleport(this.main.getEventManager().getEvent().getSpawnPoint().toBukkitLocation());
break;
case RIGHT:
this.main.getEventManager().getEvent().setSpawnPoint(CustomLocation.fromBukkitLocation(player.getLocation()));
break;
}
break;
case CLOCK:
new AnvilGUI.Builder().onComplete((anvilGUIPlayer, string) -> {
if (!Utils.isNumeric(string)) {
new EventManageMenu(this.playerMenuUtil).open(player);
return AnvilGUI.Response.close();
}
int duration = Integer.parseInt(string);
this.main.getEventManager().getEvent().setDuration(duration);
return AnvilGUI.Response.close();
}).onClose(anvilGUIPlayer -> {
}).title(ColorUtils.getMessageType("&b&lEvent Management")).text(ColorUtils.getMessageType("Enter it here")).plugin(this.main).open(player);
break;
case BOOK:
new AnvilGUI.Builder().onComplete((anvilGUIPlayer, string) -> {
if (!Utils.isNumeric(string)) {
new EventManageMenu(this.playerMenuUtil).open(player);
return AnvilGUI.Response.close();
}
int amountOfTeams = Integer.parseInt(string);
this.main.getEventManager().getEvent().setAmountOfTeams(amountOfTeams);
return AnvilGUI.Response.close();
}).onClose(anvilGUIPlayer -> {
}).title(ColorUtils.getMessageType("&b&lEvent Management")).text(ColorUtils.getMessageType("Enter it here")).plugin(this.main).open(player);
break;
case PAPER:
new AnvilGUI.Builder().onComplete((anvilGUIPlayer, string) -> {
if (!Utils.isNumeric(string)) {
new EventManageMenu(this.playerMenuUtil).open(player);
return AnvilGUI.Response.close();
}
int amountPerTeam = Integer.parseInt(string);
this.main.getEventManager().getEvent().setAmountPerTeam(amountPerTeam);
return AnvilGUI.Response.close();
}).onClose(anvilGUIPlayer -> {
}).title(ColorUtils.getMessageType("&b&lEvent Management")).text(ColorUtils.getMessageType("Enter it here")).plugin(this.main).open(player);
break;
case ENDER_EYE:
switch (event.getClick()) {
case LEFT:
if (this.main.getEventManager().getEvent().getAmountOfTeams() == this.main.getEventManager().getEvent().getTeamSpawnPoints().size()) {
return;
}
this.main.getEventManager().getEvent().getTeamSpawnPoints().add(CustomLocation.fromBukkitLocation(player.getLocation()));
break;
case RIGHT:
new TeamSpawnPointsMenu(this.playerMenuUtil).open(player);
return;
}
break;
case PAINTING:
this.main.getEventManager().getEvent().setScoreboardEnabled(!this.main.getEventManager().getEvent().isScoreboardEnabled());
break;
case ANVIL:
this.main.getEventManager().getEvent().setTimerEnabled(!this.main.getEventManager().getEvent().isTimerEnabled());
break;
case DIAMOND:
switch (event.getClick()) {
case LEFT:
this.main.getEventManager().getEvent().setEventsEnabled(!this.main.getEventManager().getEvent().isEventsEnabled());
break;
case RIGHT:
// To Do: Setup Events Menu
return;
}
break;
case LIME_WOOL:
// To Do: Event Start System
break;
case RED_WOOL:
// To Do: Event Stop System
break;
case NETHER_STAR:
// To Do: Setup Started Mode
// * Show Duration
// * Show Each Team's Information
break;
}
new EventManageMenu(this.playerMenuUtil).open(player);
@ -68,10 +202,11 @@ public class EventManageMenu extends Menu {
}
teamSpawnPointsLore.add("");
teamSpawnPointsLore.add("&bClick to change");
teamSpawnPointsLore.add("&fLeft Click: &3Add");
teamSpawnPointsLore.add("&fRight Click: &3Change");
ItemStackButton nameItemStackButton = new ItemStackButton(
ColorUtils.getMessageType(this.main.getEventManager().getEvent().isStarted() ? "&c&lAccess Denied" : "&b&lName"),
ColorUtils.getMessageType(this.main.getEventManager().getEvent().isStarted() ? "&c&lNo Permission" : "&b&lName"),
ColorUtils.getMessageType(this.main.getEventManager().getEvent().isStarted() ? new ArrayList<String>() :
Arrays.asList(
"&7» &3" + this.main.getEventManager().getEvent().getName(),
@ -85,7 +220,7 @@ public class EventManageMenu extends Menu {
);
ItemStackButton spawnPointItemStackButton = new ItemStackButton(
ColorUtils.getMessageType(this.main.getEventManager().getEvent().isStarted() ? "&c&lAccess Denied" : "&b&lSpawn Point"),
ColorUtils.getMessageType(this.main.getEventManager().getEvent().isStarted() ? "&c&lNo Permission" : "&b&lSpawn Point"),
ColorUtils.getMessageType(this.main.getEventManager().getEvent().isStarted() ? new ArrayList<String>() :
Arrays.asList(
"&7» &3" + Math.floor(this.main.getEventManager().getEvent().getSpawnPoint().toBukkitLocation().getX()) + "&7, &3" + Math.floor(this.main.getEventManager().getEvent().getSpawnPoint().toBukkitLocation().getY()) + "&7, &3" + Math.floor(this.main.getEventManager().getEvent().getSpawnPoint().toBukkitLocation().getZ()) + " &7(&f" + this.main.getEventManager().getEvent().getSpawnPoint().toBukkitLocation().getWorld().getName() + "&7)",
@ -100,10 +235,10 @@ public class EventManageMenu extends Menu {
);
ItemStackButton durationItemStackButton = new ItemStackButton(
ColorUtils.getMessageType(this.main.getEventManager().getEvent().isStarted() ? "&c&lAccess Denied" : "&b&lDuration"),
ColorUtils.getMessageType(this.main.getEventManager().getEvent().isStarted() ? "&c&lNo Permission" : "&b&lDuration"),
ColorUtils.getMessageType(this.main.getEventManager().getEvent().isStarted() ? new ArrayList<String>() :
Arrays.asList(
"&7» &3" + Utils.makeTimeReadable(Utils.parseTime(this.main.getEventManager().getEvent().getDuration())),
"&7» &3" + TimeUtils.formatIntoMMSS(this.main.getEventManager().getEvent().getDuration()),
"",
"&bClick to change"
)
@ -114,7 +249,7 @@ public class EventManageMenu extends Menu {
);
ItemStackButton amountOfTeamsItemStackButton = new ItemStackButton(
ColorUtils.getMessageType(this.main.getEventManager().getEvent().isStarted() ? "&c&lAccess Denied" : "&b&lAmount of Teams"),
ColorUtils.getMessageType(this.main.getEventManager().getEvent().isStarted() ? "&c&lNo Permission" : "&b&lAmount of Teams"),
ColorUtils.getMessageType(this.main.getEventManager().getEvent().isStarted() ? new ArrayList<String>() :
Arrays.asList(
"&7» &3" + this.main.getEventManager().getEvent().getAmountOfTeams(),
@ -128,7 +263,7 @@ public class EventManageMenu extends Menu {
);
ItemStackButton amountPerTeamItemStackButton = new ItemStackButton(
ColorUtils.getMessageType(this.main.getEventManager().getEvent().isStarted() ? "&c&lAccess Denied" : "&b&lAmount Per Team"),
ColorUtils.getMessageType(this.main.getEventManager().getEvent().isStarted() ? "&c&lNo Permission" : "&b&lAmount Per Team"),
ColorUtils.getMessageType(this.main.getEventManager().getEvent().isStarted() ? new ArrayList<String>() :
Arrays.asList(
"&7» &3" + this.main.getEventManager().getEvent().getAmountPerTeam(),
@ -142,7 +277,7 @@ public class EventManageMenu extends Menu {
);
ItemStackButton teamSpawnPointsItemStackButton = new ItemStackButton(
ColorUtils.getMessageType(this.main.getEventManager().getEvent().isStarted() ? "&c&lAccess Denied" : "&b&lTeam Spawn Points"),
ColorUtils.getMessageType(this.main.getEventManager().getEvent().isStarted() ? "&c&lNo Permission" : "&b&lTeam Spawn Points"),
ColorUtils.getMessageType(this.main.getEventManager().getEvent().isStarted() ? new ArrayList<String>() :
teamSpawnPointsLore
),
@ -152,7 +287,7 @@ public class EventManageMenu extends Menu {
);
ItemStackButton scoreboardEnabledItemStackButton = new ItemStackButton(
ColorUtils.getMessageType(this.main.getEventManager().getEvent().isStarted() ? "&c&lAccess Denied" : "&b&lScoreboard Enabled"),
ColorUtils.getMessageType(this.main.getEventManager().getEvent().isStarted() ? "&c&lNo Permission" : "&b&lScoreboard Enabled"),
ColorUtils.getMessageType(this.main.getEventManager().getEvent().isStarted() ? new ArrayList<String>() :
Arrays.asList(
"&7» " + (this.main.getEventManager().getEvent().isScoreboardEnabled() ? "&aYes" : "&cNo"),
@ -166,7 +301,7 @@ public class EventManageMenu extends Menu {
);
ItemStackButton timerEnabledItemStackButton = new ItemStackButton(
ColorUtils.getMessageType(this.main.getEventManager().getEvent().isStarted() ? "&c&lAccess Denied" : "&b&lTimer Enabled"),
ColorUtils.getMessageType(this.main.getEventManager().getEvent().isStarted() ? "&c&lNo Permission" : "&b&lTimer Enabled"),
ColorUtils.getMessageType(this.main.getEventManager().getEvent().isStarted() ? new ArrayList<String>() :
Arrays.asList(
"&7» " + (this.main.getEventManager().getEvent().isTimerEnabled() ? "&aYes" : "&cNo"),
@ -180,7 +315,7 @@ public class EventManageMenu extends Menu {
);
ItemStackButton eventsEnabledItemStackButton = new ItemStackButton(
ColorUtils.getMessageType(this.main.getEventManager().getEvent().isStarted() ? "&c&lAccess Denied" : "&b&lEvents Enabled"),
ColorUtils.getMessageType(this.main.getEventManager().getEvent().isStarted() ? "&c&lNo Permission" : "&b&lEvents Enabled"),
ColorUtils.getMessageType(this.main.getEventManager().getEvent().isStarted() ? new ArrayList<String>() :
Arrays.asList(
"&7» " + (this.main.getEventManager().getEvent().isEventsEnabled() ? "&aYes" : "&cNo"),
@ -199,7 +334,7 @@ public class EventManageMenu extends Menu {
);
ItemStackButton startItemStackButton = new ItemStackButton(
ColorUtils.getMessageType(this.main.getEventManager().getEvent().isStarted() ? "&c&lAccess Denied" : "&b&lStart"),
ColorUtils.getMessageType(this.main.getEventManager().getEvent().isStarted() ? "&c&lNo Permission" : "&b&lStart"),
ColorUtils.getMessageType(this.main.getEventManager().getEvent().isStarted() ? new ArrayList<String>() :
Arrays.asList(
"&bClick to start"
@ -211,7 +346,7 @@ public class EventManageMenu extends Menu {
);
ItemStackButton stopItemStackButton = new ItemStackButton(
ColorUtils.getMessageType(this.main.getEventManager().getEvent().isStarted() ? "&b&lStop" : "&c&lAccess Denied"),
ColorUtils.getMessageType(this.main.getEventManager().getEvent().isStarted() ? "&b&lStop" : "&c&lNo Permission"),
ColorUtils.getMessageType(this.main.getEventManager().getEvent().isStarted() ?
Arrays.asList(
"&bClick to stop"
@ -226,7 +361,9 @@ public class EventManageMenu extends Menu {
ColorUtils.getMessageType("&b&lStarted"),
ColorUtils.getMessageType(
Arrays.asList(
"&7» " + (this.main.getEventManager().getEvent().isStarted() ? "&aYes" : "&cNo")
"&7» " + (this.main.getEventManager().getEvent().isStarted() ? "&aYes" : "&cNo"),
"",
"&bClick for more information"
)
),
Material.NETHER_STAR,

View File

@ -32,7 +32,7 @@ public class StaffOnlineMenu extends PaginatedMenu {
@Override
public String getMenuName() {
return ColorUtils.getMessageType("&bStaff Online");
return ColorUtils.getMessageType("&b&lStaff Online");
}
@Override
@ -44,7 +44,11 @@ public class StaffOnlineMenu extends PaginatedMenu {
public void handleMenu(InventoryClickEvent event) {
Player player = (Player) event.getWhoClicked();
if (event.getView().getTitle().equalsIgnoreCase(ColorUtils.getMessageType("&bStaff Online"))) {
if (event.getCurrentItem() == null) {
return;
}
if (event.getView().getTitle().equalsIgnoreCase(ColorUtils.getMessageType("&b&lStaff Online"))) {
ItemStack itemStack = event.getCurrentItem();
switch (ChatColor.stripColor(event.getCurrentItem().getItemMeta().getDisplayName())) {
@ -72,8 +76,6 @@ public class StaffOnlineMenu extends PaginatedMenu {
break;
}
String targetName = event.getCurrentItem().getItemMeta().getDisplayName();
Player target = this.main.getServer().getPlayer(ChatColor.stripColor(event.getCurrentItem().getItemMeta().getDisplayName()));
if (target == null) {

View File

@ -0,0 +1,141 @@
package com.loganmagnan.eventcore.menusystem.menus;
import com.loganmagnan.eventcore.EventCore;
import com.loganmagnan.eventcore.menusystem.ItemStackButton;
import com.loganmagnan.eventcore.menusystem.PaginatedMenu;
import com.loganmagnan.eventcore.menusystem.PlayerMenuUtil;
import com.loganmagnan.eventcore.utils.ColorUtils;
import com.loganmagnan.eventcore.utils.CustomLocation;
import com.loganmagnan.eventcore.utils.PlayerHeadUtils;
import org.bukkit.ChatColor;
import org.bukkit.Material;
import org.bukkit.entity.Player;
import org.bukkit.event.inventory.InventoryClickEvent;
import org.bukkit.inventory.ItemStack;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
public class TeamSpawnPointsMenu extends PaginatedMenu {
private EventCore main = EventCore.getInstance();
public TeamSpawnPointsMenu(PlayerMenuUtil playerMenuUtil) {
super(playerMenuUtil);
}
@Override
public String getMenuName() {
return ColorUtils.getMessageType("&b&lTeam Spawn Points");
}
@Override
public int getSlots() {
return 27;
}
@Override
public void handleMenu(InventoryClickEvent event) {
Player player = (Player) event.getWhoClicked();
if (event.getCurrentItem() == null) {
return;
}
if (event.getView().getTitle().equalsIgnoreCase(ColorUtils.getMessageType("&b&lTeam Spawn Points"))) {
ItemStack itemStack = event.getCurrentItem();
switch (ChatColor.stripColor(event.getCurrentItem().getItemMeta().getDisplayName())) {
case "Previous Page":
if (this.page == 0) {
player.sendMessage(ColorUtils.getMessageType("&aYou're on the first page"));
} else {
this.page--;
this.open(player);
}
break;
case "Close":
player.closeInventory();
break;
case "Next Page":
if (!((this.index++) >= this.main.getEventManager().getEvent().getTeamSpawnPoints().size())) {
this.page++;
this.open(player);
} else {
player.sendMessage(ColorUtils.getMessageType("&aYou're on the last page"));
}
break;
}
CustomLocation teamSpawnPoint = this.main.getEventManager().getEvent().getTeamSpawnPoints().get(Integer.parseInt(ChatColor.stripColor(event.getCurrentItem().getItemMeta().getDisplayName()).substring(ChatColor.stripColor(event.getCurrentItem().getItemMeta().getDisplayName()).length() - 1, ChatColor.stripColor(event.getCurrentItem().getItemMeta().getDisplayName()).length())) - 1);
switch (event.getClick()) {
case LEFT:
this.main.getEventManager().getEvent().getTeamSpawnPoints().remove(teamSpawnPoint);
break;
case RIGHT:
this.main.getEventManager().getEvent().getTeamSpawnPoints().remove(teamSpawnPoint);
this.main.getEventManager().getEvent().getTeamSpawnPoints().add(Integer.parseInt(ChatColor.stripColor(event.getCurrentItem().getItemMeta().getDisplayName()).substring(ChatColor.stripColor(event.getCurrentItem().getItemMeta().getDisplayName()).length() - 1, ChatColor.stripColor(event.getCurrentItem().getItemMeta().getDisplayName()).length())) - 1, CustomLocation.fromBukkitLocation(player.getLocation()));
break;
}
new TeamSpawnPointsMenu(this.playerMenuUtil).open(player);
}
}
@Override
public void setMenuItems(Player player) {
this.addMenuBorder();
int number = 1;
if (this.main.getEventManager().getEvent().getTeamSpawnPoints().isEmpty()) {
return;
}
for (int i = 0; i < this.getMaxItemsPerPage(); i++) {
this.index = this.getMaxItemsPerPage() * this.page + i;
if (this.index >= this.main.getEventManager().getEvent().getTeamSpawnPoints().size()) {
break;
}
if (this.main.getEventManager().getEvent().getTeamSpawnPoints().get(this.index) == null) {
continue;
}
CustomLocation teamSpawnPoint = this.main.getEventManager().getEvent().getTeamSpawnPoints().get(this.index);
if (teamSpawnPoint == null) {
continue;
}
ItemStackButton teamSpawnPointItemStackButton = new ItemStackButton(
ColorUtils.getMessageType("&b&lTeam Spawn Point " + number),
ColorUtils.getMessageType(
Arrays.asList(
"&7» &3" + (Math.floor(teamSpawnPoint.toBukkitLocation().getX()) + "&7, &3" + Math.floor(teamSpawnPoint.toBukkitLocation().getY()) + "&7, &3" + Math.floor(teamSpawnPoint.toBukkitLocation().getZ()) + " &7(&f" + teamSpawnPoint.toBukkitLocation().getWorld().getName() + "&7)"),
"",
"&fLeft Click: &3Remove",
"&fRight Click: &3Change"
)
),
Material.ENDER_EYE,
0,
1
);
number++;
ItemStack teamSpawnPointItemStack = teamSpawnPointItemStackButton.makeItemStack();
this.inventory.addItem(teamSpawnPointItemStack);
}
}
}

Binary file not shown.

BIN
target/EventCore-1.0.jar Normal file

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Some files were not shown because too many files have changed in this diff Show More