Compare commits

..

No commits in common. "bad1a60e5acbbfe54df1636d34b7a96a4dfbe7a6" and "8ff335cff0474f984314ba9b13e780c314f504d7" have entirely different histories.

78 changed files with 217 additions and 349 deletions

9
.idea/ant.xml Normal file
View File

@ -0,0 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="AntConfiguration">
<buildFile url="file://$PROJECT_DIR$/ant_build_increment.xml">
<executeOn event="afterCompilation" target="end" />
<executeOn event="beforeCompilation" target="init" />
</buildFile>
</component>
</project>

View File

@ -1,16 +0,0 @@
<?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="UhcCore" />
</profile>
</annotationProcessing>
<bytecodeTargetLevel>
<module name="UhcCore" target="1.8" />
</bytecodeTargetLevel>
</component>
</project>

View File

@ -1,8 +1,6 @@
<?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" />
<file url="PROJECT" charset="UTF-8" />
</component>
</project>

View File

@ -1,25 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="RemoteRepositoriesConfiguration">
<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="spigot-repo" />
<option name="name" value="spigot-repo" />
<option name="url" value="https://hub.spigotmc.org/nexus/content/repositories/snapshots/" />
</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="jboss.community" />
<option name="name" value="JBoss Community repository" />
<option name="url" value="https://repository.jboss.org/nexus/content/repositories/public/" />
</remote-repository>
</component>
</project>

View File

@ -1,12 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="MavenProjectsManager">
<option name="originalFiles">
<list>
<option value="$PROJECT_DIR$/pom.xml" />
</list>
</option>
</component>
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" default="true" project-jdk-name="1.8" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/out" />
</component>

View File

@ -3,7 +3,6 @@
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/UHC-Core.iml" filepath="$PROJECT_DIR$/UHC-Core.iml" />
<module fileurl="file://$PROJECT_DIR$/UhcCore.iml" filepath="$PROJECT_DIR$/UhcCore.iml" />
</modules>
</component>
</project>

34
UHC-Core.iml Normal file
View File

@ -0,0 +1,34 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="JAVA_MODULE" version="4">
<component name="NewModuleRootManager" inherit-compiler-output="true">
<exclude-output />
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
<excludeFolder url="file://$MODULE_DIR$/.idea/dictionaries" />
<excludeFolder url="file://$MODULE_DIR$/.idea/libraries" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="module-library">
<library>
<CLASSES>
<root url="jar://$MAVEN_REPOSITORY$/org/jetbrains/annotations/17.0.0/annotations-17.0.0.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
</library>
</orderEntry>
<orderEntry type="module-library" scope="PROVIDED">
<library>
<CLASSES>
<root url="jar://$MODULE_DIR$/../../../spigot-1.14.4.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES>
<root url="jar://$MODULE_DIR$/../../../spigot-1.14.4.jar!/" />
</SOURCES>
</library>
</orderEntry>
<orderEntry type="library" name="spigot-1.16.1" level="project" />
</component>
</module>

View File

@ -1,20 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<module org.jetbrains.idea.maven.project.MavenProjectsManager.isMavenModule="true" type="JAVA_MODULE" version="4">
<component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_8">
<output url="file://$MODULE_DIR$/target/classes" />
<output-test url="file://$MODULE_DIR$/target/test-classes" />
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/src/main/java" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/main/resources" type="java-resource" />
<excludeFolder url="file://$MODULE_DIR$/target" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="library" scope="PROVIDED" name="Maven: org.spigotmc:spigot-api:1.16.1-R0.1-SNAPSHOT" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: commons-lang:commons-lang:2.6" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: com.google.guava:guava:21.0" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: com.google.code.gson:gson:2.8.0" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: net.md-5:bungeecord-chat:1.16-R0.3" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: org.yaml:snakeyaml:1.26" level="project" />
</component>
</module>

38
ant_build_increment.xml Normal file
View File

@ -0,0 +1,38 @@
<project name="BuildIncrement" default="init" basedir=".">
<description>
simple example increment build variable
</description>
<!-- set global properties for this build -->
<property name="src" location="src"/>
<property name="version" value="0.0"/>
<loadproperties>
<file file="build.number"/>
</loadproperties>
<target name="init">
<echo file="ant_buildversion_init.txt">Changing build version from BUILD_VERSION to ${version}.${build.number} in file plugin.yml...</echo>
<replaceregexp file="${src}/plugin.yml"
match="BUILD_NUMBER"
replace="${version}.${build.number}"
byline="true"
/>
<echo file="ant_buildversion_init.txt">Changed!</echo>
</target>
<target name="end">
<echo file="ant_buildversion_end.txt">Changing back build version ${version}.${build.number} in file plugin.yml to BUILD_VERSION...</echo>
<replaceregexp file="${src}/plugin.yml"
match="${version}.${build.number}"
replace="BUILD_NUMBER"
byline="true"
/>
<buildnumber/>
<echo file="ant_buildversion_init.txt">Changed!</echo>
</target>
</project>

1
ant_buildversion_end.txt Normal file
View File

@ -0,0 +1 @@
Changing back build version 0.0.135 in file plugin.yml to BUILD_VERSION...

View File

@ -0,0 +1 @@
Changed!

5
build.number Normal file
View File

@ -0,0 +1,5 @@
#Build Number for ANT. Do not edit!
#Tue Feb 25 14:58:59 CET 2020
\#Build=Number for ANT. Do not edit\!
build.number=136
\#Tue=Jul 30 16\:09\:09 CEST 2019

57
pom.xml
View File

@ -1,57 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>net.mindoverflow.network.uhccore</groupId>
<artifactId>UhcCore</artifactId>
<version>0.0.136</version>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<configuration>
<archive>
<manifestFile>src/main/resources/META-INF/MANIFEST.MF</manifestFile>
</archive>
</configuration>
</plugin>
</plugins>
</build>
<properties>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<versionName>${project.version}</versionName>
</properties>
<repositories>
<!-- This adds the Spigot Maven repository to the build -->
<repository>
<id>spigot-repo</id>
<url>https://hub.spigotmc.org/nexus/content/repositories/snapshots/</url>
</repository>
</repositories>
<dependencies>
<!--This adds the Spigot API artifact to the build -->
<dependency>
<groupId>org.spigotmc</groupId>
<artifactId>spigot-api</artifactId>
<version>1.16.1-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
<!--This adds the Bukkit API artifact to the build -->
<!-- Do not include this in the pom.xml file if the Spigot API is already added -->
<!--
<dependency>
<groupId>org.bukkit</groupId>
<artifactId>bukkit</artifactId>
<version>1.15.2-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
-->
</dependencies>
</project>

View File

@ -1,6 +1,6 @@
package net.mindoverflow.network.uhccore.commands.uhccommands;
import net.mindoverflow.network.uhccore.utils.Cache;
import net.mindoverflow.network.uhccore.utils.CommonValues;
import org.bukkit.command.CommandSender;
import java.util.ArrayList;
@ -12,12 +12,12 @@ public class ListCommand
{
HashMap<Integer, ArrayList<String>>playersPerTeam = new HashMap<>();
for(int i = 0; i < Cache.totalTeams; i++)
for(int i = 0; i < CommonValues.totalTeams; i++)
{
ArrayList<String>playersInThisTeam = new ArrayList<>();
for(String playerName : Cache.playerTeam.keySet())
for(String playerName : CommonValues.playerTeam.keySet())
{
if(Cache.playerTeam.get(playerName).equals(i))
if(CommonValues.playerTeam.get(playerName).equals(i))
{
playersInThisTeam.add(playerName);
}
@ -28,7 +28,7 @@ public class ListCommand
commandSender.sendMessage("§6-------[ UHC: Lista Team ]-------");
for(Integer i : playersPerTeam.keySet())
{
String teamName = Cache.teamNames.get(i);
String teamName = CommonValues.teamNames.get(i);
int playersInThisTeam = playersPerTeam.get(i).size();
ArrayList<String>playersNames = playersPerTeam.get(i);
String playersList = playersNames.toString().replace("[", "").replace("]", "").replace(",", "§7,§r");

View File

@ -1,6 +1,6 @@
package net.mindoverflow.network.uhccore.commands.uhccommands;
import net.mindoverflow.network.uhccore.utils.Cache;
import net.mindoverflow.network.uhccore.utils.CommonValues;
import net.mindoverflow.network.uhccore.utils.configuration.ConfigEntries;
import net.mindoverflow.network.uhccore.utils.Debugger;
import net.mindoverflow.network.uhccore.utils.configuration.FileUtils;
@ -23,17 +23,17 @@ public class SetFireworkCommand
YamlConfiguration config = FileUtils.FileType.CONFIG_YAML.yaml;
int listPos = Cache.fireworksLocations.size() + 1;
int listPos = CommonValues.fireworksLocations.size() + 1;
if(Cache.fireworksLocations.get(0).getWorld() == null)
if(CommonValues.fireworksLocations.get(0).getWorld() == null)
{
debugger.sendDebugMessage(Level.SEVERE, "WORLD IS NULL!");
listPos = 1;
Cache.fireworksLocations.set(0, fireworkLoc);
CommonValues.fireworksLocations.set(0, fireworkLoc);
}
else
{
Cache.fireworksLocations.add(fireworkLoc);
CommonValues.fireworksLocations.add(fireworkLoc);
}
String currentPath = ConfigEntries.FIREWORK_POS.path + "." + listPos;

View File

@ -1,6 +1,6 @@
package net.mindoverflow.network.uhccore.commands.uhccommands;
import net.mindoverflow.network.uhccore.utils.Cache;
import net.mindoverflow.network.uhccore.utils.CommonValues;
import net.mindoverflow.network.uhccore.utils.configuration.ConfigEntries;
import net.mindoverflow.network.uhccore.utils.configuration.FileUtils;
import org.bukkit.Location;
@ -16,7 +16,7 @@ public class SetSpawnCommand
Player player = (Player) sender;
Location playerLoc = player.getLocation();
Cache.spawn = playerLoc;
CommonValues.spawn = playerLoc;
YamlConfiguration config = FileUtils.FileType.CONFIG_YAML.yaml;
config.set(ConfigEntries.SPAWN_WORLD.path, playerLoc.getWorld().getName());
config.set(ConfigEntries.SPAWN_X.path, playerLoc.getX());

View File

@ -1,7 +1,7 @@
package net.mindoverflow.network.uhccore.commands.uhccommands;
import net.mindoverflow.network.uhccore.UhcCore;
import net.mindoverflow.network.uhccore.utils.Cache;
import net.mindoverflow.network.uhccore.utils.CommonValues;
import net.mindoverflow.network.uhccore.utils.Debugger;
import net.mindoverflow.network.uhccore.utils.math.NumberUtils;
import org.bukkit.*;
@ -23,17 +23,17 @@ public class StartUhcCommand {
HashMap<Integer, Location> spawnPerTeam = new HashMap<>();
World spawnWorld = plugin.getServer().getWorld(Cache.uhcWorlds.get(0));
World spawnWorld = plugin.getServer().getWorld(CommonValues.uhcWorlds.get(0));
int borderX = Cache.borderX;
int borderZ = Cache.borderZ;
int borderSize = Cache.borderSize;
int borderX = CommonValues.borderX;
int borderZ = CommonValues.borderZ;
int borderSize = CommonValues.borderSize;
int range = borderSize / 2;
Location borderCenter = new Location(spawnWorld, borderX, 64, borderZ);
for(String playerName : Cache.playerTeam.keySet())
for(String playerName : CommonValues.playerTeam.keySet())
{
Player player = plugin.getServer().getPlayer(playerName);
player.sendTitle("La §dUHC§r inizierà a breve!", "ricerca degli spawnpoint...", 20, 70, 10);
@ -42,7 +42,7 @@ public class StartUhcCommand {
plugin.getServer().getScheduler().runTaskAsynchronously(plugin, ()->
{
for(int i = 0; i < Cache.totalTeams; i++)
for(int i = 0; i < CommonValues.totalTeams; i++)
{
double x = NumberUtils.getRandomNumberInRange(borderX - range + 1, borderX + range - 1) + 0.5;
@ -67,18 +67,18 @@ public class StartUhcCommand {
}
plugin.getServer().getScheduler().runTaskLaterAsynchronously(plugin, ()->
{
Cache.allowMovement = false;
CommonValues.allowMovement = false;
}, 20L);
plugin.getServer().getScheduler().runTaskLaterAsynchronously(plugin, ()->
{
Cache.allowMovement = true;
CommonValues.allowMovement = true;
}, loadDelay * 20L);
for(String playerName : Cache.playerTeam.keySet())
for(String playerName : CommonValues.playerTeam.keySet())
{
int teamNumber = Cache.playerTeam.get(playerName);
int teamNumber = CommonValues.playerTeam.get(playerName);
Player player = plugin.getServer().getPlayer(playerName);
Location hisTeamLoc = spawnPerTeam.get(teamNumber);

View File

@ -1,7 +1,7 @@
package net.mindoverflow.network.uhccore.listeners;
import net.mindoverflow.network.uhccore.UhcCore;
import net.mindoverflow.network.uhccore.utils.Cache;
import net.mindoverflow.network.uhccore.utils.CommonValues;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener;
@ -28,11 +28,11 @@ public class PlayerChatListener implements Listener {
String message;
// Check if the player is in a team.
if(Cache.playerTeam.containsKey(playerName))
if(CommonValues.playerTeam.containsKey(playerName))
{
// Load the team number and the team name from that.
int teamNumber = Cache.playerTeam.get(playerName);
String teamName = Cache.teamNames.get(teamNumber);
int teamNumber = CommonValues.playerTeam.get(playerName);
String teamName = CommonValues.teamNames.get(teamNumber);
// Build the chat message.
message = "§7[" + teamName + "§7] §f" + displayName + "§7: " + event.getMessage();

View File

@ -1,7 +1,7 @@
package net.mindoverflow.network.uhccore.listeners;
import net.mindoverflow.network.uhccore.UhcCore;
import net.mindoverflow.network.uhccore.utils.Cache;
import net.mindoverflow.network.uhccore.utils.CommonValues;
import net.mindoverflow.network.uhccore.utils.Debugger;
import net.mindoverflow.network.uhccore.utils.UhcUtils;
import org.bukkit.*;
@ -44,10 +44,10 @@ public class PlayerDeathRespawnListener implements Listener
Player player = event.getEntity();
// Remove the Teams selector item from the drops.
event.getDrops().remove(Cache.teamsItem);
event.getDrops().remove(CommonValues.teamsItem);
// Check if the player died in the lobby...
if(Cache.lobbyWorlds.contains(player.getWorld().getName()))
if(CommonValues.lobbyWorlds.contains(player.getWorld().getName()))
{
// And clear all drops.
event.getDrops().clear();
@ -58,7 +58,7 @@ public class PlayerDeathRespawnListener implements Listener
// check if the death world is a UHC world (we don't want this to happen in the lobby!)
// and
// check if the player is in any team (players who are not in a team are not playing!)
if((Cache.uhcWorlds.contains(player.getWorld().getName())) && Cache.playerTeam.containsKey(player.getName()))
if((CommonValues.uhcWorlds.contains(player.getWorld().getName())) && CommonValues.playerTeam.containsKey(player.getName()))
{
// Spawn a Firework where the player died.
@ -71,11 +71,11 @@ public class PlayerDeathRespawnListener implements Listener
deadPlayers.put(playerName, player.getLocation());
// Load the dead player's team number.
int thisPlayerTeamNumber = Cache.playerTeam.get(playerName);
int thisPlayerTeamNumber = CommonValues.playerTeam.get(playerName);
// Load the death player's team name.
String thisPlayerTeamName = Cache.teamNames.get(thisPlayerTeamNumber);
String thisPlayerTeamName = CommonValues.teamNames.get(thisPlayerTeamNumber);
// Remove the player from his team.
Cache.playerTeam.remove(playerName);
CommonValues.playerTeam.remove(playerName);
// Run this task Async, because it may be CPU heavy.
@ -86,44 +86,44 @@ public class PlayerDeathRespawnListener implements Listener
UhcUtils.updatePlayersPerTeam();
// Check how many players are left in the dead player's team.
int thisPlayerTeamPlayers = Cache.playersPerTeam.get(thisPlayerTeamNumber);
int thisPlayerTeamPlayers = CommonValues.playersPerTeam.get(thisPlayerTeamNumber);
// Run this task Sync, because we need to access the API, and also delay it by 1 second.
plugin.getServer().getScheduler().runTaskLater(plugin, () ->
{
int playingPlayers = Cache.playerTeam.size();
int playingPlayers = CommonValues.playerTeam.size();
for(Player p : plugin.getServer().getOnlinePlayers())
{
p.playSound(p.getLocation(), Sound.BLOCK_NOTE_BLOCK_PLING, 1, 1);
}
plugin.getServer().broadcastMessage(playerName + "§7 del team §e" + thisPlayerTeamName + "§7 è fuori gioco!");
plugin.getServer().broadcastMessage("§7Nel team " + thisPlayerTeamName + "§7 rimangono §e" + thisPlayerTeamPlayers + "§7 giocatori.");
plugin.getServer().broadcastMessage("§7In totale rimangono §e" + playingPlayers + "§7 giocatori, in §e" + Cache.playingTeams + "§7 team.");
plugin.getServer().broadcastMessage("§7In totale rimangono §e" + playingPlayers + "§7 giocatori, in §e" + CommonValues.playingTeams + "§7 team.");
if(Cache.playingTeams <= 1)
if(CommonValues.playingTeams <= 1)
{
Cache.allowMovement = false;
CommonValues.allowMovement = false;
scheduleTask();
plugin.getServer().broadcastMessage("§6La UHC è finita!");
int winningTeam = 0;
for(int i = 0; i < Cache.totalTeams; i++)
for(int i = 0; i < CommonValues.totalTeams; i++)
{
if(Cache.playersPerTeam.get(i) > 0)
if(CommonValues.playersPerTeam.get(i) > 0)
{
winningTeam = i;
}
}
String teamName = Cache.teamNames.get(winningTeam) + "§r";
String teamName = CommonValues.teamNames.get(winningTeam) + "§r";
plugin.getServer().broadcastMessage("§6Ha vinto il team: " + teamName);
for(Player currentPlayer : plugin.getServer().getOnlinePlayers())
{
currentPlayer.teleport(Cache.spawn);
currentPlayer.teleport(CommonValues.spawn);
// Clear his inventory and give him the Teams selector item.
UhcUtils.giveTeamsSelectorItem(currentPlayer);
plugin.getLogger().log(Level.INFO,"UHC Finished!");
@ -159,7 +159,7 @@ public class PlayerDeathRespawnListener implements Listener
// Check if there is more than 1 team alive.
// If there is only 1 team alive, then the UHC is over.
if(Cache.playingTeams > 1)
if(CommonValues.playingTeams > 1)
{
// warn the player that he's not a spectator.
player.sendMessage("§cSei morto nella UHC e ora sei uno spettatore!");
@ -221,7 +221,7 @@ public class PlayerDeathRespawnListener implements Listener
taskID = 0;
}
for(Location loc : Cache.fireworksLocations)
for(Location loc : CommonValues.fireworksLocations)
{
debugger.sendDebugMessage(Level.INFO, "FIREWORK LOC: " + loc);
UhcUtils.spawnFirework(loc, 10L);
@ -236,7 +236,7 @@ public class PlayerDeathRespawnListener implements Listener
plugin.getServer().getScheduler().runTaskLater(plugin, ()->
{
isTaskScheduled = false;
Cache.allowMovement = true;
CommonValues.allowMovement = true;
for (Player currentPlayer : plugin.getServer().getOnlinePlayers())
{

View File

@ -1,6 +1,6 @@
package net.mindoverflow.network.uhccore.listeners;
import net.mindoverflow.network.uhccore.utils.Cache;
import net.mindoverflow.network.uhccore.utils.CommonValues;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
@ -14,7 +14,7 @@ public class PlayerHitListener implements Listener
public void onPlayerHitPlayer(EntityDamageByEntityEvent event)
{
// if friendly fire is enabled, then skip everything that follows and let the hit happen.
if(Cache.friendlyFire) return;
if(CommonValues.friendlyFire) return;
// check if the damaged and damager entities are both players. If they're not, stop.
if(!(event.getDamager() instanceof Player && event.getEntity() instanceof Player))
@ -27,13 +27,13 @@ public class PlayerHitListener implements Listener
String damagerName = event.getDamager().getName();
// Check if they're in a team. if they're not, stop.
if(!(Cache.playerTeam.containsKey(damagedName) && Cache.playerTeam.containsKey(damagerName)))
if(!(CommonValues.playerTeam.containsKey(damagedName) && CommonValues.playerTeam.containsKey(damagerName)))
{
return;
}
// check if they're both in the same team.
if(Cache.playerTeam.get(damagedName).equals(Cache.playerTeam.get(damagerName)))
if(CommonValues.playerTeam.get(damagedName).equals(CommonValues.playerTeam.get(damagerName)))
{
// cancel the event.
event.setCancelled(true);

View File

@ -1,7 +1,7 @@
package net.mindoverflow.network.uhccore.listeners;
import net.mindoverflow.network.uhccore.utils.Cache;
import net.mindoverflow.network.uhccore.utils.CommonValues;
import net.mindoverflow.network.uhccore.utils.UhcUtils;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
@ -28,10 +28,10 @@ public class PlayerInteractListener implements Listener
Player player = event.getPlayer();
// check if the player's item in hand was the Teams selector item.
if(player.getInventory().getItemInMainHand().equals(Cache.teamsItem))
if(player.getInventory().getItemInMainHand().equals(CommonValues.teamsItem))
{
// Open the teams selector GUI.
player.openInventory(Cache.teamsSelectorGUI.getInventory());
player.openInventory(CommonValues.teamsSelectorGUI.getInventory());
}
}
}
@ -49,7 +49,7 @@ public class PlayerInteractListener implements Listener
ItemStack item = event.getCurrentItem();
// Check if the clicked inventory is the Teams selector GUI.
if(event.getClickedInventory().equals(Cache.teamsSelectorGUI.getInventory()))
if(event.getClickedInventory().equals(CommonValues.teamsSelectorGUI.getInventory()))
{
// Cancel the event (we don't want items to be moved!)
event.setCancelled(true);
@ -64,15 +64,15 @@ public class PlayerInteractListener implements Listener
player.closeInventory();
// Check if the clicked item is an existing Team.
if(Cache.teamNames.contains(im.getDisplayName()))
if(CommonValues.teamNames.contains(im.getDisplayName()))
{
// Load the team number from the team name in the teams list.
int teamNumber = Cache.teamNames.indexOf(im.getDisplayName());
int teamNumber = CommonValues.teamNames.indexOf(im.getDisplayName());
// Add the player to that team.
Cache.playerTeam.remove(player.getName());
Cache.playerTeam.put(player.getName(), teamNumber);
CommonValues.playerTeam.remove(player.getName());
CommonValues.playerTeam.put(player.getName(), teamNumber);
// Update the total number of players in each team, and the total number of alive teams.
UhcUtils.updatePlayersPerTeam();
@ -81,14 +81,14 @@ public class PlayerInteractListener implements Listener
player.sendMessage("§7Aggiunto al team " + im.getDisplayName());
}
// Else, check if the clicked item is the one used to quit teams.
else if(item.equals(Cache.quitTeamItem))
else if(item.equals(CommonValues.quitTeamItem))
{
// Check if the player is in any team.
if(Cache.playerTeam.containsKey(player.getName()))
if(CommonValues.playerTeam.containsKey(player.getName()))
{
// Remove the player from the team.
player.sendMessage("§eRimosso dal Team!");
Cache.playerTeam.remove(player.getName());
CommonValues.playerTeam.remove(player.getName());
// Update the total number of players in each team, and the total number of alive teams.
UhcUtils.updatePlayersPerTeam();
@ -98,10 +98,10 @@ public class PlayerInteractListener implements Listener
}
}
} // Check if the non-clicked inventory (there always are two inventories) is the Teams selector GUI, and cancel the event (we don't want items to be put inside of it!)
else if(event.getInventory().equals(Cache.teamsSelectorGUI.getInventory())) event.setCancelled(true);
else if(event.getInventory().equals(CommonValues.teamsSelectorGUI.getInventory())) event.setCancelled(true);
// Prevent everyone from moving the Teams selector item in their inventory.
if(item.equals(Cache.teamsItem)) event.setCancelled(true);
if(item.equals(CommonValues.teamsItem)) event.setCancelled(true);
}
@ -111,7 +111,7 @@ public class PlayerInteractListener implements Listener
public void onItemDrop(PlayerDropItemEvent event)
{
// Check if the dropped item is the Teams selector item.
if(event.getItemDrop().getItemStack().equals(Cache.teamsItem))
if(event.getItemDrop().getItemStack().equals(CommonValues.teamsItem))
{
// Prevent it from being dropped.
event.setCancelled(true);

View File

@ -1,12 +1,17 @@
package net.mindoverflow.network.uhccore.listeners;
import net.mindoverflow.network.uhccore.utils.Cache;
import net.mindoverflow.network.uhccore.utils.CommonValues;
import net.mindoverflow.network.uhccore.utils.Debugger;
import net.mindoverflow.network.uhccore.utils.UhcUtils;
import org.bukkit.Material;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.player.PlayerJoinEvent;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.ItemMeta;
import java.util.logging.Level;
public class PlayerJoinListener implements Listener
{
@ -23,7 +28,7 @@ public class PlayerJoinListener implements Listener
Player player = e.getPlayer();
if(!(Cache.playerTeam.containsKey(player.getName())))
if(!(CommonValues.playerTeam.containsKey(player.getName())))
{
UhcUtils.tpSpawnAndGiveItem(player);
}

View File

@ -1,10 +1,16 @@
package net.mindoverflow.network.uhccore.listeners;
import net.mindoverflow.network.uhccore.UhcCore;
import net.mindoverflow.network.uhccore.utils.Cache;
import net.mindoverflow.network.uhccore.utils.CommonValues;
import net.mindoverflow.network.uhccore.utils.Debugger;
import org.bukkit.Location;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.player.PlayerMoveEvent;
import org.bukkit.scheduler.BukkitTask;
import java.util.logging.Level;
public class PlayerMoveListener implements Listener
{
@ -20,7 +26,7 @@ public class PlayerMoveListener implements Listener
@EventHandler
public void onPlayerMove(PlayerMoveEvent event)
{
if(Cache.allowMovement) return;
if(CommonValues.allowMovement) return;
event.setCancelled(true);
}
}

View File

@ -1,6 +1,6 @@
package net.mindoverflow.network.uhccore.listeners;
import net.mindoverflow.network.uhccore.utils.Cache;
import net.mindoverflow.network.uhccore.utils.CommonValues;
import org.bukkit.Bukkit;
import org.bukkit.Material;
import org.bukkit.inventory.Inventory;
@ -8,6 +8,8 @@ import org.bukkit.inventory.InventoryHolder;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.ItemMeta;
import java.util.LinkedHashMap;
public class TeamsSelectorGUI implements InventoryHolder
{
@ -26,15 +28,15 @@ public class TeamsSelectorGUI implements InventoryHolder
public void initializeInv()
{
for(int i = 0; i < Cache.totalTeams; i++)
for(int i = 0; i < CommonValues.totalTeams; i++)
{
String teamName = Cache.teamNames.get(i);
Material itemMat = Cache.teamItemsMaterials.get(i);
String teamName = CommonValues.teamNames.get(i);
Material itemMat = CommonValues.teamItemsMaterials.get(i);
inv.setItem(i, createItem(teamName, itemMat));
}
inv.setItem(17, Cache.quitTeamItem);
inv.setItem(17, CommonValues.quitTeamItem);
}

View File

@ -1,15 +1,22 @@
package net.mindoverflow.network.uhccore.utils;
import net.mindoverflow.network.uhccore.UhcCore;
import net.mindoverflow.network.uhccore.listeners.TeamsSelectorGUI;
import org.bukkit.Color;
import org.bukkit.FireworkEffect;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.Firework;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.FireworkMeta;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
public class Cache {
public class CommonValues {
// Values to save the uhc and lobby world names.
public static List<String> uhcWorlds = new ArrayList<>(), lobbyWorlds = new ArrayList<>();

View File

@ -19,16 +19,16 @@ public class UhcUtils {
int playingTeams = 0;
// Iterate through every existing team.
for(int i = 0; i < Cache.totalTeams; i++)
for(int i = 0; i < CommonValues.totalTeams; i++)
{
// Int to store the players number for each team.
int playersNumber = 0;
// Iterate through every player and...
for(String s : Cache.playerTeam.keySet())
for(String s : CommonValues.playerTeam.keySet())
{
//if his team is the current checked one...
if(Cache.playerTeam.get(s) == i)
if(CommonValues.playerTeam.get(s) == i)
{
//increase the playersNumber by 1.
playersNumber++;
@ -36,21 +36,21 @@ public class UhcUtils {
}
// Finally, put the team number and his player count in the playersPerTeam HashMap.
Cache.playersPerTeam.put(i, playersNumber);
CommonValues.playersPerTeam.put(i, playersNumber);
// If there is at least 1 player in this team, then count this as an "alive team".
if(playersNumber != 0) playingTeams++;
}
// Return the number of alive teams.
Cache.playingTeams = playingTeams;
CommonValues.playingTeams = playingTeams;
}
public static void giveTeamsSelectorItem(Player player)
{
player.getInventory().clear();
player.getInventory().setItem(4, Cache.teamsItem);
player.getInventory().setItem(4, CommonValues.teamsItem);
}
public static void spawnFirework(Location location, long detonateDelay) {
@ -70,7 +70,7 @@ public class UhcUtils {
public static void tpSpawnAndGiveItem(Player player)
{
player.teleport(Cache.spawn);
player.teleport(CommonValues.spawn);
// Clear the player's inventory and give hims the Teams selector item.
UhcUtils.giveTeamsSelectorItem(player);

View File

@ -2,7 +2,7 @@ package net.mindoverflow.network.uhccore.utils.configuration;
import net.mindoverflow.network.uhccore.UhcCore;
import net.mindoverflow.network.uhccore.listeners.TeamsSelectorGUI;
import net.mindoverflow.network.uhccore.utils.Cache;
import net.mindoverflow.network.uhccore.utils.CommonValues;
import net.mindoverflow.network.uhccore.utils.Debugger;
import org.bukkit.Location;
import org.bukkit.Material;
@ -59,46 +59,46 @@ public class FileUtils
FileType.CONFIG_YAML.yaml = YamlConfiguration.loadConfiguration(FileType.CONFIG_YAML.file);
FileType.LANG_YAML.yaml = YamlConfiguration.loadConfiguration(FileType.LANG_YAML.file);
Cache.playerTeam.clear();
Cache.playersPerTeam.clear();
Cache.teamNames.clear();
Cache.teamItemsMaterials.clear();
Cache.spawn = null;
Cache.fireworksLocations.clear();
CommonValues.playerTeam.clear();
CommonValues.playersPerTeam.clear();
CommonValues.teamNames.clear();
CommonValues.teamItemsMaterials.clear();
CommonValues.spawn = null;
CommonValues.fireworksLocations.clear();
Cache.playingTeams = 0;
CommonValues.playingTeams = 0;
YamlConfiguration config = FileType.CONFIG_YAML.yaml;
Cache.teamNames = config.getStringList(ConfigEntries.TEAMS_NAMES.path);
CommonValues.teamNames = config.getStringList(ConfigEntries.TEAMS_NAMES.path);
for(String matName : config.getStringList(ConfigEntries.TEAMS_ITEMS.path))
{
Cache.teamItemsMaterials.add(Material.valueOf(matName));
CommonValues.teamItemsMaterials.add(Material.valueOf(matName));
}
Cache.uhcWorlds = config.getStringList(ConfigEntries.UHC_WORLDS.path);
Cache.lobbyWorlds = config.getStringList(ConfigEntries.LOBBY_WORLDS.path);
CommonValues.uhcWorlds = config.getStringList(ConfigEntries.UHC_WORLDS.path);
CommonValues.lobbyWorlds = config.getStringList(ConfigEntries.LOBBY_WORLDS.path);
Cache.friendlyFire = config.getBoolean(ConfigEntries.FRIENDLY_FIRE.path);
CommonValues.friendlyFire = config.getBoolean(ConfigEntries.FRIENDLY_FIRE.path);
Cache.teamsItem = new ItemStack(Material.NETHER_STAR);
ItemMeta im = Cache.teamsItem.getItemMeta();
CommonValues.teamsItem = new ItemStack(Material.NETHER_STAR);
ItemMeta im = CommonValues.teamsItem.getItemMeta();
im.setDisplayName("§eTeam");
Cache.teamsItem.setItemMeta(im);
CommonValues.teamsItem.setItemMeta(im);
Cache.quitTeamItem = new ItemStack(Material.BARRIER);
im = Cache.quitTeamItem.getItemMeta();
CommonValues.quitTeamItem = new ItemStack(Material.BARRIER);
im = CommonValues.quitTeamItem.getItemMeta();
im.setDisplayName("§cEsci dal Team");
Cache.quitTeamItem.setItemMeta(im);
CommonValues.quitTeamItem.setItemMeta(im);
Cache.totalTeams = config.getInt(ConfigEntries.TEAMS_NUMBER.path);
CommonValues.totalTeams = config.getInt(ConfigEntries.TEAMS_NUMBER.path);
Cache.teamsSelectorGUI = new TeamsSelectorGUI();
Cache.teamsSelectorGUI.initializeInv();
CommonValues.teamsSelectorGUI = new TeamsSelectorGUI();
CommonValues.teamsSelectorGUI.initializeInv();
Cache.borderX = config.getInt(ConfigEntries.BORDER_CENTER_X.path);
Cache.borderZ = config.getInt(ConfigEntries.BORDER_CENTER_Z.path);
Cache.borderSize = config.getInt(ConfigEntries.BORDER_SIZE.path);
CommonValues.borderX = config.getInt(ConfigEntries.BORDER_CENTER_X.path);
CommonValues.borderZ = config.getInt(ConfigEntries.BORDER_CENTER_Z.path);
CommonValues.borderSize = config.getInt(ConfigEntries.BORDER_SIZE.path);
String spawnWorldName = config.getString(ConfigEntries.SPAWN_WORLD.path);
if(spawnWorldName != null)
@ -112,7 +112,7 @@ public class FileUtils
double z = config.getDouble(ConfigEntries.SPAWN_Z.path);
double yaw = config.getDouble(ConfigEntries.SPAWN_YAW.path);
double pitch = config.getDouble(ConfigEntries.SPAWN_PITCH.path);
Cache.spawn = new Location(spawnWorld, x, y, z, (float) yaw, (float) pitch);
CommonValues.spawn = new Location(spawnWorld, x, y, z, (float) yaw, (float) pitch);
}
}
@ -124,7 +124,7 @@ public class FileUtils
double y = config.getDouble(currentPath + ".y");
double z = config.getDouble(currentPath + ".z");
Cache.fireworksLocations.add(new Location(plugin.getServer().getWorld(world), x, y, z));
CommonValues.fireworksLocations.add(new Location(plugin.getServer().getWorld(world), x, y, z));
}
}

View File

@ -1,5 +1,5 @@
name: UHC-Core
version: 0.0.136
version: BUILD_NUMBER
author: mind_overflow
api-version: '1.15'
main: net.mindoverflow.network.uhccore.UhcCore

Binary file not shown.

View File

@ -1,40 +0,0 @@
settings:
uhcworlds: ['world', 'world_nether']
lobbyworlds: ['flat']
teams: 4
friendly-fire: false
border:
center-x: 0
center-z: 0
size: 4000
spawn:
world: __UNSET__
x: 0.0
y: 0.0
z: 0.0
yaw: 0.0
pitch: 0.0
firework-pos:
1:
world: __UNSET__
x: 0.0
y: 0.0
z: 0.0
teams:
- '§9Blue'
- '§cRed'
- '§aGreen'
- '§eYellow'
- '§5Purple'
- '§6Orange'
- '§8Black'
- '§dPink'
team-items:
- 'BLUE_WOOL'
- 'RED_WOOL'
- 'LIME_WOOL'
- 'YELLOW_WOOL'
- 'PURPLE_WOOL'
- 'ORANGE_WOOL'
- 'BLACK_WOOL'
- 'PINK_WOOL'

View File

@ -1,5 +0,0 @@
error:
console_access: '&eWarning! You are accessing the plugin command from console.'
console_access_blocked: '&cSorry, but this command is not available via console.'
info: '&bThis is a colored and localized message!'
player_position: '&bYour position is: &e%pos%'

View File

@ -1,9 +0,0 @@
name: UHC-Core
version: 0.0.136
author: mind_overflow
api-version: '1.15'
main: net.mindoverflow.network.uhccore.UhcCore
commands:
uhc:
description: UHC-Core base command.
usage: /uhc

View File

@ -1,5 +0,0 @@
#Generated by Maven
#Tue May 31 20:19:46 CEST 2022
groupId=net.mindoverflow.network.uhccore
artifactId=UhcCore
version=0.0.136

View File

@ -1,27 +0,0 @@
net\mindoverflow\network\uhccore\utils\Debugger.class
net\mindoverflow\network\uhccore\utils\configuration\ConfigEntries.class
net\mindoverflow\network\uhccore\utils\UhcUtils.class
net\mindoverflow\network\uhccore\commands\uhccommands\ListCommand.class
net\mindoverflow\network\uhccore\listeners\PlayerMoveListener.class
net\mindoverflow\network\uhccore\listeners\PlayerInteractListener.class
net\mindoverflow\network\uhccore\utils\Cache.class
net\mindoverflow\network\uhccore\listeners\PlayerChatListener.class
net\mindoverflow\network\uhccore\commands\UhcCoreCommand.class
net\mindoverflow\network\uhccore\utils\configuration\LocalizedMessages.class
net\mindoverflow\network\uhccore\listeners\PlayerDeathRespawnListener.class
net\mindoverflow\network\uhccore\listeners\PlayerHitListener.class
net\mindoverflow\network\uhccore\commands\uhccommands\SetSpawnCommand.class
net\mindoverflow\network\uhccore\commands\uhccommands\StartUhcCommand.class
net\mindoverflow\network\uhccore\commands\uhccommands\SetFireworkCommand.class
net\mindoverflow\network\uhccore\utils\configuration\FileUtils.class
net\mindoverflow\network\uhccore\utils\Permissions.class
net\mindoverflow\network\uhccore\commands\uhccommands\HelpCommand.class
net\mindoverflow\network\uhccore\utils\PermissionUtils.class
net\mindoverflow\network\uhccore\commands\uhccommands\ReloadCommand.class
net\mindoverflow\network\uhccore\listeners\PlayerJoinListener.class
net\mindoverflow\network\uhccore\utils\math\NumberUtils.class
net\mindoverflow\network\uhccore\listeners\TeamsSelectorGUI.class
net\mindoverflow\network\uhccore\utils\MessageUtils.class
net\mindoverflow\network\uhccore\UhcCore.class
net\mindoverflow\network\uhccore\utils\configuration\FileUtils$FileType.class
net\mindoverflow\network\uhccore\completers\InfoCompleter.class

View File

@ -1,26 +0,0 @@
C:\Users\lol9\Desktop\Coding\Java\Spigot\UHC-Core\src\main\java\net\mindoverflow\network\uhccore\utils\Permissions.java
C:\Users\lol9\Desktop\Coding\Java\Spigot\UHC-Core\src\main\java\net\mindoverflow\network\uhccore\commands\uhccommands\SetFireworkCommand.java
C:\Users\lol9\Desktop\Coding\Java\Spigot\UHC-Core\src\main\java\net\mindoverflow\network\uhccore\listeners\PlayerInteractListener.java
C:\Users\lol9\Desktop\Coding\Java\Spigot\UHC-Core\src\main\java\net\mindoverflow\network\uhccore\utils\MessageUtils.java
C:\Users\lol9\Desktop\Coding\Java\Spigot\UHC-Core\src\main\java\net\mindoverflow\network\uhccore\commands\uhccommands\StartUhcCommand.java
C:\Users\lol9\Desktop\Coding\Java\Spigot\UHC-Core\src\main\java\net\mindoverflow\network\uhccore\utils\math\NumberUtils.java
C:\Users\lol9\Desktop\Coding\Java\Spigot\UHC-Core\src\main\java\net\mindoverflow\network\uhccore\listeners\PlayerDeathRespawnListener.java
C:\Users\lol9\Desktop\Coding\Java\Spigot\UHC-Core\src\main\java\net\mindoverflow\network\uhccore\listeners\PlayerHitListener.java
C:\Users\lol9\Desktop\Coding\Java\Spigot\UHC-Core\src\main\java\net\mindoverflow\network\uhccore\utils\PermissionUtils.java
C:\Users\lol9\Desktop\Coding\Java\Spigot\UHC-Core\src\main\java\net\mindoverflow\network\uhccore\listeners\PlayerMoveListener.java
C:\Users\lol9\Desktop\Coding\Java\Spigot\UHC-Core\src\main\java\net\mindoverflow\network\uhccore\utils\configuration\ConfigEntries.java
C:\Users\lol9\Desktop\Coding\Java\Spigot\UHC-Core\src\main\java\net\mindoverflow\network\uhccore\utils\Debugger.java
C:\Users\lol9\Desktop\Coding\Java\Spigot\UHC-Core\src\main\java\net\mindoverflow\network\uhccore\listeners\TeamsSelectorGUI.java
C:\Users\lol9\Desktop\Coding\Java\Spigot\UHC-Core\src\main\java\net\mindoverflow\network\uhccore\listeners\PlayerChatListener.java
C:\Users\lol9\Desktop\Coding\Java\Spigot\UHC-Core\src\main\java\net\mindoverflow\network\uhccore\commands\uhccommands\ListCommand.java
C:\Users\lol9\Desktop\Coding\Java\Spigot\UHC-Core\src\main\java\net\mindoverflow\network\uhccore\UhcCore.java
C:\Users\lol9\Desktop\Coding\Java\Spigot\UHC-Core\src\main\java\net\mindoverflow\network\uhccore\commands\uhccommands\SetSpawnCommand.java
C:\Users\lol9\Desktop\Coding\Java\Spigot\UHC-Core\src\main\java\net\mindoverflow\network\uhccore\utils\configuration\LocalizedMessages.java
C:\Users\lol9\Desktop\Coding\Java\Spigot\UHC-Core\src\main\java\net\mindoverflow\network\uhccore\commands\uhccommands\ReloadCommand.java
C:\Users\lol9\Desktop\Coding\Java\Spigot\UHC-Core\src\main\java\net\mindoverflow\network\uhccore\utils\configuration\FileUtils.java
C:\Users\lol9\Desktop\Coding\Java\Spigot\UHC-Core\src\main\java\net\mindoverflow\network\uhccore\commands\uhccommands\HelpCommand.java
C:\Users\lol9\Desktop\Coding\Java\Spigot\UHC-Core\src\main\java\net\mindoverflow\network\uhccore\completers\InfoCompleter.java
C:\Users\lol9\Desktop\Coding\Java\Spigot\UHC-Core\src\main\java\net\mindoverflow\network\uhccore\utils\UhcUtils.java
C:\Users\lol9\Desktop\Coding\Java\Spigot\UHC-Core\src\main\java\net\mindoverflow\network\uhccore\commands\UhcCoreCommand.java
C:\Users\lol9\Desktop\Coding\Java\Spigot\UHC-Core\src\main\java\net\mindoverflow\network\uhccore\listeners\PlayerJoinListener.java
C:\Users\lol9\Desktop\Coding\Java\Spigot\UHC-Core\src\main\java\net\mindoverflow\network\uhccore\utils\Cache.java