commit 30a1d28aec8c98278d5b7750676d720e860923aa Author: Mr¤KayJayDee Date: Thu Dec 1 01:52:35 2022 +0100 first commit diff --git a/.gradle/7.1/dependencies-accessors/dependencies-accessors.lock b/.gradle/7.1/dependencies-accessors/dependencies-accessors.lock new file mode 100644 index 0000000..fbd5d1c Binary files /dev/null and b/.gradle/7.1/dependencies-accessors/dependencies-accessors.lock differ diff --git a/.gradle/7.1/dependencies-accessors/gc.properties b/.gradle/7.1/dependencies-accessors/gc.properties new file mode 100644 index 0000000..e69de29 diff --git a/.gradle/7.1/executionHistory/executionHistory.bin b/.gradle/7.1/executionHistory/executionHistory.bin new file mode 100644 index 0000000..f644f89 Binary files /dev/null and b/.gradle/7.1/executionHistory/executionHistory.bin differ diff --git a/.gradle/7.1/executionHistory/executionHistory.lock b/.gradle/7.1/executionHistory/executionHistory.lock new file mode 100644 index 0000000..509e42f Binary files /dev/null and b/.gradle/7.1/executionHistory/executionHistory.lock differ diff --git a/.gradle/7.1/fileChanges/last-build.bin b/.gradle/7.1/fileChanges/last-build.bin new file mode 100644 index 0000000..f76dd23 Binary files /dev/null and b/.gradle/7.1/fileChanges/last-build.bin differ diff --git a/.gradle/7.1/fileHashes/fileHashes.bin b/.gradle/7.1/fileHashes/fileHashes.bin new file mode 100644 index 0000000..44c8c04 Binary files /dev/null and b/.gradle/7.1/fileHashes/fileHashes.bin differ diff --git a/.gradle/7.1/fileHashes/fileHashes.lock b/.gradle/7.1/fileHashes/fileHashes.lock new file mode 100644 index 0000000..64a326d Binary files /dev/null and b/.gradle/7.1/fileHashes/fileHashes.lock differ diff --git a/.gradle/7.1/fileHashes/resourceHashesCache.bin b/.gradle/7.1/fileHashes/resourceHashesCache.bin new file mode 100644 index 0000000..5c2c89f Binary files /dev/null and b/.gradle/7.1/fileHashes/resourceHashesCache.bin differ diff --git a/.gradle/7.1/gc.properties b/.gradle/7.1/gc.properties new file mode 100644 index 0000000..e69de29 diff --git a/.gradle/buildOutputCleanup/buildOutputCleanup.lock b/.gradle/buildOutputCleanup/buildOutputCleanup.lock new file mode 100644 index 0000000..6ff47cc Binary files /dev/null and b/.gradle/buildOutputCleanup/buildOutputCleanup.lock differ diff --git a/.gradle/buildOutputCleanup/cache.properties b/.gradle/buildOutputCleanup/cache.properties new file mode 100644 index 0000000..f1dfe87 --- /dev/null +++ b/.gradle/buildOutputCleanup/cache.properties @@ -0,0 +1,2 @@ +#Mon May 23 21:37:43 CEST 2022 +gradle.version=7.1 diff --git a/.gradle/buildOutputCleanup/outputFiles.bin b/.gradle/buildOutputCleanup/outputFiles.bin new file mode 100644 index 0000000..c431472 Binary files /dev/null and b/.gradle/buildOutputCleanup/outputFiles.bin differ diff --git a/.gradle/checksums/checksums.lock b/.gradle/checksums/checksums.lock new file mode 100644 index 0000000..796c772 Binary files /dev/null and b/.gradle/checksums/checksums.lock differ diff --git a/.gradle/checksums/md5-checksums.bin b/.gradle/checksums/md5-checksums.bin new file mode 100644 index 0000000..b2c0a22 Binary files /dev/null and b/.gradle/checksums/md5-checksums.bin differ diff --git a/.gradle/checksums/sha1-checksums.bin b/.gradle/checksums/sha1-checksums.bin new file mode 100644 index 0000000..2f254f1 Binary files /dev/null and b/.gradle/checksums/sha1-checksums.bin differ diff --git a/.gradle/vcs-1/gc.properties b/.gradle/vcs-1/gc.properties new file mode 100644 index 0000000..e69de29 diff --git a/.idea/.gitignore b/.idea/.gitignore new file mode 100644 index 0000000..26d3352 --- /dev/null +++ b/.idea/.gitignore @@ -0,0 +1,3 @@ +# Default ignored files +/shelf/ +/workspace.xml diff --git a/.idea/artifacts/CYG_jar.xml b/.idea/artifacts/CYG_jar.xml new file mode 100644 index 0000000..832e7d1 --- /dev/null +++ b/.idea/artifacts/CYG_jar.xml @@ -0,0 +1,8 @@ + + + $PROJECT_DIR$/../Serveur MC/plugins/ + + + + + \ No newline at end of file diff --git a/.idea/compiler.xml b/.idea/compiler.xml new file mode 100644 index 0000000..fb7f4a8 --- /dev/null +++ b/.idea/compiler.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/.idea/discord.xml b/.idea/discord.xml new file mode 100644 index 0000000..cf77f1e --- /dev/null +++ b/.idea/discord.xml @@ -0,0 +1,7 @@ + + + + + \ No newline at end of file diff --git a/.idea/gradle.xml b/.idea/gradle.xml new file mode 100644 index 0000000..40bd79d --- /dev/null +++ b/.idea/gradle.xml @@ -0,0 +1,19 @@ + + + + + + + \ No newline at end of file diff --git a/.idea/jarRepositories.xml b/.idea/jarRepositories.xml new file mode 100644 index 0000000..9779088 --- /dev/null +++ b/.idea/jarRepositories.xml @@ -0,0 +1,45 @@ + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/gson_2_8_2.xml b/.idea/libraries/gson_2_8_2.xml new file mode 100644 index 0000000..d7b4931 --- /dev/null +++ b/.idea/libraries/gson_2_8_2.xml @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/spigot.xml b/.idea/libraries/spigot.xml new file mode 100644 index 0000000..e3dc20c --- /dev/null +++ b/.idea/libraries/spigot.xml @@ -0,0 +1,11 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml new file mode 100644 index 0000000..62269df --- /dev/null +++ b/.idea/misc.xml @@ -0,0 +1,7 @@ + + + + + + + \ No newline at end of file diff --git a/.idea/uiDesigner.xml b/.idea/uiDesigner.xml new file mode 100644 index 0000000..e96534f --- /dev/null +++ b/.idea/uiDesigner.xml @@ -0,0 +1,124 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 0000000..5a0857d --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/build.gradle b/build.gradle new file mode 100644 index 0000000..b9fc349 --- /dev/null +++ b/build.gradle @@ -0,0 +1,49 @@ +plugins { + id 'java' + id "com.github.johnrengelman.shadow" version "6.1.0" +} + +repositories { + mavenCentral() + mavenLocal() + maven { + name = "spigotmc-repo" + url = "https://hub.spigotmc.org/nexus/content/repositories/snapshots/" + } + maven { + name = "sonatype" + url = "https://oss.sonatype.org/content/groups/public/" + } +} + +dependencies { + compileOnly 'org.spigotmc:spigot:1.16.1-R0.1-SNAPSHOT' +} + +compileJava.options.encoding = 'UTF-8' + +allprojects { + task buildPlugin(type: Copy) { + def shadow = !project.getTasksByName('shadowJar', true).isEmpty() + if(shadow) { + dependsOn 'shadowJar' + } else { + dependsOn 'build' + } + + from project.buildDir.path + '/libs' + into destDir + + if (shadow) { + include '*-all.jar' + } else { + include '*.jar' + } + } +} + + +shadowJar { + project.configurations.implementation.canBeResolved(true) + configurations = [project.configurations.implementation] +} \ No newline at end of file diff --git a/build/classes/java/main/fr/gravencyg/CYG.class b/build/classes/java/main/fr/gravencyg/CYG.class new file mode 100644 index 0000000..fcf21b1 Binary files /dev/null and b/build/classes/java/main/fr/gravencyg/CYG.class differ diff --git a/build/classes/java/main/fr/gravencyg/actions/Action.class b/build/classes/java/main/fr/gravencyg/actions/Action.class new file mode 100644 index 0000000..78ac4e4 Binary files /dev/null and b/build/classes/java/main/fr/gravencyg/actions/Action.class differ diff --git a/build/classes/java/main/fr/gravencyg/actions/ActionRegisters.class b/build/classes/java/main/fr/gravencyg/actions/ActionRegisters.class new file mode 100644 index 0000000..8b75cf9 Binary files /dev/null and b/build/classes/java/main/fr/gravencyg/actions/ActionRegisters.class differ diff --git a/build/classes/java/main/fr/gravencyg/actions/basic/ChangeGameModeAction.class b/build/classes/java/main/fr/gravencyg/actions/basic/ChangeGameModeAction.class new file mode 100644 index 0000000..69ba484 Binary files /dev/null and b/build/classes/java/main/fr/gravencyg/actions/basic/ChangeGameModeAction.class differ diff --git a/build/classes/java/main/fr/gravencyg/actions/basic/ConditionAction.class b/build/classes/java/main/fr/gravencyg/actions/basic/ConditionAction.class new file mode 100644 index 0000000..e766195 Binary files /dev/null and b/build/classes/java/main/fr/gravencyg/actions/basic/ConditionAction.class differ diff --git a/build/classes/java/main/fr/gravencyg/actions/basic/DropItemAction.class b/build/classes/java/main/fr/gravencyg/actions/basic/DropItemAction.class new file mode 100644 index 0000000..40c55c8 Binary files /dev/null and b/build/classes/java/main/fr/gravencyg/actions/basic/DropItemAction.class differ diff --git a/build/classes/java/main/fr/gravencyg/actions/basic/KillMonsterAction.class b/build/classes/java/main/fr/gravencyg/actions/basic/KillMonsterAction.class new file mode 100644 index 0000000..0eacacd Binary files /dev/null and b/build/classes/java/main/fr/gravencyg/actions/basic/KillMonsterAction.class differ diff --git a/build/classes/java/main/fr/gravencyg/actions/basic/MonsterSpawnAction.class b/build/classes/java/main/fr/gravencyg/actions/basic/MonsterSpawnAction.class new file mode 100644 index 0000000..aabbcf3 Binary files /dev/null and b/build/classes/java/main/fr/gravencyg/actions/basic/MonsterSpawnAction.class differ diff --git a/build/classes/java/main/fr/gravencyg/actions/basic/MusicAction.class b/build/classes/java/main/fr/gravencyg/actions/basic/MusicAction.class new file mode 100644 index 0000000..62f3c03 Binary files /dev/null and b/build/classes/java/main/fr/gravencyg/actions/basic/MusicAction.class differ diff --git a/build/classes/java/main/fr/gravencyg/actions/basic/PassAction.class b/build/classes/java/main/fr/gravencyg/actions/basic/PassAction.class new file mode 100644 index 0000000..eca02eb Binary files /dev/null and b/build/classes/java/main/fr/gravencyg/actions/basic/PassAction.class differ diff --git a/build/classes/java/main/fr/gravencyg/actions/basic/RandomAction.class b/build/classes/java/main/fr/gravencyg/actions/basic/RandomAction.class new file mode 100644 index 0000000..cbed87c Binary files /dev/null and b/build/classes/java/main/fr/gravencyg/actions/basic/RandomAction.class differ diff --git a/build/classes/java/main/fr/gravencyg/actions/basic/RestorePlayer.class b/build/classes/java/main/fr/gravencyg/actions/basic/RestorePlayer.class new file mode 100644 index 0000000..8f5dd92 Binary files /dev/null and b/build/classes/java/main/fr/gravencyg/actions/basic/RestorePlayer.class differ diff --git a/build/classes/java/main/fr/gravencyg/actions/basic/TeleportAction.class b/build/classes/java/main/fr/gravencyg/actions/basic/TeleportAction.class new file mode 100644 index 0000000..6de69e4 Binary files /dev/null and b/build/classes/java/main/fr/gravencyg/actions/basic/TeleportAction.class differ diff --git a/build/classes/java/main/fr/gravencyg/actions/block/RegenMapAction.class b/build/classes/java/main/fr/gravencyg/actions/block/RegenMapAction.class new file mode 100644 index 0000000..ebf35d3 Binary files /dev/null and b/build/classes/java/main/fr/gravencyg/actions/block/RegenMapAction.class differ diff --git a/build/classes/java/main/fr/gravencyg/actions/block/RemoveBlockAction.class b/build/classes/java/main/fr/gravencyg/actions/block/RemoveBlockAction.class new file mode 100644 index 0000000..b2c838f Binary files /dev/null and b/build/classes/java/main/fr/gravencyg/actions/block/RemoveBlockAction.class differ diff --git a/build/classes/java/main/fr/gravencyg/actions/block/SetBlockAction.class b/build/classes/java/main/fr/gravencyg/actions/block/SetBlockAction.class new file mode 100644 index 0000000..3da0131 Binary files /dev/null and b/build/classes/java/main/fr/gravencyg/actions/block/SetBlockAction.class differ diff --git a/build/classes/java/main/fr/gravencyg/actions/game/EliminateAction.class b/build/classes/java/main/fr/gravencyg/actions/game/EliminateAction.class new file mode 100644 index 0000000..803006b Binary files /dev/null and b/build/classes/java/main/fr/gravencyg/actions/game/EliminateAction.class differ diff --git a/build/classes/java/main/fr/gravencyg/actions/game/StopGameAction.class b/build/classes/java/main/fr/gravencyg/actions/game/StopGameAction.class new file mode 100644 index 0000000..79aa6ae Binary files /dev/null and b/build/classes/java/main/fr/gravencyg/actions/game/StopGameAction.class differ diff --git a/build/classes/java/main/fr/gravencyg/actions/game/WinnerAction.class b/build/classes/java/main/fr/gravencyg/actions/game/WinnerAction.class new file mode 100644 index 0000000..25c4bea Binary files /dev/null and b/build/classes/java/main/fr/gravencyg/actions/game/WinnerAction.class differ diff --git a/build/classes/java/main/fr/gravencyg/actions/inventory/ChestAction.class b/build/classes/java/main/fr/gravencyg/actions/inventory/ChestAction.class new file mode 100644 index 0000000..a88e824 Binary files /dev/null and b/build/classes/java/main/fr/gravencyg/actions/inventory/ChestAction.class differ diff --git a/build/classes/java/main/fr/gravencyg/actions/inventory/ClearAction.class b/build/classes/java/main/fr/gravencyg/actions/inventory/ClearAction.class new file mode 100644 index 0000000..ee120f1 Binary files /dev/null and b/build/classes/java/main/fr/gravencyg/actions/inventory/ClearAction.class differ diff --git a/build/classes/java/main/fr/gravencyg/actions/message/BossBarAction.class b/build/classes/java/main/fr/gravencyg/actions/message/BossBarAction.class new file mode 100644 index 0000000..842e4bf Binary files /dev/null and b/build/classes/java/main/fr/gravencyg/actions/message/BossBarAction.class differ diff --git a/build/classes/java/main/fr/gravencyg/actions/message/MessageAction.class b/build/classes/java/main/fr/gravencyg/actions/message/MessageAction.class new file mode 100644 index 0000000..363b34e Binary files /dev/null and b/build/classes/java/main/fr/gravencyg/actions/message/MessageAction.class differ diff --git a/build/classes/java/main/fr/gravencyg/actions/message/ResetBossBarAction.class b/build/classes/java/main/fr/gravencyg/actions/message/ResetBossBarAction.class new file mode 100644 index 0000000..c30b99a Binary files /dev/null and b/build/classes/java/main/fr/gravencyg/actions/message/ResetBossBarAction.class differ diff --git a/build/classes/java/main/fr/gravencyg/actions/message/TitleAction.class b/build/classes/java/main/fr/gravencyg/actions/message/TitleAction.class new file mode 100644 index 0000000..19682d6 Binary files /dev/null and b/build/classes/java/main/fr/gravencyg/actions/message/TitleAction.class differ diff --git a/build/classes/java/main/fr/gravencyg/actions/potion/ClearPotionEffectAction.class b/build/classes/java/main/fr/gravencyg/actions/potion/ClearPotionEffectAction.class new file mode 100644 index 0000000..f5457b2 Binary files /dev/null and b/build/classes/java/main/fr/gravencyg/actions/potion/ClearPotionEffectAction.class differ diff --git a/build/classes/java/main/fr/gravencyg/actions/potion/PotionEffectAction.class b/build/classes/java/main/fr/gravencyg/actions/potion/PotionEffectAction.class new file mode 100644 index 0000000..e6ae26a Binary files /dev/null and b/build/classes/java/main/fr/gravencyg/actions/potion/PotionEffectAction.class differ diff --git a/build/classes/java/main/fr/gravencyg/actions/team/Team.class b/build/classes/java/main/fr/gravencyg/actions/team/Team.class new file mode 100644 index 0000000..59f085e Binary files /dev/null and b/build/classes/java/main/fr/gravencyg/actions/team/Team.class differ diff --git a/build/classes/java/main/fr/gravencyg/actions/team/TeamAction.class b/build/classes/java/main/fr/gravencyg/actions/team/TeamAction.class new file mode 100644 index 0000000..b539e9e Binary files /dev/null and b/build/classes/java/main/fr/gravencyg/actions/team/TeamAction.class differ diff --git a/build/classes/java/main/fr/gravencyg/actions/toggle/ToggleBuildAction.class b/build/classes/java/main/fr/gravencyg/actions/toggle/ToggleBuildAction.class new file mode 100644 index 0000000..095b72a Binary files /dev/null and b/build/classes/java/main/fr/gravencyg/actions/toggle/ToggleBuildAction.class differ diff --git a/build/classes/java/main/fr/gravencyg/actions/toggle/ToggleFallDamage.class b/build/classes/java/main/fr/gravencyg/actions/toggle/ToggleFallDamage.class new file mode 100644 index 0000000..41ab87b Binary files /dev/null and b/build/classes/java/main/fr/gravencyg/actions/toggle/ToggleFallDamage.class differ diff --git a/build/classes/java/main/fr/gravencyg/actions/toggle/ToggleFlyAction.class b/build/classes/java/main/fr/gravencyg/actions/toggle/ToggleFlyAction.class new file mode 100644 index 0000000..21eacee Binary files /dev/null and b/build/classes/java/main/fr/gravencyg/actions/toggle/ToggleFlyAction.class differ diff --git a/build/classes/java/main/fr/gravencyg/actions/toggle/ToggleFreezeAction.class b/build/classes/java/main/fr/gravencyg/actions/toggle/ToggleFreezeAction.class new file mode 100644 index 0000000..ee16c96 Binary files /dev/null and b/build/classes/java/main/fr/gravencyg/actions/toggle/ToggleFreezeAction.class differ diff --git a/build/classes/java/main/fr/gravencyg/actions/toggle/ToggleGlowAction.class b/build/classes/java/main/fr/gravencyg/actions/toggle/ToggleGlowAction.class new file mode 100644 index 0000000..341cb4b Binary files /dev/null and b/build/classes/java/main/fr/gravencyg/actions/toggle/ToggleGlowAction.class differ diff --git a/build/classes/java/main/fr/gravencyg/actions/toggle/TogglePvPAction.class b/build/classes/java/main/fr/gravencyg/actions/toggle/TogglePvPAction.class new file mode 100644 index 0000000..401bdb9 Binary files /dev/null and b/build/classes/java/main/fr/gravencyg/actions/toggle/TogglePvPAction.class differ diff --git a/build/classes/java/main/fr/gravencyg/actions/waitable/WaitAction.class b/build/classes/java/main/fr/gravencyg/actions/waitable/WaitAction.class new file mode 100644 index 0000000..debd00a Binary files /dev/null and b/build/classes/java/main/fr/gravencyg/actions/waitable/WaitAction.class differ diff --git a/build/classes/java/main/fr/gravencyg/actions/waitable/WaitAction2.class b/build/classes/java/main/fr/gravencyg/actions/waitable/WaitAction2.class new file mode 100644 index 0000000..5c10039 Binary files /dev/null and b/build/classes/java/main/fr/gravencyg/actions/waitable/WaitAction2.class differ diff --git a/build/classes/java/main/fr/gravencyg/actions/waitable/WaitAction3.class b/build/classes/java/main/fr/gravencyg/actions/waitable/WaitAction3.class new file mode 100644 index 0000000..eb4a448 Binary files /dev/null and b/build/classes/java/main/fr/gravencyg/actions/waitable/WaitAction3.class differ diff --git a/build/classes/java/main/fr/gravencyg/commands/TCommand.class b/build/classes/java/main/fr/gravencyg/commands/TCommand.class new file mode 100644 index 0000000..b7ac4b2 Binary files /dev/null and b/build/classes/java/main/fr/gravencyg/commands/TCommand.class differ diff --git a/build/classes/java/main/fr/gravencyg/commands/admin/AdminForceLevelCommand.class b/build/classes/java/main/fr/gravencyg/commands/admin/AdminForceLevelCommand.class new file mode 100644 index 0000000..b42f007 Binary files /dev/null and b/build/classes/java/main/fr/gravencyg/commands/admin/AdminForceLevelCommand.class differ diff --git a/build/classes/java/main/fr/gravencyg/commands/admin/AdminForceUpdateHoloCommand.class b/build/classes/java/main/fr/gravencyg/commands/admin/AdminForceUpdateHoloCommand.class new file mode 100644 index 0000000..7f7b8bc Binary files /dev/null and b/build/classes/java/main/fr/gravencyg/commands/admin/AdminForceUpdateHoloCommand.class differ diff --git a/build/classes/java/main/fr/gravencyg/commands/admin/AdminRankCommand.class b/build/classes/java/main/fr/gravencyg/commands/admin/AdminRankCommand.class new file mode 100644 index 0000000..f9f5ca1 Binary files /dev/null and b/build/classes/java/main/fr/gravencyg/commands/admin/AdminRankCommand.class differ diff --git a/build/classes/java/main/fr/gravencyg/commands/admin/AdminRefreshLevelCommand.class b/build/classes/java/main/fr/gravencyg/commands/admin/AdminRefreshLevelCommand.class new file mode 100644 index 0000000..23a830f Binary files /dev/null and b/build/classes/java/main/fr/gravencyg/commands/admin/AdminRefreshLevelCommand.class differ diff --git a/build/classes/java/main/fr/gravencyg/commands/game/GameLeaveCommand.class b/build/classes/java/main/fr/gravencyg/commands/game/GameLeaveCommand.class new file mode 100644 index 0000000..233daea Binary files /dev/null and b/build/classes/java/main/fr/gravencyg/commands/game/GameLeaveCommand.class differ diff --git a/build/classes/java/main/fr/gravencyg/commands/game/GamePlayCommand.class b/build/classes/java/main/fr/gravencyg/commands/game/GamePlayCommand.class new file mode 100644 index 0000000..a990b64 Binary files /dev/null and b/build/classes/java/main/fr/gravencyg/commands/game/GamePlayCommand.class differ diff --git a/build/classes/java/main/fr/gravencyg/commands/link/LinkDiscordCommand.class b/build/classes/java/main/fr/gravencyg/commands/link/LinkDiscordCommand.class new file mode 100644 index 0000000..963dbf3 Binary files /dev/null and b/build/classes/java/main/fr/gravencyg/commands/link/LinkDiscordCommand.class differ diff --git a/build/classes/java/main/fr/gravencyg/commands/link/LinkShopCommand.class b/build/classes/java/main/fr/gravencyg/commands/link/LinkShopCommand.class new file mode 100644 index 0000000..9c6db2e Binary files /dev/null and b/build/classes/java/main/fr/gravencyg/commands/link/LinkShopCommand.class differ diff --git a/build/classes/java/main/fr/gravencyg/commands/link/LinkTwitterCommand.class b/build/classes/java/main/fr/gravencyg/commands/link/LinkTwitterCommand.class new file mode 100644 index 0000000..35355d0 Binary files /dev/null and b/build/classes/java/main/fr/gravencyg/commands/link/LinkTwitterCommand.class differ diff --git a/build/classes/java/main/fr/gravencyg/commands/manage/ManageFriendCommand.class b/build/classes/java/main/fr/gravencyg/commands/manage/ManageFriendCommand.class new file mode 100644 index 0000000..d2b0dbd Binary files /dev/null and b/build/classes/java/main/fr/gravencyg/commands/manage/ManageFriendCommand.class differ diff --git a/build/classes/java/main/fr/gravencyg/commands/manage/ManageLocationCommand.class b/build/classes/java/main/fr/gravencyg/commands/manage/ManageLocationCommand.class new file mode 100644 index 0000000..38cebac Binary files /dev/null and b/build/classes/java/main/fr/gravencyg/commands/manage/ManageLocationCommand.class differ diff --git a/build/classes/java/main/fr/gravencyg/commands/manage/ManageMessageCommand.class b/build/classes/java/main/fr/gravencyg/commands/manage/ManageMessageCommand.class new file mode 100644 index 0000000..c4a2746 Binary files /dev/null and b/build/classes/java/main/fr/gravencyg/commands/manage/ManageMessageCommand.class differ diff --git a/build/classes/java/main/fr/gravencyg/commands/manage/ManageNPCCommand.class b/build/classes/java/main/fr/gravencyg/commands/manage/ManageNPCCommand.class new file mode 100644 index 0000000..cf7cfe8 Binary files /dev/null and b/build/classes/java/main/fr/gravencyg/commands/manage/ManageNPCCommand.class differ diff --git a/build/classes/java/main/fr/gravencyg/commands/manage/ManageVariablesCommand.class b/build/classes/java/main/fr/gravencyg/commands/manage/ManageVariablesCommand.class new file mode 100644 index 0000000..d948491 Binary files /dev/null and b/build/classes/java/main/fr/gravencyg/commands/manage/ManageVariablesCommand.class differ diff --git a/build/classes/java/main/fr/gravencyg/commands/mod/ModFreezeCommand.class b/build/classes/java/main/fr/gravencyg/commands/mod/ModFreezeCommand.class new file mode 100644 index 0000000..0f379fe Binary files /dev/null and b/build/classes/java/main/fr/gravencyg/commands/mod/ModFreezeCommand.class differ diff --git a/build/classes/java/main/fr/gravencyg/commands/mod/ModKickCommand.class b/build/classes/java/main/fr/gravencyg/commands/mod/ModKickCommand.class new file mode 100644 index 0000000..211afc9 Binary files /dev/null and b/build/classes/java/main/fr/gravencyg/commands/mod/ModKickCommand.class differ diff --git a/build/classes/java/main/fr/gravencyg/commands/mod/ModMuteCommand.class b/build/classes/java/main/fr/gravencyg/commands/mod/ModMuteCommand.class new file mode 100644 index 0000000..2fe5cdb Binary files /dev/null and b/build/classes/java/main/fr/gravencyg/commands/mod/ModMuteCommand.class differ diff --git a/build/classes/java/main/fr/gravencyg/commands/mod/ModUnMuteCommand.class b/build/classes/java/main/fr/gravencyg/commands/mod/ModUnMuteCommand.class new file mode 100644 index 0000000..3a70c90 Binary files /dev/null and b/build/classes/java/main/fr/gravencyg/commands/mod/ModUnMuteCommand.class differ diff --git a/build/classes/java/main/fr/gravencyg/commands/mod/ModVerifyGameCommand.class b/build/classes/java/main/fr/gravencyg/commands/mod/ModVerifyGameCommand.class new file mode 100644 index 0000000..2e08f7b Binary files /dev/null and b/build/classes/java/main/fr/gravencyg/commands/mod/ModVerifyGameCommand.class differ diff --git a/build/classes/java/main/fr/gravencyg/commands/player/PlayerActionCommand.class b/build/classes/java/main/fr/gravencyg/commands/player/PlayerActionCommand.class new file mode 100644 index 0000000..82205dd Binary files /dev/null and b/build/classes/java/main/fr/gravencyg/commands/player/PlayerActionCommand.class differ diff --git a/build/classes/java/main/fr/gravencyg/commands/player/PlayerBarrierCommand.class b/build/classes/java/main/fr/gravencyg/commands/player/PlayerBarrierCommand.class new file mode 100644 index 0000000..f3c31e9 Binary files /dev/null and b/build/classes/java/main/fr/gravencyg/commands/player/PlayerBarrierCommand.class differ diff --git a/build/classes/java/main/fr/gravencyg/commands/player/PlayerBlockConditionCommand.class b/build/classes/java/main/fr/gravencyg/commands/player/PlayerBlockConditionCommand.class new file mode 100644 index 0000000..f890e59 Binary files /dev/null and b/build/classes/java/main/fr/gravencyg/commands/player/PlayerBlockConditionCommand.class differ diff --git a/build/classes/java/main/fr/gravencyg/commands/player/PlayerBlockEventCommand.class b/build/classes/java/main/fr/gravencyg/commands/player/PlayerBlockEventCommand.class new file mode 100644 index 0000000..eca146f Binary files /dev/null and b/build/classes/java/main/fr/gravencyg/commands/player/PlayerBlockEventCommand.class differ diff --git a/build/classes/java/main/fr/gravencyg/commands/player/PlayerFlyCommand.class b/build/classes/java/main/fr/gravencyg/commands/player/PlayerFlyCommand.class new file mode 100644 index 0000000..278730f Binary files /dev/null and b/build/classes/java/main/fr/gravencyg/commands/player/PlayerFlyCommand.class differ diff --git a/build/classes/java/main/fr/gravencyg/commands/player/PlayerGameModeCommand.class b/build/classes/java/main/fr/gravencyg/commands/player/PlayerGameModeCommand.class new file mode 100644 index 0000000..bab5502 Binary files /dev/null and b/build/classes/java/main/fr/gravencyg/commands/player/PlayerGameModeCommand.class differ diff --git a/build/classes/java/main/fr/gravencyg/commands/player/PlayerHatCommand.class b/build/classes/java/main/fr/gravencyg/commands/player/PlayerHatCommand.class new file mode 100644 index 0000000..040ea25 Binary files /dev/null and b/build/classes/java/main/fr/gravencyg/commands/player/PlayerHatCommand.class differ diff --git a/build/classes/java/main/fr/gravencyg/commands/player/PlayerHeadCommand.class b/build/classes/java/main/fr/gravencyg/commands/player/PlayerHeadCommand.class new file mode 100644 index 0000000..570e255 Binary files /dev/null and b/build/classes/java/main/fr/gravencyg/commands/player/PlayerHeadCommand.class differ diff --git a/build/classes/java/main/fr/gravencyg/commands/player/PlayerHubCommand.class b/build/classes/java/main/fr/gravencyg/commands/player/PlayerHubCommand.class new file mode 100644 index 0000000..1fd9e92 Binary files /dev/null and b/build/classes/java/main/fr/gravencyg/commands/player/PlayerHubCommand.class differ diff --git a/build/classes/java/main/fr/gravencyg/commands/player/PlayerPingCommand.class b/build/classes/java/main/fr/gravencyg/commands/player/PlayerPingCommand.class new file mode 100644 index 0000000..9601de4 Binary files /dev/null and b/build/classes/java/main/fr/gravencyg/commands/player/PlayerPingCommand.class differ diff --git a/build/classes/java/main/fr/gravencyg/commands/player/PlayerPlotCommand.class b/build/classes/java/main/fr/gravencyg/commands/player/PlayerPlotCommand.class new file mode 100644 index 0000000..73c4179 Binary files /dev/null and b/build/classes/java/main/fr/gravencyg/commands/player/PlayerPlotCommand.class differ diff --git a/build/classes/java/main/fr/gravencyg/commands/player/PlayerUUIDCommand.class b/build/classes/java/main/fr/gravencyg/commands/player/PlayerUUIDCommand.class new file mode 100644 index 0000000..b30d8bc Binary files /dev/null and b/build/classes/java/main/fr/gravencyg/commands/player/PlayerUUIDCommand.class differ diff --git a/build/classes/java/main/fr/gravencyg/commands/player/PlayerWorldEditCommand.class b/build/classes/java/main/fr/gravencyg/commands/player/PlayerWorldEditCommand.class new file mode 100644 index 0000000..bacc1e2 Binary files /dev/null and b/build/classes/java/main/fr/gravencyg/commands/player/PlayerWorldEditCommand.class differ diff --git a/build/classes/java/main/fr/gravencyg/commands/player/ShortcutGameNameCommand.class b/build/classes/java/main/fr/gravencyg/commands/player/ShortcutGameNameCommand.class new file mode 100644 index 0000000..94565fb Binary files /dev/null and b/build/classes/java/main/fr/gravencyg/commands/player/ShortcutGameNameCommand.class differ diff --git a/build/classes/java/main/fr/gravencyg/commands/player/ShortcutOptionCommand.class b/build/classes/java/main/fr/gravencyg/commands/player/ShortcutOptionCommand.class new file mode 100644 index 0000000..ff49576 Binary files /dev/null and b/build/classes/java/main/fr/gravencyg/commands/player/ShortcutOptionCommand.class differ diff --git a/build/classes/java/main/fr/gravencyg/commands/player/ShortcutSetCodeCommand.class b/build/classes/java/main/fr/gravencyg/commands/player/ShortcutSetCodeCommand.class new file mode 100644 index 0000000..46ebf67 Binary files /dev/null and b/build/classes/java/main/fr/gravencyg/commands/player/ShortcutSetCodeCommand.class differ diff --git a/build/classes/java/main/fr/gravencyg/commands/player/ShortcutSetSpawnCommand.class b/build/classes/java/main/fr/gravencyg/commands/player/ShortcutSetSpawnCommand.class new file mode 100644 index 0000000..cb470ef Binary files /dev/null and b/build/classes/java/main/fr/gravencyg/commands/player/ShortcutSetSpawnCommand.class differ diff --git a/build/classes/java/main/fr/gravencyg/commands/shortcut/ShopPremiumCommand.class b/build/classes/java/main/fr/gravencyg/commands/shortcut/ShopPremiumCommand.class new file mode 100644 index 0000000..19d4247 Binary files /dev/null and b/build/classes/java/main/fr/gravencyg/commands/shortcut/ShopPremiumCommand.class differ diff --git a/build/classes/java/main/fr/gravencyg/game/CYGame.class b/build/classes/java/main/fr/gravencyg/game/CYGame.class new file mode 100644 index 0000000..32fac5f Binary files /dev/null and b/build/classes/java/main/fr/gravencyg/game/CYGame.class differ diff --git a/build/classes/java/main/fr/gravencyg/game/CYGameManager.class b/build/classes/java/main/fr/gravencyg/game/CYGameManager.class new file mode 100644 index 0000000..b04939c Binary files /dev/null and b/build/classes/java/main/fr/gravencyg/game/CYGameManager.class differ diff --git a/build/classes/java/main/fr/gravencyg/game/CYGameState.class b/build/classes/java/main/fr/gravencyg/game/CYGameState.class new file mode 100644 index 0000000..72fad37 Binary files /dev/null and b/build/classes/java/main/fr/gravencyg/game/CYGameState.class differ diff --git a/build/classes/java/main/fr/gravencyg/items/Armor.class b/build/classes/java/main/fr/gravencyg/items/Armor.class new file mode 100644 index 0000000..ee4ac41 Binary files /dev/null and b/build/classes/java/main/fr/gravencyg/items/Armor.class differ diff --git a/build/classes/java/main/fr/gravencyg/items/ArmorManager$1.class b/build/classes/java/main/fr/gravencyg/items/ArmorManager$1.class new file mode 100644 index 0000000..7597458 Binary files /dev/null and b/build/classes/java/main/fr/gravencyg/items/ArmorManager$1.class differ diff --git a/build/classes/java/main/fr/gravencyg/items/ArmorManager.class b/build/classes/java/main/fr/gravencyg/items/ArmorManager.class new file mode 100644 index 0000000..55d18f1 Binary files /dev/null and b/build/classes/java/main/fr/gravencyg/items/ArmorManager.class differ diff --git a/build/classes/java/main/fr/gravencyg/items/ItemBuilder.class b/build/classes/java/main/fr/gravencyg/items/ItemBuilder.class new file mode 100644 index 0000000..8ec9f4a Binary files /dev/null and b/build/classes/java/main/fr/gravencyg/items/ItemBuilder.class differ diff --git a/build/classes/java/main/fr/gravencyg/listeners/BlockListener.class b/build/classes/java/main/fr/gravencyg/listeners/BlockListener.class new file mode 100644 index 0000000..414da1e Binary files /dev/null and b/build/classes/java/main/fr/gravencyg/listeners/BlockListener.class differ diff --git a/build/classes/java/main/fr/gravencyg/listeners/ChatListener.class b/build/classes/java/main/fr/gravencyg/listeners/ChatListener.class new file mode 100644 index 0000000..fe16cad Binary files /dev/null and b/build/classes/java/main/fr/gravencyg/listeners/ChatListener.class differ diff --git a/build/classes/java/main/fr/gravencyg/listeners/PlayerListener.class b/build/classes/java/main/fr/gravencyg/listeners/PlayerListener.class new file mode 100644 index 0000000..96fa42d Binary files /dev/null and b/build/classes/java/main/fr/gravencyg/listeners/PlayerListener.class differ diff --git a/build/classes/java/main/fr/gravencyg/listeners/WorldListener.class b/build/classes/java/main/fr/gravencyg/listeners/WorldListener.class new file mode 100644 index 0000000..3e59b6b Binary files /dev/null and b/build/classes/java/main/fr/gravencyg/listeners/WorldListener.class differ diff --git a/build/classes/java/main/fr/gravencyg/manager/CYGCompilerManager.class b/build/classes/java/main/fr/gravencyg/manager/CYGCompilerManager.class new file mode 100644 index 0000000..9ed9602 Binary files /dev/null and b/build/classes/java/main/fr/gravencyg/manager/CYGCompilerManager.class differ diff --git a/build/classes/java/main/fr/gravencyg/manager/CYGDataManager.class b/build/classes/java/main/fr/gravencyg/manager/CYGDataManager.class new file mode 100644 index 0000000..f9b637d Binary files /dev/null and b/build/classes/java/main/fr/gravencyg/manager/CYGDataManager.class differ diff --git a/build/classes/java/main/fr/gravencyg/manager/CYGHologramManager.class b/build/classes/java/main/fr/gravencyg/manager/CYGHologramManager.class new file mode 100644 index 0000000..e432ace Binary files /dev/null and b/build/classes/java/main/fr/gravencyg/manager/CYGHologramManager.class differ diff --git a/build/classes/java/main/fr/gravencyg/manager/CYGPlotManager.class b/build/classes/java/main/fr/gravencyg/manager/CYGPlotManager.class new file mode 100644 index 0000000..6a5f86e Binary files /dev/null and b/build/classes/java/main/fr/gravencyg/manager/CYGPlotManager.class differ diff --git a/build/classes/java/main/fr/gravencyg/manager/CYGWorleditManager.class b/build/classes/java/main/fr/gravencyg/manager/CYGWorleditManager.class new file mode 100644 index 0000000..d4537ff Binary files /dev/null and b/build/classes/java/main/fr/gravencyg/manager/CYGWorleditManager.class differ diff --git a/build/classes/java/main/fr/gravencyg/menus/CustomMenuManager.class b/build/classes/java/main/fr/gravencyg/menus/CustomMenuManager.class new file mode 100644 index 0000000..62c5e6e Binary files /dev/null and b/build/classes/java/main/fr/gravencyg/menus/CustomMenuManager.class differ diff --git a/build/classes/java/main/fr/gravencyg/menus/all/ActionMenu.class b/build/classes/java/main/fr/gravencyg/menus/all/ActionMenu.class new file mode 100644 index 0000000..439d98f Binary files /dev/null and b/build/classes/java/main/fr/gravencyg/menus/all/ActionMenu.class differ diff --git a/build/classes/java/main/fr/gravencyg/menus/all/EventMenu.class b/build/classes/java/main/fr/gravencyg/menus/all/EventMenu.class new file mode 100644 index 0000000..966d406 Binary files /dev/null and b/build/classes/java/main/fr/gravencyg/menus/all/EventMenu.class differ diff --git a/build/classes/java/main/fr/gravencyg/menus/all/GameModeMenu$1.class b/build/classes/java/main/fr/gravencyg/menus/all/GameModeMenu$1.class new file mode 100644 index 0000000..ca896ce Binary files /dev/null and b/build/classes/java/main/fr/gravencyg/menus/all/GameModeMenu$1.class differ diff --git a/build/classes/java/main/fr/gravencyg/menus/all/GameModeMenu.class b/build/classes/java/main/fr/gravencyg/menus/all/GameModeMenu.class new file mode 100644 index 0000000..d2f2843 Binary files /dev/null and b/build/classes/java/main/fr/gravencyg/menus/all/GameModeMenu.class differ diff --git a/build/classes/java/main/fr/gravencyg/menus/all/PlayMenu.class b/build/classes/java/main/fr/gravencyg/menus/all/PlayMenu.class new file mode 100644 index 0000000..ebd5e75 Binary files /dev/null and b/build/classes/java/main/fr/gravencyg/menus/all/PlayMenu.class differ diff --git a/build/classes/java/main/fr/gravencyg/menus/all/UpgradeMenu.class b/build/classes/java/main/fr/gravencyg/menus/all/UpgradeMenu.class new file mode 100644 index 0000000..d2f7d02 Binary files /dev/null and b/build/classes/java/main/fr/gravencyg/menus/all/UpgradeMenu.class differ diff --git a/build/classes/java/main/fr/gravencyg/menus/core/CustomMenu.class b/build/classes/java/main/fr/gravencyg/menus/core/CustomMenu.class new file mode 100644 index 0000000..dbd4ab0 Binary files /dev/null and b/build/classes/java/main/fr/gravencyg/menus/core/CustomMenu.class differ diff --git a/build/classes/java/main/fr/gravencyg/menus/core/CustomMenuListener.class b/build/classes/java/main/fr/gravencyg/menus/core/CustomMenuListener.class new file mode 100644 index 0000000..374d6a9 Binary files /dev/null and b/build/classes/java/main/fr/gravencyg/menus/core/CustomMenuListener.class differ diff --git a/build/classes/java/main/fr/gravencyg/menus/locations/LocationMenu.class b/build/classes/java/main/fr/gravencyg/menus/locations/LocationMenu.class new file mode 100644 index 0000000..322d39d Binary files /dev/null and b/build/classes/java/main/fr/gravencyg/menus/locations/LocationMenu.class differ diff --git a/build/classes/java/main/fr/gravencyg/menus/locations/LocationSelectMenu.class b/build/classes/java/main/fr/gravencyg/menus/locations/LocationSelectMenu.class new file mode 100644 index 0000000..27cbafc Binary files /dev/null and b/build/classes/java/main/fr/gravencyg/menus/locations/LocationSelectMenu.class differ diff --git a/build/classes/java/main/fr/gravencyg/menus/messages/MessageMenu.class b/build/classes/java/main/fr/gravencyg/menus/messages/MessageMenu.class new file mode 100644 index 0000000..16bfb80 Binary files /dev/null and b/build/classes/java/main/fr/gravencyg/menus/messages/MessageMenu.class differ diff --git a/build/classes/java/main/fr/gravencyg/menus/messages/MessageSelectMenu.class b/build/classes/java/main/fr/gravencyg/menus/messages/MessageSelectMenu.class new file mode 100644 index 0000000..8201c9e Binary files /dev/null and b/build/classes/java/main/fr/gravencyg/menus/messages/MessageSelectMenu.class differ diff --git a/build/classes/java/main/fr/gravencyg/menus/options/OptionAutostartMenu.class b/build/classes/java/main/fr/gravencyg/menus/options/OptionAutostartMenu.class new file mode 100644 index 0000000..6e53a04 Binary files /dev/null and b/build/classes/java/main/fr/gravencyg/menus/options/OptionAutostartMenu.class differ diff --git a/build/classes/java/main/fr/gravencyg/menus/options/OptionLifeMenu.class b/build/classes/java/main/fr/gravencyg/menus/options/OptionLifeMenu.class new file mode 100644 index 0000000..792cefc Binary files /dev/null and b/build/classes/java/main/fr/gravencyg/menus/options/OptionLifeMenu.class differ diff --git a/build/classes/java/main/fr/gravencyg/menus/options/OptionMaxPlayersMenu.class b/build/classes/java/main/fr/gravencyg/menus/options/OptionMaxPlayersMenu.class new file mode 100644 index 0000000..fe3cf3f Binary files /dev/null and b/build/classes/java/main/fr/gravencyg/menus/options/OptionMaxPlayersMenu.class differ diff --git a/build/classes/java/main/fr/gravencyg/menus/options/OptionMenu$1.class b/build/classes/java/main/fr/gravencyg/menus/options/OptionMenu$1.class new file mode 100644 index 0000000..02ccc81 Binary files /dev/null and b/build/classes/java/main/fr/gravencyg/menus/options/OptionMenu$1.class differ diff --git a/build/classes/java/main/fr/gravencyg/menus/options/OptionMenu.class b/build/classes/java/main/fr/gravencyg/menus/options/OptionMenu.class new file mode 100644 index 0000000..0b7887a Binary files /dev/null and b/build/classes/java/main/fr/gravencyg/menus/options/OptionMenu.class differ diff --git a/build/classes/java/main/fr/gravencyg/menus/options/OptionStartingTimeMenu.class b/build/classes/java/main/fr/gravencyg/menus/options/OptionStartingTimeMenu.class new file mode 100644 index 0000000..697cb35 Binary files /dev/null and b/build/classes/java/main/fr/gravencyg/menus/options/OptionStartingTimeMenu.class differ diff --git a/build/classes/java/main/fr/gravencyg/menus/options/OptionWhitelistMenu.class b/build/classes/java/main/fr/gravencyg/menus/options/OptionWhitelistMenu.class new file mode 100644 index 0000000..d12a02a Binary files /dev/null and b/build/classes/java/main/fr/gravencyg/menus/options/OptionWhitelistMenu.class differ diff --git a/build/classes/java/main/fr/gravencyg/menus/plot/PlayPlayerMenu.class b/build/classes/java/main/fr/gravencyg/menus/plot/PlayPlayerMenu.class new file mode 100644 index 0000000..d108de3 Binary files /dev/null and b/build/classes/java/main/fr/gravencyg/menus/plot/PlayPlayerMenu.class differ diff --git a/build/classes/java/main/fr/gravencyg/menus/plot/PlotManageMenu$1.class b/build/classes/java/main/fr/gravencyg/menus/plot/PlotManageMenu$1.class new file mode 100644 index 0000000..8636275 Binary files /dev/null and b/build/classes/java/main/fr/gravencyg/menus/plot/PlotManageMenu$1.class differ diff --git a/build/classes/java/main/fr/gravencyg/menus/plot/PlotManageMenu.class b/build/classes/java/main/fr/gravencyg/menus/plot/PlotManageMenu.class new file mode 100644 index 0000000..4c0ec82 Binary files /dev/null and b/build/classes/java/main/fr/gravencyg/menus/plot/PlotManageMenu.class differ diff --git a/build/classes/java/main/fr/gravencyg/menus/plot/PlotMenu.class b/build/classes/java/main/fr/gravencyg/menus/plot/PlotMenu.class new file mode 100644 index 0000000..0484127 Binary files /dev/null and b/build/classes/java/main/fr/gravencyg/menus/plot/PlotMenu.class differ diff --git a/build/classes/java/main/fr/gravencyg/menus/variables/VariableMenu.class b/build/classes/java/main/fr/gravencyg/menus/variables/VariableMenu.class new file mode 100644 index 0000000..b459159 Binary files /dev/null and b/build/classes/java/main/fr/gravencyg/menus/variables/VariableMenu.class differ diff --git a/build/classes/java/main/fr/gravencyg/menus/variables/VariableSelectMenu.class b/build/classes/java/main/fr/gravencyg/menus/variables/VariableSelectMenu.class new file mode 100644 index 0000000..fd4b26c Binary files /dev/null and b/build/classes/java/main/fr/gravencyg/menus/variables/VariableSelectMenu.class differ diff --git a/build/classes/java/main/fr/gravencyg/model/ActionProcess.class b/build/classes/java/main/fr/gravencyg/model/ActionProcess.class new file mode 100644 index 0000000..1eca11d Binary files /dev/null and b/build/classes/java/main/fr/gravencyg/model/ActionProcess.class differ diff --git a/build/classes/java/main/fr/gravencyg/model/CYGameMode.class b/build/classes/java/main/fr/gravencyg/model/CYGameMode.class new file mode 100644 index 0000000..0a07963 Binary files /dev/null and b/build/classes/java/main/fr/gravencyg/model/CYGameMode.class differ diff --git a/build/classes/java/main/fr/gravencyg/model/GameConfig.class b/build/classes/java/main/fr/gravencyg/model/GameConfig.class new file mode 100644 index 0000000..f8b9b8d Binary files /dev/null and b/build/classes/java/main/fr/gravencyg/model/GameConfig.class differ diff --git a/build/classes/java/main/fr/gravencyg/model/MaterialAndData.class b/build/classes/java/main/fr/gravencyg/model/MaterialAndData.class new file mode 100644 index 0000000..16bfc1b Binary files /dev/null and b/build/classes/java/main/fr/gravencyg/model/MaterialAndData.class differ diff --git a/build/classes/java/main/fr/gravencyg/model/Plot.class b/build/classes/java/main/fr/gravencyg/model/Plot.class new file mode 100644 index 0000000..06ac571 Binary files /dev/null and b/build/classes/java/main/fr/gravencyg/model/Plot.class differ diff --git a/build/classes/java/main/fr/gravencyg/model/Storage.class b/build/classes/java/main/fr/gravencyg/model/Storage.class new file mode 100644 index 0000000..91d8317 Binary files /dev/null and b/build/classes/java/main/fr/gravencyg/model/Storage.class differ diff --git a/build/classes/java/main/fr/gravencyg/model/VerifyGameConfig.class b/build/classes/java/main/fr/gravencyg/model/VerifyGameConfig.class new file mode 100644 index 0000000..4e702b4 Binary files /dev/null and b/build/classes/java/main/fr/gravencyg/model/VerifyGameConfig.class differ diff --git a/build/classes/java/main/fr/gravencyg/npcs/NPC.class b/build/classes/java/main/fr/gravencyg/npcs/NPC.class new file mode 100644 index 0000000..ebcceba Binary files /dev/null and b/build/classes/java/main/fr/gravencyg/npcs/NPC.class differ diff --git a/build/classes/java/main/fr/gravencyg/npcs/NPCClickListener.class b/build/classes/java/main/fr/gravencyg/npcs/NPCClickListener.class new file mode 100644 index 0000000..1d0d8af Binary files /dev/null and b/build/classes/java/main/fr/gravencyg/npcs/NPCClickListener.class differ diff --git a/build/classes/java/main/fr/gravencyg/npcs/NPCManager.class b/build/classes/java/main/fr/gravencyg/npcs/NPCManager.class new file mode 100644 index 0000000..72c873f Binary files /dev/null and b/build/classes/java/main/fr/gravencyg/npcs/NPCManager.class differ diff --git a/build/classes/java/main/fr/gravencyg/npcs/all/DevNPC.class b/build/classes/java/main/fr/gravencyg/npcs/all/DevNPC.class new file mode 100644 index 0000000..80cf4e5 Binary files /dev/null and b/build/classes/java/main/fr/gravencyg/npcs/all/DevNPC.class differ diff --git a/build/classes/java/main/fr/gravencyg/npcs/all/PlayNPC.class b/build/classes/java/main/fr/gravencyg/npcs/all/PlayNPC.class new file mode 100644 index 0000000..2ca541f Binary files /dev/null and b/build/classes/java/main/fr/gravencyg/npcs/all/PlayNPC.class differ diff --git a/build/classes/java/main/fr/gravencyg/npcs/all/UpgradeNPC.class b/build/classes/java/main/fr/gravencyg/npcs/all/UpgradeNPC.class new file mode 100644 index 0000000..8d24697 Binary files /dev/null and b/build/classes/java/main/fr/gravencyg/npcs/all/UpgradeNPC.class differ diff --git a/build/classes/java/main/fr/gravencyg/schedule/CYGExecutionTask.class b/build/classes/java/main/fr/gravencyg/schedule/CYGExecutionTask.class new file mode 100644 index 0000000..e8bc901 Binary files /dev/null and b/build/classes/java/main/fr/gravencyg/schedule/CYGExecutionTask.class differ diff --git a/build/classes/java/main/fr/gravencyg/schedule/CYGGameCycle.class b/build/classes/java/main/fr/gravencyg/schedule/CYGGameCycle.class new file mode 100644 index 0000000..4d15f9a Binary files /dev/null and b/build/classes/java/main/fr/gravencyg/schedule/CYGGameCycle.class differ diff --git a/build/classes/java/main/fr/gravencyg/scoreboards/ScoreboardManager.class b/build/classes/java/main/fr/gravencyg/scoreboards/ScoreboardManager.class new file mode 100644 index 0000000..4b862e4 Binary files /dev/null and b/build/classes/java/main/fr/gravencyg/scoreboards/ScoreboardManager.class differ diff --git a/build/classes/java/main/fr/gravencyg/scoreboards/ScoreboardSign$1.class b/build/classes/java/main/fr/gravencyg/scoreboards/ScoreboardSign$1.class new file mode 100644 index 0000000..bd1abe3 Binary files /dev/null and b/build/classes/java/main/fr/gravencyg/scoreboards/ScoreboardSign$1.class differ diff --git a/build/classes/java/main/fr/gravencyg/scoreboards/ScoreboardSign$VirtualTeam.class b/build/classes/java/main/fr/gravencyg/scoreboards/ScoreboardSign$VirtualTeam.class new file mode 100644 index 0000000..2545997 Binary files /dev/null and b/build/classes/java/main/fr/gravencyg/scoreboards/ScoreboardSign$VirtualTeam.class differ diff --git a/build/classes/java/main/fr/gravencyg/scoreboards/ScoreboardSign.class b/build/classes/java/main/fr/gravencyg/scoreboards/ScoreboardSign.class new file mode 100644 index 0000000..ed7f8ac Binary files /dev/null and b/build/classes/java/main/fr/gravencyg/scoreboards/ScoreboardSign.class differ diff --git a/build/classes/java/main/fr/gravencyg/utils/CEvent.class b/build/classes/java/main/fr/gravencyg/utils/CEvent.class new file mode 100644 index 0000000..e65c8e3 Binary files /dev/null and b/build/classes/java/main/fr/gravencyg/utils/CEvent.class differ diff --git a/build/classes/java/main/fr/gravencyg/utils/CLevel.class b/build/classes/java/main/fr/gravencyg/utils/CLevel.class new file mode 100644 index 0000000..25a8728 Binary files /dev/null and b/build/classes/java/main/fr/gravencyg/utils/CLevel.class differ diff --git a/build/classes/java/main/fr/gravencyg/utils/CRank.class b/build/classes/java/main/fr/gravencyg/utils/CRank.class new file mode 100644 index 0000000..6d9f0de Binary files /dev/null and b/build/classes/java/main/fr/gravencyg/utils/CRank.class differ diff --git a/build/classes/java/main/fr/gravencyg/utils/LocationUtils.class b/build/classes/java/main/fr/gravencyg/utils/LocationUtils.class new file mode 100644 index 0000000..c7a80af Binary files /dev/null and b/build/classes/java/main/fr/gravencyg/utils/LocationUtils.class differ diff --git a/build/classes/java/main/fr/gravencyg/utils/PlotSize.class b/build/classes/java/main/fr/gravencyg/utils/PlotSize.class new file mode 100644 index 0000000..df3dcbe Binary files /dev/null and b/build/classes/java/main/fr/gravencyg/utils/PlotSize.class differ diff --git a/build/libs/CYG-all.jar b/build/libs/CYG-all.jar new file mode 100644 index 0000000..648063f Binary files /dev/null and b/build/libs/CYG-all.jar differ diff --git a/build/resources/main/plugin.yml b/build/resources/main/plugin.yml new file mode 100644 index 0000000..6788414 --- /dev/null +++ b/build/resources/main/plugin.yml @@ -0,0 +1,88 @@ +name: CYG +version: 0.0.7 +api-version: 1.13 +author: Graven +main: fr.gravencyg.CYG +commands: + plot: + description: Se teleporter vers sa parcelle + aliases: [pt] + locations: + aliases: [loc] + ev: + description: Obtenir un bloc d'evenement + actions: + description: Ouvrir le menu des actions + aliases: [ac, pa] + options: + aliases: [po] + setspawn: + setcode: + if: + description: Obtenir un bloc de condition + hub: + description: Se teleporter au Hub + messages: + description: Ouvrir le menu de gestion des messages + aliases: [msg] + play: + description: Jouer au jeu d'un joueur en ligne + aliases: [p] + pa: + description: Plot actions + po: + description: Plot options + pc: + description: Plot code + ptp: + description: Plot tp + rank: + description: rank + permission: rank.change + verifygame: + description: verify + fly: + description: Activer le vol doiseau + friend: + description: Invitez des amis sur votre parcelle + mute: + description: Mute un joueur + unmute: + description: Demute un joueur + kick: + description: Ejecte un joueur du serveur + freeze: + description: Gele un joueur du serveur + uuid: + description: Donne luuid du joueur + leave: + description: Quitter un jeu + barriere: + description: Barriere + we: + description: Mini worldedit pour les joueurs + ping: + description: Ping + head: + description: Donne la tete d'un joueur + gamemode: + description: Changement de gamemode + gamename: + refreshlevel: + permission: perm.full + forcelevel: + permission: perm.full + premium: + permission: shop.premium + discord: + description: Discord lien + shop: + description: Shop lien + twitter: + description: Twitter lien + hat: + description: Change hat + npc: + description: Gérer les personnages on joueurs + updateholo: + permission: update.holo \ No newline at end of file diff --git a/build/tmp/compileJava/previous-compilation-data.bin b/build/tmp/compileJava/previous-compilation-data.bin new file mode 100644 index 0000000..e222f5d Binary files /dev/null and b/build/tmp/compileJava/previous-compilation-data.bin differ diff --git a/build/tmp/shadowJar/MANIFEST.MF b/build/tmp/shadowJar/MANIFEST.MF new file mode 100644 index 0000000..59499bc --- /dev/null +++ b/build/tmp/shadowJar/MANIFEST.MF @@ -0,0 +1,2 @@ +Manifest-Version: 1.0 + diff --git a/gradle.properties b/gradle.properties new file mode 100644 index 0000000..4d252d0 --- /dev/null +++ b/gradle.properties @@ -0,0 +1 @@ +destDir = D:\\Serveur MC\\plugins \ No newline at end of file diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar new file mode 100644 index 0000000..7454180 Binary files /dev/null and b/gradle/wrapper/gradle-wrapper.jar differ diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties new file mode 100644 index 0000000..69a9715 --- /dev/null +++ b/gradle/wrapper/gradle-wrapper.properties @@ -0,0 +1,5 @@ +distributionBase=GRADLE_USER_HOME +distributionPath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-7.1-bin.zip +zipStoreBase=GRADLE_USER_HOME +zipStorePath=wrapper/dists diff --git a/gradlew b/gradlew new file mode 100644 index 0000000..744e882 --- /dev/null +++ b/gradlew @@ -0,0 +1,185 @@ +#!/usr/bin/env sh + +# +# Copyright 2015 the original author or authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +############################################################################## +## +## Gradle start up script for UN*X +## +############################################################################## + +# Attempt to set APP_HOME +# Resolve links: $0 may be a link +PRG="$0" +# Need this for relative symlinks. +while [ -h "$PRG" ] ; do + ls=`ls -ld "$PRG"` + link=`expr "$ls" : '.*-> \(.*\)$'` + if expr "$link" : '/.*' > /dev/null; then + PRG="$link" + else + PRG=`dirname "$PRG"`"/$link" + fi +done +SAVED="`pwd`" +cd "`dirname \"$PRG\"`/" >/dev/null +APP_HOME="`pwd -P`" +cd "$SAVED" >/dev/null + +APP_NAME="Gradle" +APP_BASE_NAME=`basename "$0"` + +# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' + +# Use the maximum available, or set MAX_FD != -1 to use that value. +MAX_FD="maximum" + +warn () { + echo "$*" +} + +die () { + echo + echo "$*" + echo + exit 1 +} + +# OS specific support (must be 'true' or 'false'). +cygwin=false +msys=false +darwin=false +nonstop=false +case "`uname`" in + CYGWIN* ) + cygwin=true + ;; + Darwin* ) + darwin=true + ;; + MSYS* | MINGW* ) + msys=true + ;; + NONSTOP* ) + nonstop=true + ;; +esac + +CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar + + +# Determine the Java command to use to start the JVM. +if [ -n "$JAVA_HOME" ] ; then + if [ -x "$JAVA_HOME/jre/sh/java" ] ; then + # IBM's JDK on AIX uses strange locations for the executables + JAVACMD="$JAVA_HOME/jre/sh/java" + else + JAVACMD="$JAVA_HOME/bin/java" + fi + if [ ! -x "$JAVACMD" ] ; then + die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." + fi +else + JAVACMD="java" + which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." +fi + +# Increase the maximum file descriptors if we can. +if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then + MAX_FD_LIMIT=`ulimit -H -n` + if [ $? -eq 0 ] ; then + if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then + MAX_FD="$MAX_FD_LIMIT" + fi + ulimit -n $MAX_FD + if [ $? -ne 0 ] ; then + warn "Could not set maximum file descriptor limit: $MAX_FD" + fi + else + warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" + fi +fi + +# For Darwin, add options to specify how the application appears in the dock +if $darwin; then + GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" +fi + +# For Cygwin or MSYS, switch paths to Windows format before running java +if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then + APP_HOME=`cygpath --path --mixed "$APP_HOME"` + CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` + + JAVACMD=`cygpath --unix "$JAVACMD"` + + # We build the pattern for arguments to be converted via cygpath + ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` + SEP="" + for dir in $ROOTDIRSRAW ; do + ROOTDIRS="$ROOTDIRS$SEP$dir" + SEP="|" + done + OURCYGPATTERN="(^($ROOTDIRS))" + # Add a user-defined pattern to the cygpath arguments + if [ "$GRADLE_CYGPATTERN" != "" ] ; then + OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" + fi + # Now convert the arguments - kludge to limit ourselves to /bin/sh + i=0 + for arg in "$@" ; do + CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` + CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option + + if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition + eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` + else + eval `echo args$i`="\"$arg\"" + fi + i=`expr $i + 1` + done + case $i in + 0) set -- ;; + 1) set -- "$args0" ;; + 2) set -- "$args0" "$args1" ;; + 3) set -- "$args0" "$args1" "$args2" ;; + 4) set -- "$args0" "$args1" "$args2" "$args3" ;; + 5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; + 6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; + 7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; + 8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; + 9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; + esac +fi + +# Escape application args +save () { + for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done + echo " " +} +APP_ARGS=`save "$@"` + +# Collect all arguments for the java command, following the shell quoting and substitution rules +eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" + +exec "$JAVACMD" "$@" diff --git a/gradlew.bat b/gradlew.bat new file mode 100644 index 0000000..107acd3 --- /dev/null +++ b/gradlew.bat @@ -0,0 +1,89 @@ +@rem +@rem Copyright 2015 the original author or authors. +@rem +@rem Licensed under the Apache License, Version 2.0 (the "License"); +@rem you may not use this file except in compliance with the License. +@rem You may obtain a copy of the License at +@rem +@rem https://www.apache.org/licenses/LICENSE-2.0 +@rem +@rem Unless required by applicable law or agreed to in writing, software +@rem distributed under the License is distributed on an "AS IS" BASIS, +@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +@rem See the License for the specific language governing permissions and +@rem limitations under the License. +@rem + +@if "%DEBUG%" == "" @echo off +@rem ########################################################################## +@rem +@rem Gradle startup script for Windows +@rem +@rem ########################################################################## + +@rem Set local scope for the variables with windows NT shell +if "%OS%"=="Windows_NT" setlocal + +set DIRNAME=%~dp0 +if "%DIRNAME%" == "" set DIRNAME=. +set APP_BASE_NAME=%~n0 +set APP_HOME=%DIRNAME% + +@rem Resolve any "." and ".." in APP_HOME to make it shorter. +for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi + +@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" + +@rem Find java.exe +if defined JAVA_HOME goto findJavaFromJavaHome + +set JAVA_EXE=java.exe +%JAVA_EXE% -version >NUL 2>&1 +if "%ERRORLEVEL%" == "0" goto execute + +echo. +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:findJavaFromJavaHome +set JAVA_HOME=%JAVA_HOME:"=% +set JAVA_EXE=%JAVA_HOME%/bin/java.exe + +if exist "%JAVA_EXE%" goto execute + +echo. +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:execute +@rem Setup the command line + +set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar + + +@rem Execute Gradle +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %* + +:end +@rem End local scope for the variables with windows NT shell +if "%ERRORLEVEL%"=="0" goto mainEnd + +:fail +rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of +rem the _cmd.exe /c_ return code! +if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 +exit /b 1 + +:mainEnd +if "%OS%"=="Windows_NT" endlocal + +:omega diff --git a/local.properties b/local.properties new file mode 100644 index 0000000..af117f8 --- /dev/null +++ b/local.properties @@ -0,0 +1,8 @@ +## This file must *NOT* be checked into Version Control Systems, +# as it contains information specific to your local configuration. +# +# Location of the SDK. This is only used by Gradle. +# For customization when using a Version Control System, please read the +# header note. +#Mon Jun 13 17:38:46 CEST 2022 +sdk.dir=/Users/killian/Library/Android/sdk diff --git a/out/production/CYG/fr/gravencyg/CYG.class b/out/production/CYG/fr/gravencyg/CYG.class new file mode 100644 index 0000000..211c466 Binary files /dev/null and b/out/production/CYG/fr/gravencyg/CYG.class differ diff --git a/out/production/CYG/fr/gravencyg/actions/Action.class b/out/production/CYG/fr/gravencyg/actions/Action.class new file mode 100644 index 0000000..78ac4e4 Binary files /dev/null and b/out/production/CYG/fr/gravencyg/actions/Action.class differ diff --git a/out/production/CYG/fr/gravencyg/actions/ActionRegisters.class b/out/production/CYG/fr/gravencyg/actions/ActionRegisters.class new file mode 100644 index 0000000..5a00c61 Binary files /dev/null and b/out/production/CYG/fr/gravencyg/actions/ActionRegisters.class differ diff --git a/out/production/CYG/fr/gravencyg/actions/basic/ChangeGameModeAction.class b/out/production/CYG/fr/gravencyg/actions/basic/ChangeGameModeAction.class new file mode 100644 index 0000000..69ba484 Binary files /dev/null and b/out/production/CYG/fr/gravencyg/actions/basic/ChangeGameModeAction.class differ diff --git a/out/production/CYG/fr/gravencyg/actions/basic/ConditionAction.class b/out/production/CYG/fr/gravencyg/actions/basic/ConditionAction.class new file mode 100644 index 0000000..d9cc3ca Binary files /dev/null and b/out/production/CYG/fr/gravencyg/actions/basic/ConditionAction.class differ diff --git a/out/production/CYG/fr/gravencyg/actions/basic/DropItemAction.class b/out/production/CYG/fr/gravencyg/actions/basic/DropItemAction.class new file mode 100644 index 0000000..40c55c8 Binary files /dev/null and b/out/production/CYG/fr/gravencyg/actions/basic/DropItemAction.class differ diff --git a/out/production/CYG/fr/gravencyg/actions/basic/KillMonsterAction.class b/out/production/CYG/fr/gravencyg/actions/basic/KillMonsterAction.class new file mode 100644 index 0000000..0eacacd Binary files /dev/null and b/out/production/CYG/fr/gravencyg/actions/basic/KillMonsterAction.class differ diff --git a/out/production/CYG/fr/gravencyg/actions/basic/MonsterSpawnAction.class b/out/production/CYG/fr/gravencyg/actions/basic/MonsterSpawnAction.class new file mode 100644 index 0000000..aabbcf3 Binary files /dev/null and b/out/production/CYG/fr/gravencyg/actions/basic/MonsterSpawnAction.class differ diff --git a/out/production/CYG/fr/gravencyg/actions/basic/MusicAction.class b/out/production/CYG/fr/gravencyg/actions/basic/MusicAction.class new file mode 100644 index 0000000..7686bdd Binary files /dev/null and b/out/production/CYG/fr/gravencyg/actions/basic/MusicAction.class differ diff --git a/out/production/CYG/fr/gravencyg/actions/basic/PassAction.class b/out/production/CYG/fr/gravencyg/actions/basic/PassAction.class new file mode 100644 index 0000000..eca02eb Binary files /dev/null and b/out/production/CYG/fr/gravencyg/actions/basic/PassAction.class differ diff --git a/out/production/CYG/fr/gravencyg/actions/basic/RandomAction.class b/out/production/CYG/fr/gravencyg/actions/basic/RandomAction.class new file mode 100644 index 0000000..cbed87c Binary files /dev/null and b/out/production/CYG/fr/gravencyg/actions/basic/RandomAction.class differ diff --git a/out/production/CYG/fr/gravencyg/actions/basic/RestorePlayer.class b/out/production/CYG/fr/gravencyg/actions/basic/RestorePlayer.class new file mode 100644 index 0000000..8f5dd92 Binary files /dev/null and b/out/production/CYG/fr/gravencyg/actions/basic/RestorePlayer.class differ diff --git a/out/production/CYG/fr/gravencyg/actions/basic/TeleportAction.class b/out/production/CYG/fr/gravencyg/actions/basic/TeleportAction.class new file mode 100644 index 0000000..14d9e8f Binary files /dev/null and b/out/production/CYG/fr/gravencyg/actions/basic/TeleportAction.class differ diff --git a/out/production/CYG/fr/gravencyg/actions/block/RegenMapAction.class b/out/production/CYG/fr/gravencyg/actions/block/RegenMapAction.class new file mode 100644 index 0000000..568636e Binary files /dev/null and b/out/production/CYG/fr/gravencyg/actions/block/RegenMapAction.class differ diff --git a/out/production/CYG/fr/gravencyg/actions/block/RemoveBlockAction.class b/out/production/CYG/fr/gravencyg/actions/block/RemoveBlockAction.class new file mode 100644 index 0000000..1f84a86 Binary files /dev/null and b/out/production/CYG/fr/gravencyg/actions/block/RemoveBlockAction.class differ diff --git a/out/production/CYG/fr/gravencyg/actions/block/SetBlockAction.class b/out/production/CYG/fr/gravencyg/actions/block/SetBlockAction.class new file mode 100644 index 0000000..425005e Binary files /dev/null and b/out/production/CYG/fr/gravencyg/actions/block/SetBlockAction.class differ diff --git a/out/production/CYG/fr/gravencyg/actions/game/EliminateAction.class b/out/production/CYG/fr/gravencyg/actions/game/EliminateAction.class new file mode 100644 index 0000000..d3f4a42 Binary files /dev/null and b/out/production/CYG/fr/gravencyg/actions/game/EliminateAction.class differ diff --git a/out/production/CYG/fr/gravencyg/actions/game/StopGameAction.class b/out/production/CYG/fr/gravencyg/actions/game/StopGameAction.class new file mode 100644 index 0000000..55482c1 Binary files /dev/null and b/out/production/CYG/fr/gravencyg/actions/game/StopGameAction.class differ diff --git a/out/production/CYG/fr/gravencyg/actions/game/WinnerAction.class b/out/production/CYG/fr/gravencyg/actions/game/WinnerAction.class new file mode 100644 index 0000000..4c01fa0 Binary files /dev/null and b/out/production/CYG/fr/gravencyg/actions/game/WinnerAction.class differ diff --git a/out/production/CYG/fr/gravencyg/actions/inventory/ChestAction.class b/out/production/CYG/fr/gravencyg/actions/inventory/ChestAction.class new file mode 100644 index 0000000..a88e824 Binary files /dev/null and b/out/production/CYG/fr/gravencyg/actions/inventory/ChestAction.class differ diff --git a/out/production/CYG/fr/gravencyg/actions/inventory/ClearAction.class b/out/production/CYG/fr/gravencyg/actions/inventory/ClearAction.class new file mode 100644 index 0000000..ee120f1 Binary files /dev/null and b/out/production/CYG/fr/gravencyg/actions/inventory/ClearAction.class differ diff --git a/out/production/CYG/fr/gravencyg/actions/message/BossBarAction.class b/out/production/CYG/fr/gravencyg/actions/message/BossBarAction.class new file mode 100644 index 0000000..19bce55 Binary files /dev/null and b/out/production/CYG/fr/gravencyg/actions/message/BossBarAction.class differ diff --git a/out/production/CYG/fr/gravencyg/actions/message/MessageAction.class b/out/production/CYG/fr/gravencyg/actions/message/MessageAction.class new file mode 100644 index 0000000..363b34e Binary files /dev/null and b/out/production/CYG/fr/gravencyg/actions/message/MessageAction.class differ diff --git a/out/production/CYG/fr/gravencyg/actions/message/ResetBossBarAction.class b/out/production/CYG/fr/gravencyg/actions/message/ResetBossBarAction.class new file mode 100644 index 0000000..c30b99a Binary files /dev/null and b/out/production/CYG/fr/gravencyg/actions/message/ResetBossBarAction.class differ diff --git a/out/production/CYG/fr/gravencyg/actions/message/TitleAction.class b/out/production/CYG/fr/gravencyg/actions/message/TitleAction.class new file mode 100644 index 0000000..19682d6 Binary files /dev/null and b/out/production/CYG/fr/gravencyg/actions/message/TitleAction.class differ diff --git a/out/production/CYG/fr/gravencyg/actions/potion/ClearPotionEffectAction.class b/out/production/CYG/fr/gravencyg/actions/potion/ClearPotionEffectAction.class new file mode 100644 index 0000000..f5457b2 Binary files /dev/null and b/out/production/CYG/fr/gravencyg/actions/potion/ClearPotionEffectAction.class differ diff --git a/out/production/CYG/fr/gravencyg/actions/potion/PotionEffectAction.class b/out/production/CYG/fr/gravencyg/actions/potion/PotionEffectAction.class new file mode 100644 index 0000000..e6ae26a Binary files /dev/null and b/out/production/CYG/fr/gravencyg/actions/potion/PotionEffectAction.class differ diff --git a/out/production/CYG/fr/gravencyg/actions/team/Team.class b/out/production/CYG/fr/gravencyg/actions/team/Team.class new file mode 100644 index 0000000..59f085e Binary files /dev/null and b/out/production/CYG/fr/gravencyg/actions/team/Team.class differ diff --git a/out/production/CYG/fr/gravencyg/actions/team/TeamAction.class b/out/production/CYG/fr/gravencyg/actions/team/TeamAction.class new file mode 100644 index 0000000..0065abf Binary files /dev/null and b/out/production/CYG/fr/gravencyg/actions/team/TeamAction.class differ diff --git a/out/production/CYG/fr/gravencyg/actions/toggle/ToggleBuildAction.class b/out/production/CYG/fr/gravencyg/actions/toggle/ToggleBuildAction.class new file mode 100644 index 0000000..5625779 Binary files /dev/null and b/out/production/CYG/fr/gravencyg/actions/toggle/ToggleBuildAction.class differ diff --git a/out/production/CYG/fr/gravencyg/actions/toggle/ToggleFallDamage.class b/out/production/CYG/fr/gravencyg/actions/toggle/ToggleFallDamage.class new file mode 100644 index 0000000..23b35bc Binary files /dev/null and b/out/production/CYG/fr/gravencyg/actions/toggle/ToggleFallDamage.class differ diff --git a/out/production/CYG/fr/gravencyg/actions/toggle/ToggleFlyAction.class b/out/production/CYG/fr/gravencyg/actions/toggle/ToggleFlyAction.class new file mode 100644 index 0000000..21eacee Binary files /dev/null and b/out/production/CYG/fr/gravencyg/actions/toggle/ToggleFlyAction.class differ diff --git a/out/production/CYG/fr/gravencyg/actions/toggle/ToggleFreezeAction.class b/out/production/CYG/fr/gravencyg/actions/toggle/ToggleFreezeAction.class new file mode 100644 index 0000000..d8319ce Binary files /dev/null and b/out/production/CYG/fr/gravencyg/actions/toggle/ToggleFreezeAction.class differ diff --git a/out/production/CYG/fr/gravencyg/actions/toggle/ToggleGlowAction.class b/out/production/CYG/fr/gravencyg/actions/toggle/ToggleGlowAction.class new file mode 100644 index 0000000..341cb4b Binary files /dev/null and b/out/production/CYG/fr/gravencyg/actions/toggle/ToggleGlowAction.class differ diff --git a/out/production/CYG/fr/gravencyg/actions/toggle/TogglePvPAction.class b/out/production/CYG/fr/gravencyg/actions/toggle/TogglePvPAction.class new file mode 100644 index 0000000..394390d Binary files /dev/null and b/out/production/CYG/fr/gravencyg/actions/toggle/TogglePvPAction.class differ diff --git a/out/production/CYG/fr/gravencyg/actions/waitable/WaitAction.class b/out/production/CYG/fr/gravencyg/actions/waitable/WaitAction.class new file mode 100644 index 0000000..debd00a Binary files /dev/null and b/out/production/CYG/fr/gravencyg/actions/waitable/WaitAction.class differ diff --git a/out/production/CYG/fr/gravencyg/actions/waitable/WaitAction2.class b/out/production/CYG/fr/gravencyg/actions/waitable/WaitAction2.class new file mode 100644 index 0000000..5c10039 Binary files /dev/null and b/out/production/CYG/fr/gravencyg/actions/waitable/WaitAction2.class differ diff --git a/out/production/CYG/fr/gravencyg/commands/AdminForceLevelCommand.class b/out/production/CYG/fr/gravencyg/commands/AdminForceLevelCommand.class new file mode 100644 index 0000000..b42e601 Binary files /dev/null and b/out/production/CYG/fr/gravencyg/commands/AdminForceLevelCommand.class differ diff --git a/out/production/CYG/fr/gravencyg/commands/AdminRankCommand.class b/out/production/CYG/fr/gravencyg/commands/AdminRankCommand.class new file mode 100644 index 0000000..4928f11 Binary files /dev/null and b/out/production/CYG/fr/gravencyg/commands/AdminRankCommand.class differ diff --git a/out/production/CYG/fr/gravencyg/commands/AdminRefreshLevelCommand.class b/out/production/CYG/fr/gravencyg/commands/AdminRefreshLevelCommand.class new file mode 100644 index 0000000..17dcf78 Binary files /dev/null and b/out/production/CYG/fr/gravencyg/commands/AdminRefreshLevelCommand.class differ diff --git a/out/production/CYG/fr/gravencyg/commands/GameLeaveCommand.class b/out/production/CYG/fr/gravencyg/commands/GameLeaveCommand.class new file mode 100644 index 0000000..97c620f Binary files /dev/null and b/out/production/CYG/fr/gravencyg/commands/GameLeaveCommand.class differ diff --git a/out/production/CYG/fr/gravencyg/commands/GamePlayCommand.class b/out/production/CYG/fr/gravencyg/commands/GamePlayCommand.class new file mode 100644 index 0000000..77ab76f Binary files /dev/null and b/out/production/CYG/fr/gravencyg/commands/GamePlayCommand.class differ diff --git a/out/production/CYG/fr/gravencyg/commands/LinkDiscordCommand.class b/out/production/CYG/fr/gravencyg/commands/LinkDiscordCommand.class new file mode 100644 index 0000000..0ebcb1d Binary files /dev/null and b/out/production/CYG/fr/gravencyg/commands/LinkDiscordCommand.class differ diff --git a/out/production/CYG/fr/gravencyg/commands/LinkShopCommand.class b/out/production/CYG/fr/gravencyg/commands/LinkShopCommand.class new file mode 100644 index 0000000..10d987a Binary files /dev/null and b/out/production/CYG/fr/gravencyg/commands/LinkShopCommand.class differ diff --git a/out/production/CYG/fr/gravencyg/commands/LinkTwitterCommand.class b/out/production/CYG/fr/gravencyg/commands/LinkTwitterCommand.class new file mode 100644 index 0000000..813561b Binary files /dev/null and b/out/production/CYG/fr/gravencyg/commands/LinkTwitterCommand.class differ diff --git a/out/production/CYG/fr/gravencyg/commands/ManageFriendCommand.class b/out/production/CYG/fr/gravencyg/commands/ManageFriendCommand.class new file mode 100644 index 0000000..aa51724 Binary files /dev/null and b/out/production/CYG/fr/gravencyg/commands/ManageFriendCommand.class differ diff --git a/out/production/CYG/fr/gravencyg/commands/ManageLocationCommand.class b/out/production/CYG/fr/gravencyg/commands/ManageLocationCommand.class new file mode 100644 index 0000000..966fec6 Binary files /dev/null and b/out/production/CYG/fr/gravencyg/commands/ManageLocationCommand.class differ diff --git a/out/production/CYG/fr/gravencyg/commands/ManageMessageCommand.class b/out/production/CYG/fr/gravencyg/commands/ManageMessageCommand.class new file mode 100644 index 0000000..66811ec Binary files /dev/null and b/out/production/CYG/fr/gravencyg/commands/ManageMessageCommand.class differ diff --git a/out/production/CYG/fr/gravencyg/commands/ManageNPCCommand.class b/out/production/CYG/fr/gravencyg/commands/ManageNPCCommand.class new file mode 100644 index 0000000..9f7836b Binary files /dev/null and b/out/production/CYG/fr/gravencyg/commands/ManageNPCCommand.class differ diff --git a/out/production/CYG/fr/gravencyg/commands/ManageVariablesCommand.class b/out/production/CYG/fr/gravencyg/commands/ManageVariablesCommand.class new file mode 100644 index 0000000..53ab508 Binary files /dev/null and b/out/production/CYG/fr/gravencyg/commands/ManageVariablesCommand.class differ diff --git a/out/production/CYG/fr/gravencyg/commands/ModFreezeCommand.class b/out/production/CYG/fr/gravencyg/commands/ModFreezeCommand.class new file mode 100644 index 0000000..a9c819c Binary files /dev/null and b/out/production/CYG/fr/gravencyg/commands/ModFreezeCommand.class differ diff --git a/out/production/CYG/fr/gravencyg/commands/ModKickCommand.class b/out/production/CYG/fr/gravencyg/commands/ModKickCommand.class new file mode 100644 index 0000000..95d3848 Binary files /dev/null and b/out/production/CYG/fr/gravencyg/commands/ModKickCommand.class differ diff --git a/out/production/CYG/fr/gravencyg/commands/ModMuteCommand.class b/out/production/CYG/fr/gravencyg/commands/ModMuteCommand.class new file mode 100644 index 0000000..7d77a1e Binary files /dev/null and b/out/production/CYG/fr/gravencyg/commands/ModMuteCommand.class differ diff --git a/out/production/CYG/fr/gravencyg/commands/ModUnMuteCommand.class b/out/production/CYG/fr/gravencyg/commands/ModUnMuteCommand.class new file mode 100644 index 0000000..7354d37 Binary files /dev/null and b/out/production/CYG/fr/gravencyg/commands/ModUnMuteCommand.class differ diff --git a/out/production/CYG/fr/gravencyg/commands/ModVerifyGameCommand.class b/out/production/CYG/fr/gravencyg/commands/ModVerifyGameCommand.class new file mode 100644 index 0000000..e88841f Binary files /dev/null and b/out/production/CYG/fr/gravencyg/commands/ModVerifyGameCommand.class differ diff --git a/out/production/CYG/fr/gravencyg/commands/PlayerActionCommand.class b/out/production/CYG/fr/gravencyg/commands/PlayerActionCommand.class new file mode 100644 index 0000000..cd781e8 Binary files /dev/null and b/out/production/CYG/fr/gravencyg/commands/PlayerActionCommand.class differ diff --git a/out/production/CYG/fr/gravencyg/commands/PlayerBarrierCommand.class b/out/production/CYG/fr/gravencyg/commands/PlayerBarrierCommand.class new file mode 100644 index 0000000..2418c69 Binary files /dev/null and b/out/production/CYG/fr/gravencyg/commands/PlayerBarrierCommand.class differ diff --git a/out/production/CYG/fr/gravencyg/commands/PlayerBlockConditionCommand.class b/out/production/CYG/fr/gravencyg/commands/PlayerBlockConditionCommand.class new file mode 100644 index 0000000..410a70a Binary files /dev/null and b/out/production/CYG/fr/gravencyg/commands/PlayerBlockConditionCommand.class differ diff --git a/out/production/CYG/fr/gravencyg/commands/PlayerBlockEventCommand.class b/out/production/CYG/fr/gravencyg/commands/PlayerBlockEventCommand.class new file mode 100644 index 0000000..fe6340b Binary files /dev/null and b/out/production/CYG/fr/gravencyg/commands/PlayerBlockEventCommand.class differ diff --git a/out/production/CYG/fr/gravencyg/commands/PlayerFlyCommand.class b/out/production/CYG/fr/gravencyg/commands/PlayerFlyCommand.class new file mode 100644 index 0000000..a0f54d4 Binary files /dev/null and b/out/production/CYG/fr/gravencyg/commands/PlayerFlyCommand.class differ diff --git a/out/production/CYG/fr/gravencyg/commands/PlayerGameModeCommand.class b/out/production/CYG/fr/gravencyg/commands/PlayerGameModeCommand.class new file mode 100644 index 0000000..36f5eea Binary files /dev/null and b/out/production/CYG/fr/gravencyg/commands/PlayerGameModeCommand.class differ diff --git a/out/production/CYG/fr/gravencyg/commands/PlayerHatCommand.class b/out/production/CYG/fr/gravencyg/commands/PlayerHatCommand.class new file mode 100644 index 0000000..b20648a Binary files /dev/null and b/out/production/CYG/fr/gravencyg/commands/PlayerHatCommand.class differ diff --git a/out/production/CYG/fr/gravencyg/commands/PlayerHeadCommand.class b/out/production/CYG/fr/gravencyg/commands/PlayerHeadCommand.class new file mode 100644 index 0000000..5fe927d Binary files /dev/null and b/out/production/CYG/fr/gravencyg/commands/PlayerHeadCommand.class differ diff --git a/out/production/CYG/fr/gravencyg/commands/PlayerHubCommand.class b/out/production/CYG/fr/gravencyg/commands/PlayerHubCommand.class new file mode 100644 index 0000000..4235ef6 Binary files /dev/null and b/out/production/CYG/fr/gravencyg/commands/PlayerHubCommand.class differ diff --git a/out/production/CYG/fr/gravencyg/commands/PlayerPingCommand.class b/out/production/CYG/fr/gravencyg/commands/PlayerPingCommand.class new file mode 100644 index 0000000..4712018 Binary files /dev/null and b/out/production/CYG/fr/gravencyg/commands/PlayerPingCommand.class differ diff --git a/out/production/CYG/fr/gravencyg/commands/PlayerPlotCommand.class b/out/production/CYG/fr/gravencyg/commands/PlayerPlotCommand.class new file mode 100644 index 0000000..11aa6c8 Binary files /dev/null and b/out/production/CYG/fr/gravencyg/commands/PlayerPlotCommand.class differ diff --git a/out/production/CYG/fr/gravencyg/commands/PlayerUUIDCommand.class b/out/production/CYG/fr/gravencyg/commands/PlayerUUIDCommand.class new file mode 100644 index 0000000..eed2a69 Binary files /dev/null and b/out/production/CYG/fr/gravencyg/commands/PlayerUUIDCommand.class differ diff --git a/out/production/CYG/fr/gravencyg/commands/PlayerWorldEditCommand.class b/out/production/CYG/fr/gravencyg/commands/PlayerWorldEditCommand.class new file mode 100644 index 0000000..241e279 Binary files /dev/null and b/out/production/CYG/fr/gravencyg/commands/PlayerWorldEditCommand.class differ diff --git a/out/production/CYG/fr/gravencyg/commands/ShopPremiumCommand.class b/out/production/CYG/fr/gravencyg/commands/ShopPremiumCommand.class new file mode 100644 index 0000000..530a695 Binary files /dev/null and b/out/production/CYG/fr/gravencyg/commands/ShopPremiumCommand.class differ diff --git a/out/production/CYG/fr/gravencyg/commands/ShortcutPlotTpCommand.class b/out/production/CYG/fr/gravencyg/commands/ShortcutPlotTpCommand.class new file mode 100644 index 0000000..dd620d3 Binary files /dev/null and b/out/production/CYG/fr/gravencyg/commands/ShortcutPlotTpCommand.class differ diff --git a/out/production/CYG/fr/gravencyg/commands/TCommand.class b/out/production/CYG/fr/gravencyg/commands/TCommand.class new file mode 100644 index 0000000..09ab502 Binary files /dev/null and b/out/production/CYG/fr/gravencyg/commands/TCommand.class differ diff --git a/out/production/CYG/fr/gravencyg/game/CYGame.class b/out/production/CYG/fr/gravencyg/game/CYGame.class new file mode 100644 index 0000000..eae8d7f Binary files /dev/null and b/out/production/CYG/fr/gravencyg/game/CYGame.class differ diff --git a/out/production/CYG/fr/gravencyg/game/CYGameManager.class b/out/production/CYG/fr/gravencyg/game/CYGameManager.class new file mode 100644 index 0000000..d594a9b Binary files /dev/null and b/out/production/CYG/fr/gravencyg/game/CYGameManager.class differ diff --git a/out/production/CYG/fr/gravencyg/game/CYGameState.class b/out/production/CYG/fr/gravencyg/game/CYGameState.class new file mode 100644 index 0000000..72fad37 Binary files /dev/null and b/out/production/CYG/fr/gravencyg/game/CYGameState.class differ diff --git a/out/production/CYG/fr/gravencyg/items/Armor.class b/out/production/CYG/fr/gravencyg/items/Armor.class new file mode 100644 index 0000000..ee4ac41 Binary files /dev/null and b/out/production/CYG/fr/gravencyg/items/Armor.class differ diff --git a/out/production/CYG/fr/gravencyg/items/ArmorManager$1.class b/out/production/CYG/fr/gravencyg/items/ArmorManager$1.class new file mode 100644 index 0000000..7597458 Binary files /dev/null and b/out/production/CYG/fr/gravencyg/items/ArmorManager$1.class differ diff --git a/out/production/CYG/fr/gravencyg/items/ArmorManager.class b/out/production/CYG/fr/gravencyg/items/ArmorManager.class new file mode 100644 index 0000000..153f8c2 Binary files /dev/null and b/out/production/CYG/fr/gravencyg/items/ArmorManager.class differ diff --git a/out/production/CYG/fr/gravencyg/items/ItemBuilder.class b/out/production/CYG/fr/gravencyg/items/ItemBuilder.class new file mode 100644 index 0000000..8ec9f4a Binary files /dev/null and b/out/production/CYG/fr/gravencyg/items/ItemBuilder.class differ diff --git a/out/production/CYG/fr/gravencyg/listeners/BlockListener.class b/out/production/CYG/fr/gravencyg/listeners/BlockListener.class new file mode 100644 index 0000000..45f07f6 Binary files /dev/null and b/out/production/CYG/fr/gravencyg/listeners/BlockListener.class differ diff --git a/out/production/CYG/fr/gravencyg/listeners/ChatListener.class b/out/production/CYG/fr/gravencyg/listeners/ChatListener.class new file mode 100644 index 0000000..fe16cad Binary files /dev/null and b/out/production/CYG/fr/gravencyg/listeners/ChatListener.class differ diff --git a/out/production/CYG/fr/gravencyg/listeners/PlayerListener.class b/out/production/CYG/fr/gravencyg/listeners/PlayerListener.class new file mode 100644 index 0000000..078878e Binary files /dev/null and b/out/production/CYG/fr/gravencyg/listeners/PlayerListener.class differ diff --git a/out/production/CYG/fr/gravencyg/listeners/WorldListener.class b/out/production/CYG/fr/gravencyg/listeners/WorldListener.class new file mode 100644 index 0000000..3eb2243 Binary files /dev/null and b/out/production/CYG/fr/gravencyg/listeners/WorldListener.class differ diff --git a/out/production/CYG/fr/gravencyg/manager/CYGCompilerManager.class b/out/production/CYG/fr/gravencyg/manager/CYGCompilerManager.class new file mode 100644 index 0000000..72f0208 Binary files /dev/null and b/out/production/CYG/fr/gravencyg/manager/CYGCompilerManager.class differ diff --git a/out/production/CYG/fr/gravencyg/manager/CYGDataManager.class b/out/production/CYG/fr/gravencyg/manager/CYGDataManager.class new file mode 100644 index 0000000..aedc0af Binary files /dev/null and b/out/production/CYG/fr/gravencyg/manager/CYGDataManager.class differ diff --git a/out/production/CYG/fr/gravencyg/manager/CYGHologramManager.class b/out/production/CYG/fr/gravencyg/manager/CYGHologramManager.class new file mode 100644 index 0000000..910dde8 Binary files /dev/null and b/out/production/CYG/fr/gravencyg/manager/CYGHologramManager.class differ diff --git a/out/production/CYG/fr/gravencyg/manager/CYGPlotManager.class b/out/production/CYG/fr/gravencyg/manager/CYGPlotManager.class new file mode 100644 index 0000000..9a78f88 Binary files /dev/null and b/out/production/CYG/fr/gravencyg/manager/CYGPlotManager.class differ diff --git a/out/production/CYG/fr/gravencyg/manager/CYGWorleditManager.class b/out/production/CYG/fr/gravencyg/manager/CYGWorleditManager.class new file mode 100644 index 0000000..491a50e Binary files /dev/null and b/out/production/CYG/fr/gravencyg/manager/CYGWorleditManager.class differ diff --git a/out/production/CYG/fr/gravencyg/menus/CustomMenuManager.class b/out/production/CYG/fr/gravencyg/menus/CustomMenuManager.class new file mode 100644 index 0000000..735d9f8 Binary files /dev/null and b/out/production/CYG/fr/gravencyg/menus/CustomMenuManager.class differ diff --git a/out/production/CYG/fr/gravencyg/menus/all/ActionMenu.class b/out/production/CYG/fr/gravencyg/menus/all/ActionMenu.class new file mode 100644 index 0000000..bf2b7bd Binary files /dev/null and b/out/production/CYG/fr/gravencyg/menus/all/ActionMenu.class differ diff --git a/out/production/CYG/fr/gravencyg/menus/all/EventMenu.class b/out/production/CYG/fr/gravencyg/menus/all/EventMenu.class new file mode 100644 index 0000000..966d406 Binary files /dev/null and b/out/production/CYG/fr/gravencyg/menus/all/EventMenu.class differ diff --git a/out/production/CYG/fr/gravencyg/menus/all/GameModeMenu$1.class b/out/production/CYG/fr/gravencyg/menus/all/GameModeMenu$1.class new file mode 100644 index 0000000..ca896ce Binary files /dev/null and b/out/production/CYG/fr/gravencyg/menus/all/GameModeMenu$1.class differ diff --git a/out/production/CYG/fr/gravencyg/menus/all/GameModeMenu.class b/out/production/CYG/fr/gravencyg/menus/all/GameModeMenu.class new file mode 100644 index 0000000..d2f2843 Binary files /dev/null and b/out/production/CYG/fr/gravencyg/menus/all/GameModeMenu.class differ diff --git a/out/production/CYG/fr/gravencyg/menus/all/PlayMenu.class b/out/production/CYG/fr/gravencyg/menus/all/PlayMenu.class new file mode 100644 index 0000000..fe11484 Binary files /dev/null and b/out/production/CYG/fr/gravencyg/menus/all/PlayMenu.class differ diff --git a/out/production/CYG/fr/gravencyg/menus/all/UpgradeMenu.class b/out/production/CYG/fr/gravencyg/menus/all/UpgradeMenu.class new file mode 100644 index 0000000..d0a21d7 Binary files /dev/null and b/out/production/CYG/fr/gravencyg/menus/all/UpgradeMenu.class differ diff --git a/out/production/CYG/fr/gravencyg/menus/core/CustomMenu.class b/out/production/CYG/fr/gravencyg/menus/core/CustomMenu.class new file mode 100644 index 0000000..dbd4ab0 Binary files /dev/null and b/out/production/CYG/fr/gravencyg/menus/core/CustomMenu.class differ diff --git a/out/production/CYG/fr/gravencyg/menus/core/CustomMenuListener.class b/out/production/CYG/fr/gravencyg/menus/core/CustomMenuListener.class new file mode 100644 index 0000000..83332e8 Binary files /dev/null and b/out/production/CYG/fr/gravencyg/menus/core/CustomMenuListener.class differ diff --git a/out/production/CYG/fr/gravencyg/menus/locations/LocationMenu.class b/out/production/CYG/fr/gravencyg/menus/locations/LocationMenu.class new file mode 100644 index 0000000..322d39d Binary files /dev/null and b/out/production/CYG/fr/gravencyg/menus/locations/LocationMenu.class differ diff --git a/out/production/CYG/fr/gravencyg/menus/locations/LocationSelectMenu.class b/out/production/CYG/fr/gravencyg/menus/locations/LocationSelectMenu.class new file mode 100644 index 0000000..27cbafc Binary files /dev/null and b/out/production/CYG/fr/gravencyg/menus/locations/LocationSelectMenu.class differ diff --git a/out/production/CYG/fr/gravencyg/menus/messages/MessageMenu.class b/out/production/CYG/fr/gravencyg/menus/messages/MessageMenu.class new file mode 100644 index 0000000..16bfb80 Binary files /dev/null and b/out/production/CYG/fr/gravencyg/menus/messages/MessageMenu.class differ diff --git a/out/production/CYG/fr/gravencyg/menus/messages/MessageSelectMenu.class b/out/production/CYG/fr/gravencyg/menus/messages/MessageSelectMenu.class new file mode 100644 index 0000000..8201c9e Binary files /dev/null and b/out/production/CYG/fr/gravencyg/menus/messages/MessageSelectMenu.class differ diff --git a/out/production/CYG/fr/gravencyg/menus/options/OptionAutostartMenu.class b/out/production/CYG/fr/gravencyg/menus/options/OptionAutostartMenu.class new file mode 100644 index 0000000..6e53a04 Binary files /dev/null and b/out/production/CYG/fr/gravencyg/menus/options/OptionAutostartMenu.class differ diff --git a/out/production/CYG/fr/gravencyg/menus/options/OptionLifeMenu.class b/out/production/CYG/fr/gravencyg/menus/options/OptionLifeMenu.class new file mode 100644 index 0000000..792cefc Binary files /dev/null and b/out/production/CYG/fr/gravencyg/menus/options/OptionLifeMenu.class differ diff --git a/out/production/CYG/fr/gravencyg/menus/options/OptionMaxPlayersMenu.class b/out/production/CYG/fr/gravencyg/menus/options/OptionMaxPlayersMenu.class new file mode 100644 index 0000000..5cbb451 Binary files /dev/null and b/out/production/CYG/fr/gravencyg/menus/options/OptionMaxPlayersMenu.class differ diff --git a/out/production/CYG/fr/gravencyg/menus/options/OptionMenu$1.class b/out/production/CYG/fr/gravencyg/menus/options/OptionMenu$1.class new file mode 100644 index 0000000..5b71543 Binary files /dev/null and b/out/production/CYG/fr/gravencyg/menus/options/OptionMenu$1.class differ diff --git a/out/production/CYG/fr/gravencyg/menus/options/OptionMenu.class b/out/production/CYG/fr/gravencyg/menus/options/OptionMenu.class new file mode 100644 index 0000000..4a270b1 Binary files /dev/null and b/out/production/CYG/fr/gravencyg/menus/options/OptionMenu.class differ diff --git a/out/production/CYG/fr/gravencyg/menus/options/OptionStartingTimeMenu.class b/out/production/CYG/fr/gravencyg/menus/options/OptionStartingTimeMenu.class new file mode 100644 index 0000000..babc318 Binary files /dev/null and b/out/production/CYG/fr/gravencyg/menus/options/OptionStartingTimeMenu.class differ diff --git a/out/production/CYG/fr/gravencyg/menus/options/OptionWhitelistMenu.class b/out/production/CYG/fr/gravencyg/menus/options/OptionWhitelistMenu.class new file mode 100644 index 0000000..d12a02a Binary files /dev/null and b/out/production/CYG/fr/gravencyg/menus/options/OptionWhitelistMenu.class differ diff --git a/out/production/CYG/fr/gravencyg/menus/plot/PlotManageMenu.class b/out/production/CYG/fr/gravencyg/menus/plot/PlotManageMenu.class new file mode 100644 index 0000000..da1c811 Binary files /dev/null and b/out/production/CYG/fr/gravencyg/menus/plot/PlotManageMenu.class differ diff --git a/out/production/CYG/fr/gravencyg/menus/plot/PlotMenu.class b/out/production/CYG/fr/gravencyg/menus/plot/PlotMenu.class new file mode 100644 index 0000000..f3505c9 Binary files /dev/null and b/out/production/CYG/fr/gravencyg/menus/plot/PlotMenu.class differ diff --git a/out/production/CYG/fr/gravencyg/menus/variables/VariableMenu.class b/out/production/CYG/fr/gravencyg/menus/variables/VariableMenu.class new file mode 100644 index 0000000..b459159 Binary files /dev/null and b/out/production/CYG/fr/gravencyg/menus/variables/VariableMenu.class differ diff --git a/out/production/CYG/fr/gravencyg/menus/variables/VariableSelectMenu.class b/out/production/CYG/fr/gravencyg/menus/variables/VariableSelectMenu.class new file mode 100644 index 0000000..fd4b26c Binary files /dev/null and b/out/production/CYG/fr/gravencyg/menus/variables/VariableSelectMenu.class differ diff --git a/out/production/CYG/fr/gravencyg/model/ActionProcess.class b/out/production/CYG/fr/gravencyg/model/ActionProcess.class new file mode 100644 index 0000000..1eca11d Binary files /dev/null and b/out/production/CYG/fr/gravencyg/model/ActionProcess.class differ diff --git a/out/production/CYG/fr/gravencyg/model/CYGameMode.class b/out/production/CYG/fr/gravencyg/model/CYGameMode.class new file mode 100644 index 0000000..0a07963 Binary files /dev/null and b/out/production/CYG/fr/gravencyg/model/CYGameMode.class differ diff --git a/out/production/CYG/fr/gravencyg/model/GameConfig.class b/out/production/CYG/fr/gravencyg/model/GameConfig.class new file mode 100644 index 0000000..f8b9b8d Binary files /dev/null and b/out/production/CYG/fr/gravencyg/model/GameConfig.class differ diff --git a/out/production/CYG/fr/gravencyg/model/MaterialAndData.class b/out/production/CYG/fr/gravencyg/model/MaterialAndData.class new file mode 100644 index 0000000..16bfc1b Binary files /dev/null and b/out/production/CYG/fr/gravencyg/model/MaterialAndData.class differ diff --git a/out/production/CYG/fr/gravencyg/model/Plot.class b/out/production/CYG/fr/gravencyg/model/Plot.class new file mode 100644 index 0000000..06ac571 Binary files /dev/null and b/out/production/CYG/fr/gravencyg/model/Plot.class differ diff --git a/out/production/CYG/fr/gravencyg/model/Storage.class b/out/production/CYG/fr/gravencyg/model/Storage.class new file mode 100644 index 0000000..7512779 Binary files /dev/null and b/out/production/CYG/fr/gravencyg/model/Storage.class differ diff --git a/out/production/CYG/fr/gravencyg/model/VerifyGameConfig.class b/out/production/CYG/fr/gravencyg/model/VerifyGameConfig.class new file mode 100644 index 0000000..4e702b4 Binary files /dev/null and b/out/production/CYG/fr/gravencyg/model/VerifyGameConfig.class differ diff --git a/out/production/CYG/fr/gravencyg/npcs/NPC.class b/out/production/CYG/fr/gravencyg/npcs/NPC.class new file mode 100644 index 0000000..9c330ef Binary files /dev/null and b/out/production/CYG/fr/gravencyg/npcs/NPC.class differ diff --git a/out/production/CYG/fr/gravencyg/npcs/NPCClickListener.class b/out/production/CYG/fr/gravencyg/npcs/NPCClickListener.class new file mode 100644 index 0000000..1d0d8af Binary files /dev/null and b/out/production/CYG/fr/gravencyg/npcs/NPCClickListener.class differ diff --git a/out/production/CYG/fr/gravencyg/npcs/NPCManager.class b/out/production/CYG/fr/gravencyg/npcs/NPCManager.class new file mode 100644 index 0000000..49684ad Binary files /dev/null and b/out/production/CYG/fr/gravencyg/npcs/NPCManager.class differ diff --git a/out/production/CYG/fr/gravencyg/npcs/all/DevNPC.class b/out/production/CYG/fr/gravencyg/npcs/all/DevNPC.class new file mode 100644 index 0000000..1947557 Binary files /dev/null and b/out/production/CYG/fr/gravencyg/npcs/all/DevNPC.class differ diff --git a/out/production/CYG/fr/gravencyg/npcs/all/PlayNPC.class b/out/production/CYG/fr/gravencyg/npcs/all/PlayNPC.class new file mode 100644 index 0000000..2ca541f Binary files /dev/null and b/out/production/CYG/fr/gravencyg/npcs/all/PlayNPC.class differ diff --git a/out/production/CYG/fr/gravencyg/npcs/all/UpgradeNPC.class b/out/production/CYG/fr/gravencyg/npcs/all/UpgradeNPC.class new file mode 100644 index 0000000..9decda0 Binary files /dev/null and b/out/production/CYG/fr/gravencyg/npcs/all/UpgradeNPC.class differ diff --git a/out/production/CYG/fr/gravencyg/schedule/CYGExecutionTask.class b/out/production/CYG/fr/gravencyg/schedule/CYGExecutionTask.class new file mode 100644 index 0000000..f11c324 Binary files /dev/null and b/out/production/CYG/fr/gravencyg/schedule/CYGExecutionTask.class differ diff --git a/out/production/CYG/fr/gravencyg/schedule/CYGGameCycle.class b/out/production/CYG/fr/gravencyg/schedule/CYGGameCycle.class new file mode 100644 index 0000000..9caf060 Binary files /dev/null and b/out/production/CYG/fr/gravencyg/schedule/CYGGameCycle.class differ diff --git a/out/production/CYG/fr/gravencyg/scoreboards/ScoreboardManager.class b/out/production/CYG/fr/gravencyg/scoreboards/ScoreboardManager.class new file mode 100644 index 0000000..9ea4b4f Binary files /dev/null and b/out/production/CYG/fr/gravencyg/scoreboards/ScoreboardManager.class differ diff --git a/out/production/CYG/fr/gravencyg/scoreboards/ScoreboardSign$1.class b/out/production/CYG/fr/gravencyg/scoreboards/ScoreboardSign$1.class new file mode 100644 index 0000000..bd1abe3 Binary files /dev/null and b/out/production/CYG/fr/gravencyg/scoreboards/ScoreboardSign$1.class differ diff --git a/out/production/CYG/fr/gravencyg/scoreboards/ScoreboardSign$VirtualTeam.class b/out/production/CYG/fr/gravencyg/scoreboards/ScoreboardSign$VirtualTeam.class new file mode 100644 index 0000000..a656d57 Binary files /dev/null and b/out/production/CYG/fr/gravencyg/scoreboards/ScoreboardSign$VirtualTeam.class differ diff --git a/out/production/CYG/fr/gravencyg/scoreboards/ScoreboardSign.class b/out/production/CYG/fr/gravencyg/scoreboards/ScoreboardSign.class new file mode 100644 index 0000000..c3cbc70 Binary files /dev/null and b/out/production/CYG/fr/gravencyg/scoreboards/ScoreboardSign.class differ diff --git a/out/production/CYG/fr/gravencyg/utils/CEvent.class b/out/production/CYG/fr/gravencyg/utils/CEvent.class new file mode 100644 index 0000000..25d8757 Binary files /dev/null and b/out/production/CYG/fr/gravencyg/utils/CEvent.class differ diff --git a/out/production/CYG/fr/gravencyg/utils/CLevel.class b/out/production/CYG/fr/gravencyg/utils/CLevel.class new file mode 100644 index 0000000..ce7cf3e Binary files /dev/null and b/out/production/CYG/fr/gravencyg/utils/CLevel.class differ diff --git a/out/production/CYG/fr/gravencyg/utils/CRank.class b/out/production/CYG/fr/gravencyg/utils/CRank.class new file mode 100644 index 0000000..6d9f0de Binary files /dev/null and b/out/production/CYG/fr/gravencyg/utils/CRank.class differ diff --git a/out/production/CYG/fr/gravencyg/utils/LocationUtils.class b/out/production/CYG/fr/gravencyg/utils/LocationUtils.class new file mode 100644 index 0000000..c7a80af Binary files /dev/null and b/out/production/CYG/fr/gravencyg/utils/LocationUtils.class differ diff --git a/out/production/CYG/fr/gravencyg/utils/PlotSize.class b/out/production/CYG/fr/gravencyg/utils/PlotSize.class new file mode 100644 index 0000000..df3dcbe Binary files /dev/null and b/out/production/CYG/fr/gravencyg/utils/PlotSize.class differ diff --git a/out/production/CYG/plugin.yml b/out/production/CYG/plugin.yml new file mode 100644 index 0000000..16c1c96 --- /dev/null +++ b/out/production/CYG/plugin.yml @@ -0,0 +1,82 @@ +name: CYG +version: 0.0.6 +author: Graven +main: fr.gravencyg.CYG +commands: + plot: + description: Se teleporter vers sa parcelle + aliases: [pt] + locations: + aliases: [loc] + variables: + aliases: [var] + ev: + description: Obtenir un bloc d'evenement + actions: + description: Ouvrir le menu des actions + aliases: [ac] + if: + description: Obtenir un bloc de condition + hub: + description: Se teleporter au Hub + messages: + description: Ouvrir le menu de gestion des messages + aliases: [msg] + play: + description: Jouer au jeu d'un joueur en ligne + aliases: [p] + pa: + description: Plot actions + po: + description: Plot options + pc: + description: Plot code + ptp: + description: Plot tp + rank: + description: rank + permission: rank.change + verifygame: + description: verify + fly: + description: Activer le vol doiseau + friend: + description: Invitez des amis sur votre parcelle + mute: + description: Mute un joueur + unmute: + description: Demute un joueur + kick: + description: Ejecte un joueur du serveur + freeze: + description: Gele un joueur du serveur + uuid: + description: Donne luuid du joueur + leave: + description: Quitter un jeu + barriere: + description: Barriere + we: + description: Mini worldedit pour les joueurs + ping: + description: Ping + head: + description: Donne la tete d'un joueur + gamemode: + description: Changement de gamemode + refreshlevel: + permission: perm.full + forcelevel: + permission: perm.full + premium: + permission: shop.premium + discord: + description: Discord lien + shop: + description: Shop lien + twitter: + description: Twitter lien + hat: + description: Change hat + npc: + description: Gérer les personnages on joueurs diff --git a/src/main/java/fr/gravencyg/CYG.java b/src/main/java/fr/gravencyg/CYG.java new file mode 100644 index 0000000..8e40481 --- /dev/null +++ b/src/main/java/fr/gravencyg/CYG.java @@ -0,0 +1,234 @@ +package fr.gravencyg; + +import fr.gravencyg.actions.ActionRegisters; +import fr.gravencyg.actions.team.Team; +import fr.gravencyg.commands.admin.AdminForceUpdateHoloCommand; +import fr.gravencyg.commands.game.GameLeaveCommand; +import fr.gravencyg.commands.game.GamePlayCommand; +import fr.gravencyg.commands.admin.AdminForceLevelCommand; +import fr.gravencyg.commands.admin.AdminRankCommand; +import fr.gravencyg.commands.admin.AdminRefreshLevelCommand; +import fr.gravencyg.commands.link.LinkDiscordCommand; +import fr.gravencyg.commands.link.LinkShopCommand; +import fr.gravencyg.commands.link.LinkTwitterCommand; +import fr.gravencyg.commands.manage.ManageFriendCommand; +import fr.gravencyg.commands.manage.ManageLocationCommand; +import fr.gravencyg.commands.manage.ManageMessageCommand; +import fr.gravencyg.commands.manage.ManageVariablesCommand; +import fr.gravencyg.commands.mod.*; +import fr.gravencyg.commands.player.*; +import fr.gravencyg.commands.player.PlayerHatCommand; +import fr.gravencyg.commands.shortcut.ShopPremiumCommand; +import fr.gravencyg.game.CYGame; +import fr.gravencyg.items.ArmorManager; +import fr.gravencyg.listeners.BlockListener; +import fr.gravencyg.listeners.ChatListener; +import fr.gravencyg.listeners.PlayerListener; +import fr.gravencyg.listeners.WorldListener; +import fr.gravencyg.manager.*; +import fr.gravencyg.game.CYGameManager; +import fr.gravencyg.menus.core.CustomMenuListener; +import fr.gravencyg.npcs.NPCClickListener; +import fr.gravencyg.npcs.NPCManager; +import fr.gravencyg.menus.CustomMenuManager; +import fr.gravencyg.schedule.CYGExecutionTask; +import fr.gravencyg.schedule.CYGGameCycle; +import fr.gravencyg.scoreboards.ScoreboardManager; +import org.bukkit.Bukkit; +import org.bukkit.Difficulty; +import org.bukkit.Location; +import org.bukkit.World; +import org.bukkit.block.Block; +import org.bukkit.boss.BossBar; +import org.bukkit.entity.Player; +import org.bukkit.plugin.java.JavaPlugin; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +public class CYG extends JavaPlugin { + + public Location spawnLocation; + private Map eventBlockCache = new HashMap<>(); + + private List freezeGamePlayers = new ArrayList<>(); + private List freezeModPlayers = new ArrayList<>(); + + private Map targetPlayMenu = new HashMap<>(); + + private List barActions = new ArrayList<>(); + private CustomMenuManager menuManager; + private CYGDataManager dataManager; + private CYGHologramManager hologramManager; + private CYGCompilerManager compilerManager; + private ActionRegisters actionRegisters; + private NPCManager npcManager; + private ScoreboardManager scoreboardManager; + private CYGameManager gameManager; + private CYGWorleditManager worldEditManager; + private CYGPlotManager plotManager; + private ArmorManager armorManager; + + @Override + public void onEnable() { + System.out.println("CYG >> Enabled"); + + World world = Bukkit.getWorld("world"); + world.setDifficulty(Difficulty.PEACEFUL); + + // register locations + spawnLocation = new Location(world, 0, 28.98, 1.572, 90.1f, -0.2f); + + // register managers + + dataManager = new CYGDataManager(this); + menuManager = new CustomMenuManager(this); + hologramManager = new CYGHologramManager(this); + compilerManager = new CYGCompilerManager(this); + armorManager = new ArmorManager(); + actionRegisters = new ActionRegisters(this); + npcManager = new NPCManager(this); + scoreboardManager = new ScoreboardManager(this); + gameManager = new CYGameManager(this); + worldEditManager = new CYGWorleditManager(this); + plotManager = new CYGPlotManager(this); + + // register commands + getCommand("hub").setExecutor(new PlayerHubCommand(this)); + getCommand("plot").setExecutor(new PlayerPlotCommand(this)); + getCommand("locations").setExecutor(new ManageLocationCommand(this)); + getCommand("messages").setExecutor(new ManageMessageCommand(this)); + getCommand("play").setExecutor(new GamePlayCommand(this)); + getCommand("rank").setExecutor(new AdminRankCommand(this)); + getCommand("verifygame").setExecutor(new ModVerifyGameCommand(this)); + getCommand("friend").setExecutor(new ManageFriendCommand(this)); + getCommand("fly").setExecutor(new PlayerFlyCommand(this)); + getCommand("mute").setExecutor(new ModMuteCommand(this)); + getCommand("unmute").setExecutor(new ModUnMuteCommand(this)); + getCommand("kick").setExecutor(new ModKickCommand(this)); + getCommand("freeze").setExecutor(new ModFreezeCommand(this)); + getCommand("uuid").setExecutor(new PlayerUUIDCommand(this)); + getCommand("leave").setExecutor(new GameLeaveCommand(this)); + getCommand("barriere").setExecutor(new PlayerBarrierCommand(this)); + getCommand("we").setExecutor(new PlayerWorldEditCommand(this)); + getCommand("ping").setExecutor(new PlayerPingCommand(this)); + getCommand("head").setExecutor(new PlayerHeadCommand(this)); + getCommand("gamemode").setExecutor(new PlayerGameModeCommand(this)); + getCommand("premium").setExecutor(new ShopPremiumCommand(this)); + getCommand("refreshlevel").setExecutor(new AdminRefreshLevelCommand(this)); + getCommand("forcelevel").setExecutor(new AdminForceLevelCommand(this)); + + getCommand("twitter").setExecutor(new LinkTwitterCommand(this)); + getCommand("discord").setExecutor(new LinkDiscordCommand(this)); + getCommand("shop").setExecutor(new LinkShopCommand(this)); + getCommand("hat").setExecutor(new PlayerHatCommand(this)); + + getCommand("actions").setExecutor(new PlayerActionCommand(this)); + getCommand("ev").setExecutor(new PlayerBlockEventCommand(this)); + getCommand("if").setExecutor(new PlayerBlockConditionCommand(this)); + getCommand("updateholo").setExecutor(new AdminForceUpdateHoloCommand(this)); + + getCommand("options").setExecutor(new ShortcutOptionCommand(this)); + getCommand("gamename").setExecutor(new ShortcutGameNameCommand(this)); + getCommand("setcode").setExecutor(new ShortcutSetCodeCommand(this)); + getCommand("setspawn").setExecutor(new ShortcutSetSpawnCommand(this)); + + // register listeners + getServer().getPluginManager().registerEvents(new WorldListener(this), this); + getServer().getPluginManager().registerEvents(new PlayerListener(this), this); + getServer().getPluginManager().registerEvents(new ChatListener(this), this); + getServer().getPluginManager().registerEvents(new BlockListener(this), this); + getServer().getPluginManager().registerEvents(new NPCClickListener(this), this); + getServer().getPluginManager().registerEvents(new CustomMenuListener(this), this); + + // starting execution task loop + CYGExecutionTask task = new CYGExecutionTask(this); + task.runTaskTimer(this, 2L, 2L); + + // starting game cycle task loop + CYGGameCycle gameCycle = new CYGGameCycle(this); + gameCycle.runTaskTimer(this, 20L, 20L); + + for(Player player : Bukkit.getOnlinePlayers()) + { + if(!player.getWorld().getName().equalsIgnoreCase("world")) { + hologramManager.registerHologram(player.getWorld()); + } + scoreboardManager.load(player); + } + + } + + @Override + public void onDisable() { + hologramManager.removeAllHolograms(); + + for(Map.Entry> game : gameManager.getGames().entrySet()) + { + for(CYGame gam : game.getValue()) + { + gameManager.regenMap(gam); + } + } + + for(BossBar bar : barActions) + { + bar.removeAll(); + } + + for(Player player : Bukkit.getOnlinePlayers()) + { + scoreboardManager.unload(player); + } + + npcManager.killAll(); + System.out.println("CYG >> Disabled"); + } + + public void toggleGameFreeze(Player player) { + if(!freezeGamePlayers.contains(player)) + { + freezeGamePlayers.add(player); + } + else + { + freezeGamePlayers.remove(player); + } + } + + public CustomMenuManager getMenuManager() { return menuManager; } + + public CYGDataManager getDataManager() { return dataManager; } + + public Map getEventBlockCache() { return eventBlockCache; } + + public CYGHologramManager getHologramManager() { return hologramManager; } + + public CYGCompilerManager getCompilerManager() { return compilerManager; } + + public ActionRegisters getActionBlocks() { return actionRegisters; } + + public ArmorManager getArmorManager() { return armorManager; } + + public NPCManager getNpcManager() { return npcManager; } + + public CYGameManager getGameManager() { return gameManager; } + + public ScoreboardManager getScoreboardManager() { return scoreboardManager; } + + public List getFreezeModPlayers() { return freezeModPlayers; } + + public List getFreezeGamePlayers() { return freezeGamePlayers; } + + public CYGWorleditManager getWorldEditManager() {return worldEditManager;} + + public List getBarActions(){ return barActions; } + + public CYGPlotManager getPlotManager(){ return plotManager; } + + public Map getTargetPlayMenu() { + return targetPlayMenu; + } +} diff --git a/src/main/java/fr/gravencyg/actions/Action.java b/src/main/java/fr/gravencyg/actions/Action.java new file mode 100644 index 0000000..1eeb8b5 --- /dev/null +++ b/src/main/java/fr/gravencyg/actions/Action.java @@ -0,0 +1,34 @@ +package fr.gravencyg.actions; + +import fr.gravencyg.CYG; +import fr.gravencyg.model.ActionProcess; +import fr.gravencyg.utils.CLevel; +import org.bukkit.block.Block; +import org.bukkit.entity.Player; + +public abstract class Action { + + protected CYG main; + private int slot; + private CLevel minLevel; + + public Action(CYG main, CLevel level) { + this.main = main; + this.slot = 53; + this.minLevel = level; + } + + public CLevel getRequireLevel(){ return minLevel; } + + public abstract String title(); + + public abstract String lore(); + + public abstract void onExecute(Player player, Block block, ActionProcess actionProcess); + + public void setSlot(int slot) { this.slot = slot; } + + public int getSlot(){ return slot; } + + +} diff --git a/src/main/java/fr/gravencyg/actions/ActionRegisters.java b/src/main/java/fr/gravencyg/actions/ActionRegisters.java new file mode 100644 index 0000000..faa0879 --- /dev/null +++ b/src/main/java/fr/gravencyg/actions/ActionRegisters.java @@ -0,0 +1,139 @@ +package fr.gravencyg.actions; + +import fr.gravencyg.CYG; +import fr.gravencyg.actions.basic.*; +import fr.gravencyg.actions.block.RegenMapAction; +import fr.gravencyg.actions.block.RemoveBlockAction; +import fr.gravencyg.actions.block.SetBlockAction; +import fr.gravencyg.actions.game.EliminateAction; +import fr.gravencyg.actions.game.StopGameAction; +import fr.gravencyg.actions.game.WinnerAction; +import fr.gravencyg.actions.inventory.ChestAction; +import fr.gravencyg.actions.inventory.ClearAction; +import fr.gravencyg.actions.message.BossBarAction; +import fr.gravencyg.actions.message.MessageAction; +import fr.gravencyg.actions.message.ResetBossBarAction; +import fr.gravencyg.actions.message.TitleAction; +import fr.gravencyg.actions.potion.ClearPotionEffectAction; +import fr.gravencyg.actions.potion.PotionEffectAction; +import fr.gravencyg.actions.team.TeamAction; +import fr.gravencyg.actions.toggle.*; +import fr.gravencyg.actions.waitable.WaitAction; +import fr.gravencyg.actions.waitable.WaitAction2; +import fr.gravencyg.actions.waitable.WaitAction3; +import fr.gravencyg.model.ActionProcess; +import fr.gravencyg.model.Plot; +import fr.gravencyg.model.Storage; +import fr.gravencyg.utils.CLevel; +import org.bukkit.Material; +import org.bukkit.block.Block; +import org.bukkit.entity.Player; + +import java.util.HashMap; +import java.util.Map; + +public class ActionRegisters { + + private CYG main; + + private Map actions = new HashMap<>(); + + public ActionRegisters(CYG main) { + this.main = main; + + // basic + registerAction(1, Material.CHEST, new ChestAction(main)); + registerAction(2, Material.NETHER_QUARTZ_ORE, new ClearAction(main)); + registerAction(3, Material.NOTE_BLOCK, new MusicAction(main)); + registerAction(4, Material.MYCELIUM, new RestorePlayer(main)); + registerAction(5, Material.SPONGE, new RegenMapAction(main)); + registerAction(6, Material.OBSERVER, new ChangeGameModeAction(main)); + registerAction(7, Material.BREWING_STAND, new PotionEffectAction(main)); + registerAction(8, Material.NETHERRACK, new ClearPotionEffectAction(main)); + + registerAction(9, Material.BEACON, new TeleportAction(main)); + registerAction(10, Material.SPAWNER, new MonsterSpawnAction(main)); + registerAction(11, Material.JACK_O_LANTERN, new KillMonsterAction(main)); + registerAction(12, Material.DROPPER, new DropItemAction(main)); + registerAction(13, Material.BLACK_STAINED_GLASS, new SetBlockAction(main)); + registerAction(14, Material.GLASS, new RemoveBlockAction(main)); + + // message + registerAction(18, Material.BOOKSHELF, new MessageAction(main)); + registerAction(19, Material.SEA_LANTERN, new TitleAction(main)); + registerAction(20, Material.SOUL_SAND, new BossBarAction(main)); + registerAction(21, Material.END_STONE_BRICKS, new ResetBossBarAction(main)); + registerAction(15, Material.GLOWSTONE, new ToggleGlowAction(main)); + + // game + // registerAction(36, Material.GOLD_BLOCK, new TeamAction(main)); + registerAction(36, Material.REDSTONE_BLOCK, new EliminateAction(main)); + registerAction(37, Material.DIAMOND_BLOCK, new WinnerAction(main)); + registerAction(38, Material.NETHER_BRICKS, new StopGameAction(main)); + registerAction(39, Material.WHITE_WOOL, new TeamAction(main)); + + // toggle + registerAction(45, Material.SLIME_BLOCK, new ToggleFallDamage(main)); + registerAction(46, Material.IRON_BLOCK, new TogglePvPAction(main)); + registerAction(47, Material.EMERALD_BLOCK, new ToggleBuildAction(main)); + registerAction(48, Material.QUARTZ_BLOCK, new ToggleFlyAction(main)); + registerAction(49, Material.PACKED_ICE, new ToggleFreezeAction(main)); + + // others + registerAction(43, Material.STONE, new PassAction(main)); + registerAction(35, Material.COBWEB, new RandomAction(main)); + registerAction(44, Material.HOPPER, new ConditionAction(main)); + + registerAction(51, Material.LEGACY_WOOD_STEP, new WaitAction(main)); + registerAction(52, Material.LEGACY_STEP, new WaitAction2(main)); + registerAction(53, Material.LEGACY_STONE_SLAB2, new WaitAction3(main)); + + + } + + public void registerAction(int slot, Material material, Action action){ + action.setSlot(slot); + this.actions.put(material, action); + } + + public void execute(ActionProcess actionProcess, Block block){ + if (!actions.containsKey(block.getType())) + { + return; + } + + Storage storage = main.getDataManager().getStorageByUUID(block.getWorld().getName()); + int storageOwnerLevel = storage.getLevel(); + + if(main.getActionBlocks().getActions().containsKey(block.getType())) + { + Action ac = main.getActionBlocks().getActions().get(block.getType()); + int requireLevel = ac.getRequireLevel().getRealLevel(); + if(requireLevel > storageOwnerLevel) + { + actionProcess.getPlayers().get(0).sendMessage("§cLe créateur du jeu doit obtenir le §nNiveau "+requireLevel+"§r§c pour utiliser l'instruction §n" + ac.title().replace("§9","§c§n")); + return; + } + } + + if(block.getType() == Material.IRON_BLOCK || block.getType() == Material.EMERALD_BLOCK ) + { + actions.get(block.getType()).onExecute(actionProcess.getPlayers().get(0), block, actionProcess); + } + else + { + for(Player player : actionProcess.getPlayers()) + { + if(player.getWorld().getName().equalsIgnoreCase(block.getWorld().getName())) { + actions.get(block.getType()).onExecute(player, block, actionProcess); + } + } + } + + + } + + public Map getActions() { + return actions; + } +} diff --git a/src/main/java/fr/gravencyg/actions/basic/ChangeGameModeAction.java b/src/main/java/fr/gravencyg/actions/basic/ChangeGameModeAction.java new file mode 100644 index 0000000..cbf2091 --- /dev/null +++ b/src/main/java/fr/gravencyg/actions/basic/ChangeGameModeAction.java @@ -0,0 +1,68 @@ +package fr.gravencyg.actions.basic; + +import fr.gravencyg.CYG; +import fr.gravencyg.actions.Action; +import fr.gravencyg.model.ActionProcess; +import fr.gravencyg.utils.CLevel; +import org.bukkit.ChatColor; +import org.bukkit.GameMode; +import org.bukkit.Material; +import org.bukkit.block.Block; +import org.bukkit.block.BrewingStand; +import org.bukkit.entity.Player; +import org.bukkit.inventory.ItemStack; + +public class ChangeGameModeAction extends Action { + + public ChangeGameModeAction(CYG main) { + super(main, CLevel.LEVEL3); + } + + @Override + public String title() { + return ChatColor.BLUE + "ChangeGameMode()"; + } + + @Override + public String lore() { + return ChatColor.GRAY + "Change le mode de jeu"; + } + + @Override + public void onExecute(Player player, Block block, ActionProcess actionProcess) { + + int level = 0; + + for(int i = 0; i < 4; i++) + { + Block top = block.getLocation().clone().add(0, i+1, 0).getBlock(); + if(top.getType() != Material.OBSERVER) break; + level++; + } + + if(level == 0) + { + player.setGameMode(GameMode.SURVIVAL); + player.sendMessage("§rPassage en §asurvie !"); + } + + if(level == 1) + { + player.setGameMode(GameMode.ADVENTURE); + player.sendMessage("§rPassage en §caventure !"); + } + + if(level == 2) + { + player.setGameMode(GameMode.CREATIVE); + player.sendMessage("§rPassage en §9créatif !"); + } + + if(level == 3) + { + player.setGameMode(GameMode.CREATIVE); + player.sendMessage("§rPassage en §7spectateur !"); + } + + } +} diff --git a/src/main/java/fr/gravencyg/actions/basic/ConditionAction.java b/src/main/java/fr/gravencyg/actions/basic/ConditionAction.java new file mode 100644 index 0000000..c16ce7e --- /dev/null +++ b/src/main/java/fr/gravencyg/actions/basic/ConditionAction.java @@ -0,0 +1,67 @@ +package fr.gravencyg.actions.basic; + +import fr.gravencyg.CYG; +import fr.gravencyg.actions.Action; +import fr.gravencyg.actions.team.Team; +import fr.gravencyg.game.CYGame; +import fr.gravencyg.model.ActionProcess; +import fr.gravencyg.utils.CLevel; +import org.bukkit.ChatColor; +import org.bukkit.Location; +import org.bukkit.Material; +import org.bukkit.block.Block; +import org.bukkit.entity.Player; + +import java.util.Random; + +public class ConditionAction extends Action { + + private Random random = new Random(); + + public ConditionAction(CYG main) { + super(main, CLevel.LEVEL2); + } + + @Override + public String title() { + return ChatColor.BLUE + "If()"; + } + + @Override + public String lore() { + return ChatColor.GRAY + "Verifier si quelquechose est vrai"; + } + + @Override + public void onExecute(Player player, Block block, ActionProcess actionProcess) { + + Location bottomBlock = block.getLocation().clone().add(0, -1, 0); + Location topBlock = block.getLocation().clone().add(0, 1, 0); + + + if(bottomBlock.getBlock().getType() == null) return; + + /*if(topBlock.getBlock().getType() == Material.WOOL ) + { + if(main.getGameManager().isPlayerInGame(player).size() != 0) + { + CYGame game = main.getGameManager().getCurrentGame(player); + Team team = Team.getByWoolData(topBlock.getBlock().getData()); + if(team != null && game.getTeams().containsKey(team)) + { + if(!game.getTeams().get(team).contains(player)){ + player.sendMessage("Vous n'êtes pas dans l'equipe " + team.getColor() + team.getName()); + actionProcess.getProcessedBlocks().clear(); + } + } + } + }*/ + + if (bottomBlock.getBlock().getType() != actionProcess.getMaterial() && bottomBlock.getBlock().getType() != Material.GRASS){ + actionProcess.getProcessedBlocks().clear(); + } + + } + + +} diff --git a/src/main/java/fr/gravencyg/actions/basic/DropItemAction.java b/src/main/java/fr/gravencyg/actions/basic/DropItemAction.java new file mode 100644 index 0000000..cd3c9d2 --- /dev/null +++ b/src/main/java/fr/gravencyg/actions/basic/DropItemAction.java @@ -0,0 +1,61 @@ +package fr.gravencyg.actions.basic; + +import fr.gravencyg.CYG; +import fr.gravencyg.actions.Action; +import fr.gravencyg.model.ActionProcess; +import fr.gravencyg.model.Plot; +import fr.gravencyg.utils.CLevel; +import fr.gravencyg.utils.LocationUtils; +import org.bukkit.ChatColor; +import org.bukkit.Location; +import org.bukkit.Material; +import org.bukkit.block.Block; +import org.bukkit.block.Dropper; +import org.bukkit.entity.Player; +import org.bukkit.inventory.ItemStack; + +import java.util.Random; + +public class DropItemAction extends Action { + + private Random random = new Random(); + + public DropItemAction(CYG main) { + super(main, CLevel.LEVEL8); + } + + @Override + public String title() { + return ChatColor.BLUE + "DropItem()"; + } + + @Override + public String lore() { + return ChatColor.GRAY + "Jete un item à un endroit specifique"; + } + + @Override + public void onExecute(Player player, Block block, ActionProcess actionProcess) { + Plot plot = main.getDataManager().getPlotFromWorldLocationOf(player); + Location loc = block.getLocation().clone().add(0, 1, 0); + + if(loc.getBlock().getType() == Material.BEACON){ + + if(plot.getLocationsSet().containsKey(LocationUtils.fromLocToString(loc))) { + + String locName = plot.getLocationsSet().get(LocationUtils.fromLocToString(loc)); + Location spawnPoint = LocationUtils.fromStringToLocComplete(loc.getWorld().getName(), plot.getLocations().get(locName)); + + Dropper dropper = (Dropper) block.getState(); + + for(ItemStack it : dropper.getInventory().getContents()) { + if(it == null) continue; + + spawnPoint.getWorld().dropItem(spawnPoint, it); + } + + } + } + } + +} diff --git a/src/main/java/fr/gravencyg/actions/basic/KillMonsterAction.java b/src/main/java/fr/gravencyg/actions/basic/KillMonsterAction.java new file mode 100644 index 0000000..f4c405c --- /dev/null +++ b/src/main/java/fr/gravencyg/actions/basic/KillMonsterAction.java @@ -0,0 +1,41 @@ +package fr.gravencyg.actions.basic; + +import fr.gravencyg.CYG; +import fr.gravencyg.actions.Action; +import fr.gravencyg.model.ActionProcess; +import fr.gravencyg.utils.CLevel; +import org.bukkit.ChatColor; +import org.bukkit.block.Block; +import org.bukkit.entity.Entity; +import org.bukkit.entity.EntityType; +import org.bukkit.entity.Player; + +public class KillMonsterAction extends Action { + + public KillMonsterAction(CYG main) { + super(main, CLevel.LEVEL11); + } + + @Override + public String title() { + return ChatColor.BLUE + "KillMonster()"; + } + + @Override + public String lore() { + return ChatColor.GRAY + "Tuer toutes les entités du monde"; + } + + @Override + public void onExecute(Player player, Block block, ActionProcess actionProcess) { + + for(Entity entity : block.getWorld().getEntities()) + { + if(entity.getType() == EntityType.ARMOR_STAND || entity.getType() == EntityType.PLAYER) continue; + entity.remove(); + } + + } + + +} diff --git a/src/main/java/fr/gravencyg/actions/basic/MonsterSpawnAction.java b/src/main/java/fr/gravencyg/actions/basic/MonsterSpawnAction.java new file mode 100644 index 0000000..527bacc --- /dev/null +++ b/src/main/java/fr/gravencyg/actions/basic/MonsterSpawnAction.java @@ -0,0 +1,54 @@ +package fr.gravencyg.actions.basic; + +import fr.gravencyg.CYG; +import fr.gravencyg.actions.Action; +import fr.gravencyg.model.ActionProcess; +import fr.gravencyg.model.Plot; +import fr.gravencyg.utils.CLevel; +import fr.gravencyg.utils.LocationUtils; +import org.bukkit.ChatColor; +import org.bukkit.Location; +import org.bukkit.Material; +import org.bukkit.block.Block; +import org.bukkit.block.CreatureSpawner; +import org.bukkit.entity.Entity; +import org.bukkit.entity.Player; + +public class MonsterSpawnAction extends Action { + + public MonsterSpawnAction(CYG main) { + super(main, CLevel.LEVEL11); + } + + @Override + public String title() { + return ChatColor.BLUE + "SpawnMonster()"; + } + + @Override + public String lore() { + return ChatColor.GRAY + "Faire apparaitre un monstre"; + } + + @Override + public void onExecute(Player player, Block block, ActionProcess actionProcess) { + Plot plot = main.getDataManager().getPlotFromWorldLocationOf(player); + Location loc = block.getLocation().clone().add(0, 1, 0); + + if(loc.getBlock().getType() == Material.BEACON){ + + if(plot.getLocationsSet().containsKey(LocationUtils.fromLocToString(loc))) { + + String locName = plot.getLocationsSet().get(LocationUtils.fromLocToString(loc)); + Location tpPoint = LocationUtils.fromStringToLocComplete(loc.getWorld().getName(), plot.getLocations().get(locName)); + + CreatureSpawner spawner = (CreatureSpawner) block.getState(); + Entity entity = loc.getWorld().spawnEntity(tpPoint, spawner.getSpawnedType()); + + } + } + + } + + +} diff --git a/src/main/java/fr/gravencyg/actions/basic/MusicAction.java b/src/main/java/fr/gravencyg/actions/basic/MusicAction.java new file mode 100644 index 0000000..2b6da57 --- /dev/null +++ b/src/main/java/fr/gravencyg/actions/basic/MusicAction.java @@ -0,0 +1,38 @@ +package fr.gravencyg.actions.basic; + +import fr.gravencyg.CYG; +import fr.gravencyg.actions.Action; +import fr.gravencyg.model.ActionProcess; +import fr.gravencyg.utils.CLevel; +import org.bukkit.ChatColor; +import org.bukkit.Instrument; +import org.bukkit.block.Block; +import org.bukkit.block.BlockState; +import org.bukkit.block.data.type.NoteBlock; +import org.bukkit.entity.Player; + +public class MusicAction extends Action { + + public MusicAction(CYG main) { + super(main, CLevel.LEVEL2); + } + + @Override + public String title() { + return ChatColor.BLUE + "PlayNote()"; + } + + @Override + public String lore() { + return ChatColor.GRAY + "Jouer une note de musique"; + } + + @Override + public void onExecute(Player player, Block block, ActionProcess actionProcess) { + BlockState bs = block.getState(); + if (bs instanceof NoteBlock) { + NoteBlock b = (NoteBlock) bs; + player.playNote(player.getLocation(), b.getInstrument(), b.getNote()); + } + } +} diff --git a/src/main/java/fr/gravencyg/actions/basic/PassAction.java b/src/main/java/fr/gravencyg/actions/basic/PassAction.java new file mode 100644 index 0000000..65fce40 --- /dev/null +++ b/src/main/java/fr/gravencyg/actions/basic/PassAction.java @@ -0,0 +1,40 @@ +package fr.gravencyg.actions.basic; + +import fr.gravencyg.CYG; +import fr.gravencyg.actions.Action; +import fr.gravencyg.game.CYGame; +import fr.gravencyg.model.ActionProcess; +import fr.gravencyg.model.Plot; +import fr.gravencyg.utils.CLevel; +import fr.gravencyg.utils.LocationUtils; +import org.bukkit.ChatColor; +import org.bukkit.Location; +import org.bukkit.Material; +import org.bukkit.block.Block; +import org.bukkit.entity.Player; + +import java.util.ArrayList; +import java.util.List; +import java.util.Random; + +public class PassAction extends Action { + + public PassAction(CYG main) { + super(main, CLevel.LEVEL2); + } + + @Override + public String title() { + return ChatColor.BLUE + "Pass()"; + } + + @Override + public String lore() { + return ChatColor.GRAY + "Ce code ne fait rien"; + } + + @Override + public void onExecute(Player player, Block block, ActionProcess process) {} + + +} diff --git a/src/main/java/fr/gravencyg/actions/basic/RandomAction.java b/src/main/java/fr/gravencyg/actions/basic/RandomAction.java new file mode 100644 index 0000000..fb71548 --- /dev/null +++ b/src/main/java/fr/gravencyg/actions/basic/RandomAction.java @@ -0,0 +1,36 @@ +package fr.gravencyg.actions.basic; + +import fr.gravencyg.CYG; +import fr.gravencyg.actions.Action; +import fr.gravencyg.model.ActionProcess; +import fr.gravencyg.utils.CLevel; +import org.bukkit.ChatColor; +import org.bukkit.block.Block; +import org.bukkit.entity.Player; + +import java.util.Random; + +public class RandomAction extends Action { + + private Random random = new Random(); + + public RandomAction(CYG main) { + super(main, CLevel.LEVEL1); + } + + @Override + public String title() { + return ChatColor.BLUE + "Random()"; + } + + @Override + public String lore() { + return ChatColor.GRAY + "Ajouter du hasard à une instruction"; + } + + @Override + public void onExecute(Player player, Block block, ActionProcess actionProcess) { + + } + +} diff --git a/src/main/java/fr/gravencyg/actions/basic/RestorePlayer.java b/src/main/java/fr/gravencyg/actions/basic/RestorePlayer.java new file mode 100644 index 0000000..49a7c09 --- /dev/null +++ b/src/main/java/fr/gravencyg/actions/basic/RestorePlayer.java @@ -0,0 +1,34 @@ +package fr.gravencyg.actions.basic; + +import fr.gravencyg.CYG; +import fr.gravencyg.actions.Action; +import fr.gravencyg.model.ActionProcess; +import fr.gravencyg.utils.CLevel; +import org.bukkit.ChatColor; +import org.bukkit.block.Block; +import org.bukkit.block.DaylightDetector; +import org.bukkit.entity.Player; + +public class RestorePlayer extends Action { + + public RestorePlayer(CYG main) { + super(main, CLevel.LEVEL12); + } + + @Override + public String title() { + return ChatColor.BLUE + "Restore()"; + } + + @Override + public String lore() { + return ChatColor.GRAY + "Soigne et remplit la faim"; + } + + @Override + public void onExecute(Player player, Block block, ActionProcess actionProcess) { + player.setHealth(20); + player.setFoodLevel(20); + } + +} diff --git a/src/main/java/fr/gravencyg/actions/basic/TeleportAction.java b/src/main/java/fr/gravencyg/actions/basic/TeleportAction.java new file mode 100644 index 0000000..975c13c --- /dev/null +++ b/src/main/java/fr/gravencyg/actions/basic/TeleportAction.java @@ -0,0 +1,112 @@ +package fr.gravencyg.actions.basic; + +import fr.gravencyg.CYG; +import fr.gravencyg.actions.Action; +import fr.gravencyg.game.CYGame; +import fr.gravencyg.model.ActionProcess; +import fr.gravencyg.model.Plot; +import fr.gravencyg.utils.CLevel; +import fr.gravencyg.utils.LocationUtils; +import org.bukkit.Bukkit; +import org.bukkit.ChatColor; +import org.bukkit.Location; +import org.bukkit.Material; +import org.bukkit.block.Block; +import org.bukkit.entity.Player; + +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.Random; + +public class TeleportAction extends Action { + + private Random random = new Random(); + + public TeleportAction(CYG main) { + super(main, CLevel.LEVEL1); + } + + @Override + public String title() { + return ChatColor.BLUE + "Teleport()"; + } + + @Override + public String lore() { + return ChatColor.GRAY + "Téléporter le joueur à une zone"; + } + + @Override + public void onExecute(Player player, Block block, ActionProcess process) { + Plot plot = main.getDataManager().getPlotFromWorldLocationOf(player); + + if(plot.getLocationsSet().containsKey(LocationUtils.fromLocToString(block.getLocation()))) { + + List locations = new ArrayList<>(); + String locName = plot.getLocationsSet().get(LocationUtils.fromLocToString(block.getLocation())); + locations.add(locName); + + boolean isRandom = false; + + for(int i = 1; i < 100; i++){ + Location blockToTop = block.getLocation().clone().add(0, i, 0); + + if(blockToTop.getBlock().getType() == Material.COBWEB){ + isRandom = true; + break; + } + + if(blockToTop.getBlock().getType() != Material.BEACON) + break; + + locations.add( plot.getLocationsSet().get(LocationUtils.fromLocToString(blockToTop))); + } + + if(isRandom) + { + String randomLocation = locations.get(random.nextInt(locations.size())); + teleport(player, randomLocation, plot); + } + else + { + + if(main.getGameManager().isPlayerInGame(player).size() != 0){ + CYGame game = main.getGameManager().getCurrentGame(player); + int playerIndex = game.getPlayerIndex(player); + + if(locations.size() < playerIndex) { + if(locations.contains(playerIndex)) { + teleport(player, locations.get(playerIndex), plot); + } + } + else + { + teleport(player, locations.get(random.nextInt(locations.size())), plot); + } + + } + + else{ + teleport(player, locations.get(0), plot); + } + } + + } + else + { + player.sendMessage("§eAucun point de téléportation définit !"); + } + + } + + public void teleport(Player player, String locName, Plot plot) { + if (plot.getLocations().containsKey(locName)) { + Location tpPoint = LocationUtils.fromStringToLocComplete(player.getWorld().getName(), plot.getLocations().get(locName)); + player.teleport(tpPoint); + player.sendMessage("§bTéléportation vers " + locName); + } else { + player.sendMessage("§bZone inexisante " + locName); + } + } +} diff --git a/src/main/java/fr/gravencyg/actions/block/RegenMapAction.java b/src/main/java/fr/gravencyg/actions/block/RegenMapAction.java new file mode 100644 index 0000000..f4278b8 --- /dev/null +++ b/src/main/java/fr/gravencyg/actions/block/RegenMapAction.java @@ -0,0 +1,40 @@ +package fr.gravencyg.actions.block; + +import fr.gravencyg.CYG; +import fr.gravencyg.actions.Action; +import fr.gravencyg.game.CYGame; +import fr.gravencyg.model.ActionProcess; +import fr.gravencyg.utils.CLevel; +import org.bukkit.ChatColor; +import org.bukkit.block.Block; +import org.bukkit.entity.Player; + +public class RegenMapAction extends Action { + + public RegenMapAction(CYG main) { + super(main, CLevel.LEVEL5); + } + + @Override + public String title() { + return ChatColor.BLUE + "RegenMap()"; + } + + @Override + public String lore() { + return ChatColor.GRAY + "Régénerer les blocs de la partie"; + } + + @Override + public void onExecute(Player player, Block block, ActionProcess actionProcess) { + if(main.getGameManager().isPlayerInGame(player).size() != 0) + { + CYGame game = main.getGameManager().getCurrentGame(player); + main.getGameManager().regenMap(game); + main.getGameManager().broadcast(game, "§eRégéneration de la carte"); + } + else{ + player.sendMessage("§eRegeneration de la carte !"); + } + } +} diff --git a/src/main/java/fr/gravencyg/actions/block/RemoveBlockAction.java b/src/main/java/fr/gravencyg/actions/block/RemoveBlockAction.java new file mode 100644 index 0000000..02fe6a8 --- /dev/null +++ b/src/main/java/fr/gravencyg/actions/block/RemoveBlockAction.java @@ -0,0 +1,56 @@ +package fr.gravencyg.actions.block; + +import fr.gravencyg.CYG; +import fr.gravencyg.actions.Action; +import fr.gravencyg.game.CYGame; +import fr.gravencyg.model.ActionProcess; +import fr.gravencyg.model.MaterialAndData; +import fr.gravencyg.model.Plot; +import fr.gravencyg.utils.CLevel; +import fr.gravencyg.utils.LocationUtils; +import org.bukkit.ChatColor; +import org.bukkit.Location; +import org.bukkit.Material; +import org.bukkit.block.Block; +import org.bukkit.block.Dropper; +import org.bukkit.entity.Player; +import org.bukkit.inventory.ItemStack; + +import java.util.Random; + +public class RemoveBlockAction extends Action { + + private Random random = new Random(); + + public RemoveBlockAction(CYG main) { + super(main, CLevel.LEVEL6); + } + + @Override + public String title() { + return ChatColor.BLUE + "RemoveBlock()"; + } + + @Override + public String lore() { + return ChatColor.GRAY + "Supprime un bloc"; + } + + @Override + public void onExecute(Player player, Block block, ActionProcess actionProcess) { + + if(main.getGameManager().isPlayerInGame(player).size() != 0) { + if(actionProcess.getBlock().getType() != Material.AIR) + { + CYGame game = main.getGameManager().getCurrentGame(player); + game.getBreakBlocks().put(actionProcess.getBlock().getLocation(), new MaterialAndData(actionProcess.getBlock().getType(), actionProcess.getBlock().getData())); + actionProcess.getBlock().setType(Material.AIR); + } + } + else{ + player.sendMessage("§eRemoveBlock(event.getBlock())"); + } + + } + +} diff --git a/src/main/java/fr/gravencyg/actions/block/SetBlockAction.java b/src/main/java/fr/gravencyg/actions/block/SetBlockAction.java new file mode 100644 index 0000000..eba525b --- /dev/null +++ b/src/main/java/fr/gravencyg/actions/block/SetBlockAction.java @@ -0,0 +1,65 @@ +package fr.gravencyg.actions.block; + +import fr.gravencyg.CYG; +import fr.gravencyg.actions.Action; +import fr.gravencyg.game.CYGame; +import fr.gravencyg.model.ActionProcess; +import fr.gravencyg.model.MaterialAndData; +import fr.gravencyg.utils.CLevel; +import org.bukkit.ChatColor; +import org.bukkit.Material; +import org.bukkit.block.Block; +import org.bukkit.entity.Player; + +import java.util.Random; + +public class SetBlockAction extends Action { + + private Random random = new Random(); + + public SetBlockAction(CYG main) { + super(main, CLevel.LEVEL6); + } + + @Override + public String title() { + return ChatColor.BLUE + "SetBlock()"; + } + + @Override + public String lore() { + return ChatColor.GRAY + "Place un bloc à un endroit"; + } + + @Override + public void onExecute(Player player, Block block, ActionProcess actionProcess) { + + Block top = block.getLocation().clone().add(0, 1, 0).getBlock(); + + if(top.getType() == Material.AIR) return; + + if(main.getGameManager().isPlayerInGame(player).size() != 0) { + if(actionProcess.getBlock().getType() != Material.AIR) + { + CYGame game = main.getGameManager().getCurrentGame(player); + + if(!game.getBreakBlocks().containsKey(actionProcess.getBlock().getLocation())) { + game.getBreakBlocks().put( + actionProcess.getBlock().getLocation(), + new MaterialAndData(actionProcess.getBlock().getType(), actionProcess.getBlock().getData()) + ); + } + + // place new block + actionProcess.getBlock().setType(top.getType()); + // actionProcess.getBlock().setData(top.getData()); + + } + } + else{ + player.sendMessage("§eSetBlock(event.getBlock())"); + } + + } + +} diff --git a/src/main/java/fr/gravencyg/actions/game/EliminateAction.java b/src/main/java/fr/gravencyg/actions/game/EliminateAction.java new file mode 100644 index 0000000..558c32a --- /dev/null +++ b/src/main/java/fr/gravencyg/actions/game/EliminateAction.java @@ -0,0 +1,43 @@ +package fr.gravencyg.actions.game; + +import fr.gravencyg.CYG; +import fr.gravencyg.actions.Action; +import fr.gravencyg.game.CYGame; +import fr.gravencyg.model.ActionProcess; +import fr.gravencyg.utils.CLevel; +import org.bukkit.ChatColor; +import org.bukkit.block.Block; +import org.bukkit.entity.Player; + +import java.util.Random; + +public class EliminateAction extends Action { + + private Random random = new Random(); + + public EliminateAction(CYG main) { + super(main, CLevel.LEVEL1); + } + + @Override + public String title() { + return ChatColor.BLUE +"Eliminate()"; + } + + @Override + public String lore() { + return ChatColor.GRAY +"Elimine le joueur de la partie"; + } + + @Override + public void onExecute(Player player, Block block, ActionProcess actionProcess) { + + if(main.getGameManager().isPlayerInGame(player).size() != 0) + { + CYGame game = main.getGameManager().getCurrentGame(player); + main.getGameManager().eliminate(player, game); + } + + } + +} diff --git a/src/main/java/fr/gravencyg/actions/game/StopGameAction.java b/src/main/java/fr/gravencyg/actions/game/StopGameAction.java new file mode 100644 index 0000000..731f134 --- /dev/null +++ b/src/main/java/fr/gravencyg/actions/game/StopGameAction.java @@ -0,0 +1,43 @@ +package fr.gravencyg.actions.game; + +import fr.gravencyg.CYG; +import fr.gravencyg.actions.Action; +import fr.gravencyg.game.CYGame; +import fr.gravencyg.model.ActionProcess; +import fr.gravencyg.utils.CLevel; +import org.bukkit.ChatColor; +import org.bukkit.block.Block; +import org.bukkit.entity.Player; + +import java.util.Random; + +public class StopGameAction extends Action { + + private Random random = new Random(); + + public StopGameAction(CYG main) { + super(main, CLevel.LEVEL5); + } + + @Override + public String title() { + return ChatColor.BLUE +"StopGame()"; + } + + @Override + public String lore() { + return ChatColor.GRAY +"Arrete le jeu actuel"; + } + + @Override + public void onExecute(Player player, Block block, ActionProcess actionProcess) { + + if(main.getGameManager().isPlayerInGame(player).size() != 0) + { + CYGame game = main.getGameManager().getCurrentGame(player); + main.getGameManager().stop(game); + } + + } + +} diff --git a/src/main/java/fr/gravencyg/actions/game/WinnerAction.java b/src/main/java/fr/gravencyg/actions/game/WinnerAction.java new file mode 100644 index 0000000..e86d15c --- /dev/null +++ b/src/main/java/fr/gravencyg/actions/game/WinnerAction.java @@ -0,0 +1,46 @@ +package fr.gravencyg.actions.game; + +import fr.gravencyg.CYG; +import fr.gravencyg.actions.Action; +import fr.gravencyg.game.CYGame; +import fr.gravencyg.model.ActionProcess; +import fr.gravencyg.utils.CLevel; +import org.bukkit.ChatColor; +import org.bukkit.block.Block; +import org.bukkit.entity.Player; + +import java.util.Random; + +public class WinnerAction extends Action { + + private Random random = new Random(); + + public WinnerAction(CYG main) { + super(main, CLevel.LEVEL5); + } + + @Override + public String title() { + return ChatColor.BLUE +"Win()"; + } + + @Override + public String lore() { + return ChatColor.GRAY +"Le joueur courant gagne la partie"; + } + + @Override + public void onExecute(Player player, Block block, ActionProcess actionProcess) { + + if(main.getGameManager().isPlayerInGame(player).size() != 0) + { + CYGame game = main.getGameManager().getCurrentGame(player); + for(Player p : game.getPlayers()) + { + if(p != player) main.getGameManager().eliminate(p, game); + } + } + + } + +} diff --git a/src/main/java/fr/gravencyg/actions/inventory/ChestAction.java b/src/main/java/fr/gravencyg/actions/inventory/ChestAction.java new file mode 100644 index 0000000..6a46230 --- /dev/null +++ b/src/main/java/fr/gravencyg/actions/inventory/ChestAction.java @@ -0,0 +1,146 @@ +package fr.gravencyg.actions.inventory; + +import fr.gravencyg.CYG; +import fr.gravencyg.actions.Action; +import fr.gravencyg.model.ActionProcess; +import fr.gravencyg.model.Plot; +import fr.gravencyg.utils.CLevel; +import fr.gravencyg.utils.LocationUtils; +import org.bukkit.Bukkit; +import org.bukkit.ChatColor; +import org.bukkit.Location; +import org.bukkit.Material; +import org.bukkit.block.Block; +import org.bukkit.block.Chest; +import org.bukkit.entity.Player; +import org.bukkit.inventory.ItemStack; + +import java.util.ArrayList; +import java.util.List; +import java.util.Random; + +public class ChestAction extends Action { + + private Random random = new Random(); + + public ChestAction(CYG main) { + super(main, CLevel.LEVEL1); + } + + @Override + public String title() { + return ChatColor.BLUE +"Stuff()"; + } + + @Override + public String lore() { + return ChatColor.GRAY +"Offrir du stuff à un joueur"; + } + + @Override + public void onExecute(Player player, Block block, ActionProcess actionProcess) { + + Block top = block.getLocation().clone().add(0, 1, 0).getBlock(); + + if(top.getType() == Material.BEACON){ + + for(int i = 1; i < 100; i++){ + Location blockToTop = block.getLocation().clone().add(0, i, 0); + + if(blockToTop.getBlock().getType() != Material.BEACON) break; + + refillChest(player, block, blockToTop.getBlock()); + } + + } + + else{ + giveStuff(player, block); + } + + + } + + public void giveStuff(Player player, Block block){ + + Chest chest = (Chest) block.getState(); + + List items = new ArrayList<>(); + + for (ItemStack it : chest.getInventory().getContents()) + { + if (it == null) continue; + items.add(it); + } + + boolean isRandom = false; + int randomNbItems = 0; + + for(int i = 1; i < 100; i++){ + Location blockToTop = block.getLocation().clone().add(0, i, 0); + + if(blockToTop.getBlock().getType() == Material.AIR) + break; + + isRandom = true; + randomNbItems += 1; + } + + if(isRandom) + { + for(int i = 0; i < randomNbItems; i++) + { + ItemStack randomItem = items.get(random.nextInt(items.size())); + main.getArmorManager().addItem(player, randomItem); + } + } + + else { + for (ItemStack item : items) { + if (item == null) continue; + + main.getArmorManager().addItem(player, item); + } + } + } + + public void refillChest(Player player, Block block, Block tpBlock){ + + Chest chest = (Chest) block.getState(); + Plot plot = main.getDataManager().getStorageByUUID(block.getWorld().getName()).getPlot(player.getWorld().getName()); + + if(plot.getLocationsSet().containsKey(LocationUtils.fromLocToString(tpBlock.getLocation()))) { + + String locName = plot.getLocationsSet().get(LocationUtils.fromLocToString(tpBlock.getLocation())); + + if(plot.getLocations().containsKey(locName)) + { + player.sendMessage("§bRemplissage du coffre " + locName); + + Location location = LocationUtils.fromStringToLoc(block.getWorld().getName(), plot.getLocations().get(locName)); + + if(location.getBlock().getType() == Material.CHEST) + { + Chest chestTT = (Chest) location.getBlock().getState(); + for(ItemStack it : chest.getInventory().getContents()){ + if(it == null) continue; + + chestTT.getInventory().addItem(it); + } + + } + else{ + player.sendMessage("Aucun coffre n'a été trouvé en §9" + LocationUtils.fromLocToString(tpBlock.getLocation())); + } + } + + } + else{ + player.sendMessage("Aucun coffre n'a été trouvé en §9" + LocationUtils.fromLocToString(tpBlock.getLocation())); + } + + } + + + +} diff --git a/src/main/java/fr/gravencyg/actions/inventory/ClearAction.java b/src/main/java/fr/gravencyg/actions/inventory/ClearAction.java new file mode 100644 index 0000000..b9f00c3 --- /dev/null +++ b/src/main/java/fr/gravencyg/actions/inventory/ClearAction.java @@ -0,0 +1,32 @@ +package fr.gravencyg.actions.inventory; + +import fr.gravencyg.CYG; +import fr.gravencyg.actions.Action; +import fr.gravencyg.model.ActionProcess; +import fr.gravencyg.utils.CLevel; +import org.bukkit.ChatColor; +import org.bukkit.block.Block; +import org.bukkit.entity.Player; + +public class ClearAction extends Action { + + public ClearAction(CYG main) { + super(main, CLevel.LEVEL1); + } + + @Override + public String title() { + return ChatColor.BLUE +"Clear()"; + } + + @Override + public String lore() { + return ChatColor.GRAY +"Vider l'inventaire du joueur"; + } + + @Override + public void onExecute(Player player, Block block, ActionProcess actionProcess) { + player.getInventory().clear(); + } + +} diff --git a/src/main/java/fr/gravencyg/actions/message/BossBarAction.java b/src/main/java/fr/gravencyg/actions/message/BossBarAction.java new file mode 100644 index 0000000..1142e73 --- /dev/null +++ b/src/main/java/fr/gravencyg/actions/message/BossBarAction.java @@ -0,0 +1,55 @@ +package fr.gravencyg.actions.message; + +import fr.gravencyg.CYG; +import fr.gravencyg.actions.Action; +import fr.gravencyg.model.ActionProcess; +import fr.gravencyg.model.Plot; +import fr.gravencyg.utils.CLevel; +import fr.gravencyg.utils.LocationUtils; +import org.bukkit.Bukkit; +import org.bukkit.ChatColor; +import org.bukkit.Location; +import org.bukkit.Material; +import org.bukkit.block.Block; +import org.bukkit.boss.BarColor; +import org.bukkit.boss.BarStyle; +import org.bukkit.boss.BossBar; +import org.bukkit.entity.Player; + +public class BossBarAction extends Action { + + public BossBarAction(CYG main) { + super(main, CLevel.LEVEL9); + } + + @Override + public String title() { + return ChatColor.BLUE + "SendBossBar()"; + } + + @Override + public String lore() { + return ChatColor.GRAY + "Envoyer un message en bar de boss "; + } + + @Override + public void onExecute(Player player, Block block, ActionProcess actionProcess) { + Plot plot = main.getDataManager().getPlotFromWorldLocationOf(player); + + if(plot.getMessageSet().containsKey(LocationUtils.fromLocToString(block.getLocation()))) { + String messageLocName = plot.getMessageSet().get(LocationUtils.fromLocToString(block.getLocation())); + String message = plot.getMessages().get(messageLocName) + .replace("&", "§"); + + BarColor barColor = BarColor.BLUE; + + Location top = block.getLocation().clone().add(0, 1, 0); + + BossBar bossBar = Bukkit.createBossBar(message, barColor, BarStyle.SOLID); + bossBar.setProgress(1); + + bossBar.addPlayer(player); + main.getBarActions().add(bossBar); + } + } +} diff --git a/src/main/java/fr/gravencyg/actions/message/MessageAction.java b/src/main/java/fr/gravencyg/actions/message/MessageAction.java new file mode 100644 index 0000000..96261d6 --- /dev/null +++ b/src/main/java/fr/gravencyg/actions/message/MessageAction.java @@ -0,0 +1,42 @@ +package fr.gravencyg.actions.message; + +import fr.gravencyg.CYG; +import fr.gravencyg.actions.Action; +import fr.gravencyg.model.ActionProcess; +import fr.gravencyg.model.Plot; +import fr.gravencyg.utils.CLevel; +import fr.gravencyg.utils.LocationUtils; +import org.bukkit.ChatColor; +import org.bukkit.block.Block; +import org.bukkit.entity.Player; + +public class MessageAction extends Action { + + public MessageAction(CYG main) { + super(main, CLevel.LEVEL2); + } + + @Override + public String title() { + return ChatColor.BLUE + "SendMessage()"; + } + + @Override + public String lore() { + return ChatColor.GRAY + "Envoyer un message au joueur"; + } + + @Override + public void onExecute(Player player, Block block, ActionProcess actionProcess) { + Plot plot = main.getDataManager().getPlotFromWorldLocationOf(player); + + if(plot.getMessageSet().containsKey(LocationUtils.fromLocToString(block.getLocation()))) { + String messageLocName = plot.getMessageSet().get(LocationUtils.fromLocToString(block.getLocation())); + String message = plot.getMessages().get(messageLocName) + .replace("&", "§"); + + player.sendMessage(message); + } + + } +} diff --git a/src/main/java/fr/gravencyg/actions/message/ResetBossBarAction.java b/src/main/java/fr/gravencyg/actions/message/ResetBossBarAction.java new file mode 100644 index 0000000..c5db4d3 --- /dev/null +++ b/src/main/java/fr/gravencyg/actions/message/ResetBossBarAction.java @@ -0,0 +1,45 @@ +package fr.gravencyg.actions.message; + +import fr.gravencyg.CYG; +import fr.gravencyg.actions.Action; +import fr.gravencyg.model.ActionProcess; +import fr.gravencyg.model.Plot; +import fr.gravencyg.utils.CLevel; +import fr.gravencyg.utils.LocationUtils; +import org.bukkit.Bukkit; +import org.bukkit.ChatColor; +import org.bukkit.block.Block; +import org.bukkit.boss.BarColor; +import org.bukkit.boss.BarStyle; +import org.bukkit.boss.BossBar; +import org.bukkit.entity.Player; + +import java.util.Map; + +public class ResetBossBarAction extends Action { + + public ResetBossBarAction(CYG main) { + super(main, CLevel.LEVEL9); + } + + @Override + public String title() { + return ChatColor.BLUE + "ResetBossBar()"; + } + + @Override + public String lore() { + return ChatColor.GRAY + "Supprime toutes les bars de boss du joueur"; + } + + @Override + public void onExecute(Player player, Block block, ActionProcess actionProcess) { + for(BossBar bossBarEntry : main.getBarActions()) + { + if(bossBarEntry.getPlayers().contains(player)) + { + bossBarEntry.removeAll(); + } + } + } +} diff --git a/src/main/java/fr/gravencyg/actions/message/TitleAction.java b/src/main/java/fr/gravencyg/actions/message/TitleAction.java new file mode 100644 index 0000000..93148b9 --- /dev/null +++ b/src/main/java/fr/gravencyg/actions/message/TitleAction.java @@ -0,0 +1,41 @@ +package fr.gravencyg.actions.message; + +import fr.gravencyg.CYG; +import fr.gravencyg.actions.Action; +import fr.gravencyg.model.ActionProcess; +import fr.gravencyg.model.Plot; +import fr.gravencyg.utils.CLevel; +import fr.gravencyg.utils.LocationUtils; +import org.bukkit.ChatColor; +import org.bukkit.block.Block; +import org.bukkit.entity.Player; + +public class TitleAction extends Action { + + public TitleAction(CYG main) { + super(main, CLevel.LEVEL2); + } + + @Override + public String title() { + return ChatColor.BLUE + "SendTitle()"; + } + + @Override + public String lore() { + return ChatColor.GRAY + "Envoyer un title au joueur"; + } + + @Override + public void onExecute(Player player, Block block, ActionProcess actionProcess) { + Plot plot = main.getDataManager().getPlotFromWorldLocationOf(player); + + if(plot.getMessageSet().containsKey(LocationUtils.fromLocToString(block.getLocation()))) { + String messageLocName = plot.getMessageSet().get(LocationUtils.fromLocToString(block.getLocation())); + String message = plot.getMessages().get(messageLocName) + .replace("&", "§"); + + player.sendTitle(messageLocName, message); + } + } +} diff --git a/src/main/java/fr/gravencyg/actions/potion/ClearPotionEffectAction.java b/src/main/java/fr/gravencyg/actions/potion/ClearPotionEffectAction.java new file mode 100644 index 0000000..33bbc02 --- /dev/null +++ b/src/main/java/fr/gravencyg/actions/potion/ClearPotionEffectAction.java @@ -0,0 +1,41 @@ +package fr.gravencyg.actions.potion; + +import fr.gravencyg.CYG; +import fr.gravencyg.actions.Action; +import fr.gravencyg.model.ActionProcess; +import fr.gravencyg.utils.CLevel; +import org.bukkit.ChatColor; +import org.bukkit.Material; +import org.bukkit.block.Block; +import org.bukkit.block.BrewingStand; +import org.bukkit.entity.Player; +import org.bukkit.inventory.ItemStack; +import org.bukkit.inventory.meta.PotionMeta; +import org.bukkit.potion.PotionEffect; +import org.bukkit.potion.PotionType; + +public class ClearPotionEffectAction extends Action { + + public ClearPotionEffectAction(CYG main) { + super(main, CLevel.LEVEL7); + } + + @Override + public String title() { + return ChatColor.BLUE + "ClearPotionEffects()"; + } + + @Override + public String lore() { + return ChatColor.GRAY + "Supprimer tout les effets de potions"; + } + + @Override + public void onExecute(Player player, Block block, ActionProcess actionProcess) { + for(PotionEffect potionEffect : player.getActivePotionEffects()) + { + player.removePotionEffect(potionEffect.getType()); + } + player.sendMessage("§9ClearPotionEffects()"); + } +} diff --git a/src/main/java/fr/gravencyg/actions/potion/PotionEffectAction.java b/src/main/java/fr/gravencyg/actions/potion/PotionEffectAction.java new file mode 100644 index 0000000..f865627 --- /dev/null +++ b/src/main/java/fr/gravencyg/actions/potion/PotionEffectAction.java @@ -0,0 +1,54 @@ +package fr.gravencyg.actions.potion; + +import fr.gravencyg.CYG; +import fr.gravencyg.actions.Action; +import fr.gravencyg.model.ActionProcess; +import fr.gravencyg.utils.CLevel; +import org.bukkit.ChatColor; +import org.bukkit.Material; +import org.bukkit.block.Block; +import org.bukkit.block.BrewingStand; +import org.bukkit.entity.Player; +import org.bukkit.inventory.ItemStack; +import org.bukkit.inventory.meta.PotionMeta; +import org.bukkit.potion.*; + +import java.util.Collection; + +public class PotionEffectAction extends Action { + + public PotionEffectAction(CYG main) { + super(main, CLevel.LEVEL7); + } + + @Override + public String title() { + return ChatColor.BLUE + "SendPotionEffect()"; + } + + @Override + public String lore() { + return ChatColor.GRAY + "Appliquer un effet de potion"; + } + + @Override + public void onExecute(Player player, Block block, ActionProcess actionProcess) { + BrewingStand stand = (BrewingStand) block.getState(); + for(int i = 0; i < 3; i++) + { + ItemStack it = stand.getInventory().getItem(i); + + if(it == null) continue; + + if(it.getType() != Material.POTION && it.getType() != Material.SPLASH_POTION) continue; + + PotionMeta meta = (PotionMeta) it.getItemMeta(); + PotionType potionData = meta.getBasePotionData().getType(); + + player.addPotionEffect(new PotionEffect(potionData.getEffectType(), 6000, potionData.getMaxLevel())); + + player.sendMessage("§rSendPotionEffect(§e"+ potionData.getEffectType().getName()+" " + potionData.getMaxLevel()+"§r)"); + } + + } +} diff --git a/src/main/java/fr/gravencyg/actions/team/Team.java b/src/main/java/fr/gravencyg/actions/team/Team.java new file mode 100644 index 0000000..c7b12e5 --- /dev/null +++ b/src/main/java/fr/gravencyg/actions/team/Team.java @@ -0,0 +1,59 @@ +package fr.gravencyg.actions.team; + +import org.bukkit.ChatColor; + +import java.util.HashMap; +import java.util.Map; + +public enum Team { + + WHITE(0, ChatColor.WHITE, "Blanc"), + ORANGE(1, ChatColor.GOLD, "Orange"), + LIGHT_BLUE(3, ChatColor.BLUE, "Bleu Clair"), + YELLOW(4, ChatColor.YELLOW, "Jaune"), + LIGHT_GREEN(5, ChatColor.GREEN, "Vert"), + PINK(6, ChatColor.getByChar("d"), "Rose"), + DARK_GRAY(7, ChatColor.DARK_GRAY, "Gris foncé"), + LIGHT_GRAY(8, ChatColor.GRAY, "Gris clair"), + CYAN(9, ChatColor.LIGHT_PURPLE, "Cyan"), + DARK_PURPLE(10, ChatColor.DARK_PURPLE, "Violet"), + BLUE(11, ChatColor.BLUE, "Bleu"), + RED(14, ChatColor.RED, "Rouge"), + BLACK(15, ChatColor.BLACK, "Noir"); + + private int data; + private ChatColor color; + private String name; + + static Map teamMap = new HashMap<>(); + + static { + for(Team team: values()) + { + teamMap.put(team.getData(), team); + } + } + + Team(int data, ChatColor color, String name) + { + this.data = data; + this.color = color; + this.name = name; + } + + private Integer getData() { + return data; + } + + public ChatColor getColor() { + return color; + } + + public String getName() { + return name; + } + + public static Team getByWoolData(int data){ + return teamMap.get(data); + } +} diff --git a/src/main/java/fr/gravencyg/actions/team/TeamAction.java b/src/main/java/fr/gravencyg/actions/team/TeamAction.java new file mode 100644 index 0000000..e26b31d --- /dev/null +++ b/src/main/java/fr/gravencyg/actions/team/TeamAction.java @@ -0,0 +1,89 @@ +package fr.gravencyg.actions.team; + +import fr.gravencyg.CYG; +import fr.gravencyg.actions.Action; +import fr.gravencyg.game.CYGame; +import fr.gravencyg.model.ActionProcess; +import fr.gravencyg.model.Plot; +import fr.gravencyg.utils.CLevel; +import fr.gravencyg.utils.LocationUtils; +import org.bukkit.ChatColor; +import org.bukkit.Location; +import org.bukkit.Material; +import org.bukkit.block.Block; +import org.bukkit.entity.Player; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collections; +import java.util.List; + +public class TeamAction extends Action { + + public TeamAction(CYG main) { + super(main, CLevel.LEVEL8); + } + + @Override + public String title() { + return ChatColor.BLUE + "Team()"; + } + + @Override + public String lore() { + return ChatColor.GRAY + "Créer un système d'equipe sur votre jeu"; + } + + @Override + public void onExecute(Player player, Block block, ActionProcess actionProcess) { + + Location topBlock = block.getLocation().clone().add(0, 1, 0); + + /* if (topBlock.getBlock().getType() == Material.WOOL) { + + for (int i = 0; i < 25; i++) { + + Block b = block.getLocation().clone().add(0, i, 0).getBlock(); + + if (b.getType() != Material.WOOL) break; + + byte data = b.getData(); + Team team = Team.getByWoolData(data); + + player.sendMessage("Création de l'equipe " + team.getColor() + team.getName() + " !"); + + if (main.getGameManager().isPlayerInGame(player).size() != 0) { + CYGame game = main.getGameManager().getCurrentGame(player); + main.getGameManager().createTeam(game, team); + } + + } + }*/ + + if (topBlock.getBlock().getType() == Material.BEACON) { + byte data = block.getData(); + Team team = Team.getByWoolData(data); + + if (main.getGameManager().isPlayerInGame(player).size() != 0) { + CYGame game = main.getGameManager().getCurrentGame(player); + + + if(game.getTeamPlayer(player) == team) { + + Plot plot = main.getDataManager().getStorageByUUID(player.getWorld().getName()).getPlot(player.getWorld().getName()); + String locPosition = LocationUtils.fromLocToString(topBlock); + String locName = plot.getLocationsSet().get(locPosition); + + if(locName != null && plot.getLocations().containsKey(locName)) { + Location location = LocationUtils.fromStringToLocComplete(player.getWorld().getName(), plot.getLocations().get(locName)); + player.teleport(location); + } + + player.sendMessage("§rTéléportation vers " + team.getColor() + locName); + + } + } + + } + } +} diff --git a/src/main/java/fr/gravencyg/actions/toggle/ToggleBuildAction.java b/src/main/java/fr/gravencyg/actions/toggle/ToggleBuildAction.java new file mode 100644 index 0000000..5344e02 --- /dev/null +++ b/src/main/java/fr/gravencyg/actions/toggle/ToggleBuildAction.java @@ -0,0 +1,50 @@ +package fr.gravencyg.actions.toggle; + +import fr.gravencyg.CYG; +import fr.gravencyg.actions.Action; +import fr.gravencyg.game.CYGame; +import fr.gravencyg.model.ActionProcess; +import fr.gravencyg.utils.CLevel; +import org.bukkit.ChatColor; +import org.bukkit.block.Block; +import org.bukkit.entity.Player; + +public class ToggleBuildAction extends Action { + + public ToggleBuildAction(CYG main) { + super(main, CLevel.LEVEL4); + } + + @Override + public String title() { + return ChatColor.BLUE + "ToggleBuild()"; + } + + @Override + public String lore() { + return ChatColor.GRAY + "Activer / Desactiver la construction"; + } + + @Override + public void onExecute(Player player, Block block, ActionProcess actionProcess) { + if(main.getGameManager().isPlayerInGame(player).size() != 0) + { + CYGame game = main.getGameManager().getCurrentGame(player); + game.toggleBuild(); + + if(game.canFight()) { + main.getGameManager().broadcast(game, "Construction Active !"); + } + else + { + main.getGameManager().broadcast(game, "Construction Inactif !"); + } + } + else + { + player.sendMessage("§eConstruction Active !"); + } + } + + +} diff --git a/src/main/java/fr/gravencyg/actions/toggle/ToggleFallDamage.java b/src/main/java/fr/gravencyg/actions/toggle/ToggleFallDamage.java new file mode 100644 index 0000000..27efa90 --- /dev/null +++ b/src/main/java/fr/gravencyg/actions/toggle/ToggleFallDamage.java @@ -0,0 +1,48 @@ +package fr.gravencyg.actions.toggle; + +import fr.gravencyg.CYG; +import fr.gravencyg.actions.Action; +import fr.gravencyg.game.CYGame; +import fr.gravencyg.model.ActionProcess; +import fr.gravencyg.utils.CLevel; +import org.bukkit.ChatColor; +import org.bukkit.block.Block; +import org.bukkit.entity.Player; + +public class ToggleFallDamage extends Action { + + public ToggleFallDamage(CYG main) { + super(main, CLevel.LEVEL3); + } + + @Override + public String title() { + return ChatColor.BLUE + "ToggleFallDamage()"; + } + + @Override + public String lore() { + return ChatColor.GRAY + "Activer / Desactiver dégats de chute"; + } + + @Override + public void onExecute(Player player, Block block, ActionProcess actionProcess) { + if(main.getGameManager().isPlayerInGame(player).size() != 0) + { + CYGame game = main.getGameManager().getCurrentGame(player); + game.toggleFallDamage(); + + if(game.canFight()) { + main.getGameManager().broadcast(game, "Dégat de chute Active !"); + } + else + { + main.getGameManager().broadcast(game, "Dégat de chute Inactif !"); + } + } + else + { + player.sendMessage("§eDegat de chute Active !"); + } + } +} diff --git a/src/main/java/fr/gravencyg/actions/toggle/ToggleFlyAction.java b/src/main/java/fr/gravencyg/actions/toggle/ToggleFlyAction.java new file mode 100644 index 0000000..8d28d4d --- /dev/null +++ b/src/main/java/fr/gravencyg/actions/toggle/ToggleFlyAction.java @@ -0,0 +1,48 @@ +package fr.gravencyg.actions.toggle; + +import fr.gravencyg.CYG; +import fr.gravencyg.actions.Action; +import fr.gravencyg.model.ActionProcess; +import fr.gravencyg.utils.CLevel; +import org.bukkit.ChatColor; +import org.bukkit.block.Block; +import org.bukkit.entity.Player; + +import java.util.Random; + +public class ToggleFlyAction extends Action { + + private Random random = new Random(); + + public ToggleFlyAction(CYG main) { + super(main, CLevel.LEVEL13); + } + + @Override + public String title() { + return ChatColor.BLUE +"ToggleFly()"; + } + + @Override + public String lore() { + return ChatColor.GRAY +"Activer/Désactiver le vol d'oiseau"; + } + + @Override + public void onExecute(Player player, Block block, ActionProcess actionProcess) { + + player.setAllowFlight(true); + if(!player.isFlying()) + { + player.sendMessage("§bVol d'oiseau Actif !"); + player.setFlying(true); + player.setAllowFlight(true); + } + else{ + player.sendMessage("§bVol d'oiseau Inactif !"); + player.setFlying(false); + player.setAllowFlight(false); + } + } + +} diff --git a/src/main/java/fr/gravencyg/actions/toggle/ToggleFreezeAction.java b/src/main/java/fr/gravencyg/actions/toggle/ToggleFreezeAction.java new file mode 100644 index 0000000..51e1ce7 --- /dev/null +++ b/src/main/java/fr/gravencyg/actions/toggle/ToggleFreezeAction.java @@ -0,0 +1,35 @@ +package fr.gravencyg.actions.toggle; + +import fr.gravencyg.CYG; +import fr.gravencyg.actions.Action; +import fr.gravencyg.model.ActionProcess; +import fr.gravencyg.utils.CLevel; +import org.bukkit.ChatColor; +import org.bukkit.block.Block; +import org.bukkit.entity.Player; + +public class ToggleFreezeAction extends Action { + + public ToggleFreezeAction(CYG main) { + super(main, CLevel.LEVEL3); + } + + @Override + public String title() { + return ChatColor.BLUE + "ToggleFreeze()"; + } + + @Override + public String lore() { + return ChatColor.GRAY + "Géler/Deleger un joueur"; + } + + @Override + public void onExecute(Player player, Block block, ActionProcess actionProcess) { + player.sendMessage("§bfreeze()"); + + if(main.getGameManager().isPlayerInGame(player).size() != 0) { + main.toggleGameFreeze(player); + } + } +} diff --git a/src/main/java/fr/gravencyg/actions/toggle/ToggleGlowAction.java b/src/main/java/fr/gravencyg/actions/toggle/ToggleGlowAction.java new file mode 100644 index 0000000..7ad68a4 --- /dev/null +++ b/src/main/java/fr/gravencyg/actions/toggle/ToggleGlowAction.java @@ -0,0 +1,40 @@ +package fr.gravencyg.actions.toggle; + +import fr.gravencyg.CYG; +import fr.gravencyg.actions.Action; +import fr.gravencyg.model.ActionProcess; +import fr.gravencyg.utils.CLevel; +import org.bukkit.ChatColor; +import org.bukkit.block.Block; +import org.bukkit.entity.Player; + +public class ToggleGlowAction extends Action { + + public ToggleGlowAction(CYG main) { + super(main, CLevel.LEVEL16); + } + + @Override + public String title() { + return ChatColor.BLUE + "Glow()"; + } + + @Override + public String lore() { + return ChatColor.GRAY + "Activer/Desactiver l'effet de glow sur un joueur"; + } + + @Override + public void onExecute(Player player, Block block, ActionProcess actionProcess) { + player.sendMessage("§6glow()"); + + if(player.isGlowing()) + { + player.setGlowing(false); + } + else{ + player.setGlowing(true); + } + + } +} diff --git a/src/main/java/fr/gravencyg/actions/toggle/TogglePvPAction.java b/src/main/java/fr/gravencyg/actions/toggle/TogglePvPAction.java new file mode 100644 index 0000000..f20cdc6 --- /dev/null +++ b/src/main/java/fr/gravencyg/actions/toggle/TogglePvPAction.java @@ -0,0 +1,50 @@ +package fr.gravencyg.actions.toggle; + +import fr.gravencyg.CYG; +import fr.gravencyg.actions.Action; +import fr.gravencyg.game.CYGame; +import fr.gravencyg.model.ActionProcess; +import fr.gravencyg.utils.CEvent; +import fr.gravencyg.utils.CLevel; +import org.bukkit.ChatColor; +import org.bukkit.block.Block; +import org.bukkit.entity.Player; + +public class TogglePvPAction extends Action { + + public TogglePvPAction(CYG main) { + super(main, CLevel.LEVEL1); + } + + @Override + public String title() { + return ChatColor.BLUE + "TogglePvp()"; + } + + @Override + public String lore() { + return ChatColor.GRAY + "Activer / Desactiver les combats"; + } + + @Override + public void onExecute(Player player, Block block, ActionProcess actionProcess) { + if(main.getGameManager().isPlayerInGame(player).size()!=0) + { + CYGame game = main.getGameManager().getCurrentGame(player); + game.togglePvP(); + + if(game.canFight()) { + main.getGameManager().broadcast(game, "Combat Actif !"); + } + else + { + main.getGameManager().broadcast(game, "Combat Inactif !"); + } + } + else + { + player.sendMessage("§eCombat Actif !"); + } + } + +} diff --git a/src/main/java/fr/gravencyg/actions/waitable/WaitAction.java b/src/main/java/fr/gravencyg/actions/waitable/WaitAction.java new file mode 100644 index 0000000..d4cb479 --- /dev/null +++ b/src/main/java/fr/gravencyg/actions/waitable/WaitAction.java @@ -0,0 +1,35 @@ +package fr.gravencyg.actions.waitable; + +import fr.gravencyg.CYG; +import fr.gravencyg.actions.Action; +import fr.gravencyg.model.ActionProcess; +import fr.gravencyg.utils.CLevel; +import org.bukkit.ChatColor; +import org.bukkit.block.Block; +import org.bukkit.entity.Player; + +import java.util.Random; + +public class WaitAction extends Action { + + private Random random = new Random(); + + public WaitAction(CYG main) { + super(main, CLevel.LEVEL2); + } + + @Override + public String title() { + return ChatColor.BLUE + "Wait(1)"; + } + + @Override + public String lore() { + return ChatColor.GRAY + "Attendre 1 seconde"; + } + + @Override + public void onExecute(Player player, Block block, ActionProcess actionProcess) { } + + +} diff --git a/src/main/java/fr/gravencyg/actions/waitable/WaitAction2.java b/src/main/java/fr/gravencyg/actions/waitable/WaitAction2.java new file mode 100644 index 0000000..b3e2ccc --- /dev/null +++ b/src/main/java/fr/gravencyg/actions/waitable/WaitAction2.java @@ -0,0 +1,35 @@ +package fr.gravencyg.actions.waitable; + +import fr.gravencyg.CYG; +import fr.gravencyg.actions.Action; +import fr.gravencyg.model.ActionProcess; +import fr.gravencyg.utils.CLevel; +import org.bukkit.ChatColor; +import org.bukkit.block.Block; +import org.bukkit.entity.Player; + +import java.util.Random; + +public class WaitAction2 extends Action { + + private Random random = new Random(); + + public WaitAction2(CYG main) { + super(main, CLevel.LEVEL4); + } + + @Override + public String title() { + return ChatColor.BLUE + "Wait(10)"; + } + + @Override + public String lore() { + return ChatColor.GRAY + "Attendre 10s secondes"; + } + + @Override + public void onExecute(Player player, Block block, ActionProcess actionProcess) { } + + +} diff --git a/src/main/java/fr/gravencyg/actions/waitable/WaitAction3.java b/src/main/java/fr/gravencyg/actions/waitable/WaitAction3.java new file mode 100644 index 0000000..c75bc9c --- /dev/null +++ b/src/main/java/fr/gravencyg/actions/waitable/WaitAction3.java @@ -0,0 +1,35 @@ +package fr.gravencyg.actions.waitable; + +import fr.gravencyg.CYG; +import fr.gravencyg.actions.Action; +import fr.gravencyg.model.ActionProcess; +import fr.gravencyg.utils.CLevel; +import org.bukkit.ChatColor; +import org.bukkit.block.Block; +import org.bukkit.entity.Player; + +import java.util.Random; + +public class WaitAction3 extends Action { + + private Random random = new Random(); + + public WaitAction3(CYG main) { + super(main, CLevel.LEVEL4); + } + + @Override + public String title() { + return ChatColor.BLUE + "Wait(60)"; + } + + @Override + public String lore() { + return ChatColor.GRAY + "Attendre 60s secondes"; + } + + @Override + public void onExecute(Player player, Block block, ActionProcess actionProcess) { } + + +} diff --git a/src/main/java/fr/gravencyg/commands/TCommand.java b/src/main/java/fr/gravencyg/commands/TCommand.java new file mode 100644 index 0000000..adf330c --- /dev/null +++ b/src/main/java/fr/gravencyg/commands/TCommand.java @@ -0,0 +1,105 @@ +package fr.gravencyg.commands; + +import fr.gravencyg.CYG; +import fr.gravencyg.game.CYGameManager; +import fr.gravencyg.manager.CYGDataManager; +import fr.gravencyg.manager.CYGWorleditManager; +import fr.gravencyg.menus.CustomMenuManager; +import fr.gravencyg.model.Plot; +import fr.gravencyg.scoreboards.ScoreboardManager; +import fr.gravencyg.utils.CLevel; +import org.bukkit.Location; +import org.bukkit.command.Command; +import org.bukkit.command.CommandExecutor; +import org.bukkit.command.CommandSender; +import org.bukkit.entity.Player; + + public abstract class TCommand implements CommandExecutor { + + protected CYG main; + private boolean allowedInGame; + private boolean plotOnly; + private boolean modOnly; + private boolean allowedInHub; + private CLevel minLevelRequire; + + public TCommand(CYG main, CLevel minLevelRequire, boolean modOnly, boolean allowedInGame, boolean plotOnly, boolean allowedInHub) { + super(); + this.main = main; + this.plotOnly = plotOnly; + this.allowedInGame = allowedInGame; + this.modOnly = modOnly; + this.minLevelRequire = minLevelRequire; + this.allowedInHub = allowedInHub; + } + + public TCommand(CYG main, boolean modOnly, boolean allowedInGame, boolean plotOnly, boolean allowedInHub) { + this(main, CLevel.LEVEL1, modOnly, allowedInGame, plotOnly, allowedInHub); + } + + @Override + public boolean onCommand(CommandSender commandSender, Command command, String s, String[] args) { + Player player = (Player) commandSender; + + if(player.getWorld().getName().equalsIgnoreCase("world") && !allowedInHub) + { + player.sendMessage("§cImpossible au /hub"); + return true; + } + + if(main.getDataManager().getLevel(player.getName()) < minLevelRequire.getRealLevel()) + { + player.sendMessage("§7[§eGravenMC§7]§r §cVous devez être au minimum §nNiveau "+ minLevelRequire.getRealLevel()+"§r§c pour utiliser cette commande"); + player.sendMessage("§7[§eGravenMC§7]§r Il vous manque donc " + (minLevelRequire.getTrophy() - main.getDataManager().getTrophys(player.getName())) +" trophés"); + + return true; + } + + if(!player.getWorld().getName().contains(player.getUniqueId().toString()) && plotOnly) + { + player.sendMessage("§7[§eGravenMC§7]§r §cCommande à faire sur votre parcelle uniquement"); + return true; + } + + if (this.main.getDataManager().getRank(player).isNotMod() && modOnly && !player.isOp()) { + player.sendMessage("§7[§eGravenMC§7]§r §cUniquement pour le staff"); + return false; + } + + if(main.getGameManager().isPlayerInGame(player).size()!=0 && !allowedInGame) + { + player.sendMessage("§7[§eGravenMC§7]§r §cCommande impossible durant une partie"); + return true; + } + + onExecute(player, args); + + return true; + } + + protected abstract void onExecute(Player player, String[] args); + + protected Location getHubLocation() { return main.spawnLocation; } + + protected ScoreboardManager scoreboardManager(){ return main.getScoreboardManager();} + + protected CYGDataManager dataManager(){ return main.getDataManager();} + + protected CustomMenuManager menuManager(){return main.getMenuManager();} + + protected CYGWorleditManager worldEditManager(){return main.getWorldEditManager();} + + protected CYGameManager gameManager(){ + return main.getGameManager(); + } + + protected Plot getPlot(Player player){ return getPlot(player.getName()); } + + protected Plot getPlot(String name) { return null; } + + protected String getPlotUUID(String name){ return dataManager().getStorages().get(name).getUUID(); } + + protected boolean hasPlot(String pseudo) { return dataManager().getStorages().containsKey(pseudo); } + + +} diff --git a/src/main/java/fr/gravencyg/commands/admin/AdminForceLevelCommand.java b/src/main/java/fr/gravencyg/commands/admin/AdminForceLevelCommand.java new file mode 100644 index 0000000..b777b2d --- /dev/null +++ b/src/main/java/fr/gravencyg/commands/admin/AdminForceLevelCommand.java @@ -0,0 +1,39 @@ +package fr.gravencyg.commands.admin; + +import fr.gravencyg.CYG; +import fr.gravencyg.commands.TCommand; +import org.bukkit.entity.Player; + +public class AdminForceLevelCommand extends TCommand { + + public AdminForceLevelCommand(CYG main) { + super(main, true, true, false, true); + } + + @Override + public void onExecute(Player player, String[] args) { + + if(!player.isOp()) + { + player.sendMessage("§CImpossible"); + return; + } + + if (args.length == 0) + { + player.sendMessage("§7/§eforcelevel §7[§rpseudo§7] [lvl]"); + return; + } + + String pseudo = args[0]; + String newLevel = args[1]; + + main.getDataManager().setLevel(pseudo, newLevel); + main.getDataManager().refreshLevel(pseudo); + player.sendMessage("Le joueur §e"+pseudo+"§r est désormais niveau §e" + newLevel); + main.getScoreboardManager().updatePlayerLevel(player); + main.getScoreboardManager().updatePlayerTrophy(player); + + + } +} diff --git a/src/main/java/fr/gravencyg/commands/admin/AdminForceUpdateHoloCommand.java b/src/main/java/fr/gravencyg/commands/admin/AdminForceUpdateHoloCommand.java new file mode 100644 index 0000000..2e40fc5 --- /dev/null +++ b/src/main/java/fr/gravencyg/commands/admin/AdminForceUpdateHoloCommand.java @@ -0,0 +1,30 @@ +package fr.gravencyg.commands.admin; + +import fr.gravencyg.CYG; +import fr.gravencyg.commands.TCommand; +import org.bukkit.Bukkit; +import org.bukkit.entity.Player; + +public class AdminForceUpdateHoloCommand extends TCommand { + + public AdminForceUpdateHoloCommand(CYG main) { + super(main, true, true, false, true); + } + + @Override + public void onExecute(Player player, String[] args) { + + if(!player.isOp()) + { + player.sendMessage("§CImpossible"); + return; + } + + for(Player pl : Bukkit.getOnlinePlayers()) + { + main.getHologramManager().registerHologram(pl.getWorld()); + } + + + } +} diff --git a/src/main/java/fr/gravencyg/commands/admin/AdminRankCommand.java b/src/main/java/fr/gravencyg/commands/admin/AdminRankCommand.java new file mode 100644 index 0000000..a1107a7 --- /dev/null +++ b/src/main/java/fr/gravencyg/commands/admin/AdminRankCommand.java @@ -0,0 +1,59 @@ +package fr.gravencyg.commands.admin; + +import fr.gravencyg.CYG; +import fr.gravencyg.commands.TCommand; +import fr.gravencyg.menus.all.ActionMenu; +import fr.gravencyg.utils.CRank; +import org.bukkit.Bukkit; +import org.bukkit.ChatColor; +import org.bukkit.command.Command; +import org.bukkit.command.CommandExecutor; +import org.bukkit.command.CommandSender; +import org.bukkit.entity.Player; + +public class AdminRankCommand extends TCommand { + + public AdminRankCommand(CYG main) { + super(main, true, true, false, true); + } + + @Override + public void onExecute(Player player, String[] args) { + + if(!player.isOp()) + { + player.sendMessage("§CImpossible"); + return; + } + + if (args.length < 2) + { + player.sendMessage("§7/§erank §7[§rpseudo§7] [§rjoueur§e,§r premium§e,§r modo§e,§r admin§7]"); + return; + } + + String pseudo = args[0]; + String rank = args[1].toLowerCase(); + String rankS = rank.substring(0, 1).toUpperCase() + rank.substring(1); + + if(dataManager().getStorages().containsKey(pseudo)) + { + dataManager().getStorages().get(pseudo).setRank(rankS); + dataManager().save(pseudo, dataManager().getStorages().get(pseudo).getUUID()); + + if(Bukkit.getPlayer(pseudo) != null) + { + Player target = Bukkit.getPlayer(pseudo); + scoreboardManager().updatePlayerRank(target); + CRank r = dataManager().getRank(target); + target.setPlayerListName("[" + r.getColor() + "" + r.getSigle() + "§r] " + player.getName()); + } + + player.sendMessage("Grade §b" + rankS + "§e donné à "+pseudo+"§r"); + } + else + { + player.sendMessage("Joueur §e"+pseudo+"§r introuvable"); + } + } +} diff --git a/src/main/java/fr/gravencyg/commands/admin/AdminRefreshLevelCommand.java b/src/main/java/fr/gravencyg/commands/admin/AdminRefreshLevelCommand.java new file mode 100644 index 0000000..d978c06 --- /dev/null +++ b/src/main/java/fr/gravencyg/commands/admin/AdminRefreshLevelCommand.java @@ -0,0 +1,36 @@ +package fr.gravencyg.commands.admin; + +import fr.gravencyg.CYG; +import fr.gravencyg.commands.TCommand; +import fr.gravencyg.utils.CRank; +import org.bukkit.Bukkit; +import org.bukkit.entity.Player; + +public class AdminRefreshLevelCommand extends TCommand { + + public AdminRefreshLevelCommand(CYG main) { + super(main, true, true, false, true); + } + + @Override + public void onExecute(Player player, String[] args) { + + if(!player.isOp()) + { + player.sendMessage("§CImpossible"); + return; + } + + if (args.length == 0) + { + player.sendMessage("§7/§erefreshlevel §7[§rpseudo§7]"); + return; + } + + String pseudo = args[0]; + main.getDataManager().refreshLevel(pseudo); + player.sendMessage("Niveau mis à jour pour le joueur §9" + pseudo); + main.getScoreboardManager().updatePlayerLevel(player); + + } +} diff --git a/src/main/java/fr/gravencyg/commands/game/GameLeaveCommand.java b/src/main/java/fr/gravencyg/commands/game/GameLeaveCommand.java new file mode 100644 index 0000000..27a99a2 --- /dev/null +++ b/src/main/java/fr/gravencyg/commands/game/GameLeaveCommand.java @@ -0,0 +1,23 @@ +package fr.gravencyg.commands.game; + +import fr.gravencyg.CYG; +import fr.gravencyg.commands.TCommand; +import org.bukkit.GameMode; +import org.bukkit.command.Command; +import org.bukkit.command.CommandExecutor; +import org.bukkit.command.CommandSender; +import org.bukkit.entity.Player; + +public class GameLeaveCommand extends TCommand { + + public GameLeaveCommand(CYG main) { + super(main, false, true, false, true); + } + + @Override + public void onExecute(Player player, String[] args) { + player.teleport(getHubLocation()); + player.setGameMode(GameMode.SURVIVAL); + gameManager().quit(player); + } +} diff --git a/src/main/java/fr/gravencyg/commands/game/GamePlayCommand.java b/src/main/java/fr/gravencyg/commands/game/GamePlayCommand.java new file mode 100644 index 0000000..766b7b9 --- /dev/null +++ b/src/main/java/fr/gravencyg/commands/game/GamePlayCommand.java @@ -0,0 +1,100 @@ +package fr.gravencyg.commands.game; + +import fr.gravencyg.CYG; +import fr.gravencyg.commands.TCommand; +import fr.gravencyg.menus.plot.PlayPlayerMenu; +import fr.gravencyg.model.Plot; +import fr.gravencyg.model.Storage; +import fr.gravencyg.utils.CLevel; +import org.bukkit.*; +import org.bukkit.entity.Player; + +public class GamePlayCommand extends TCommand { + + public GamePlayCommand(CYG main) { + super(main, CLevel.LEVEL1, false, false, false, true); + } + + @Override + public void onExecute(Player player, String[] args) { + + if(args.length == 0) + { + player.sendMessage("Utilise §e/§rplay §7[§epseudo§7] pour jouer à un jeu"); + return; + } + + if(args.length == 1) + { + String targetName = args[0]; + + if(!dataManager().getStorages().containsKey(targetName)) + { + player.sendMessage("Aucun jeu n'existe pour le créateur §e" + targetName); + return; + } + + if(main.getTargetPlayMenu().containsKey(player)) + { + main.getTargetPlayMenu().remove(player); + } + main.getTargetPlayMenu().put(player, targetName); + main.getMenuManager().open(player, PlayPlayerMenu.class); + + + } + + if(args.length == 2) + { + int slot = 0; + String sl = args[1]; + + String target = args[0]; + + if(!dataManager().getStorages().containsKey(target)) + { + player.sendMessage("Aucun jeu n'existe pour le créateur §e" + target); + return; + } + + if(sl != null) + { + slot = Integer.parseInt(sl); + } + + Storage storage = main.getDataManager().getStorages().get(target); + Plot targetPlot = storage.getPlots().get(slot); + + if(main.getGameManager().isPlayerInGame(player).size() != 0) { + main.getGameManager().quit(player); + } + + if(targetPlot.getConfig().isWhitelist() && !targetPlot.getFriends().contains(player.getName()) && !player.getName().equalsIgnoreCase(storage.getDisplayName())) + { + player.sendMessage("Le jeu est actuellement en §cWhitelist"); + return; + } + + if(!main.getGameManager().hasPendingGame(target, slot)) + { + main.getGameManager().create(target, slot); + player.sendMessage("§7>>§r Création d'une partie pour le jeu de §e"+ target); + } + + player.sendMessage("§7>>§r Vous avez rejoint \""+targetPlot.getName()+"\" par§e "+ target); + + WorldCreator worldCreator = new WorldCreator(storage.getUUID()+"#" + slot); + worldCreator.type(WorldType.FLAT); + + World playerWorld = Bukkit.createWorld(worldCreator); + + // wait 3 seconds before teleport the player + int finalSlot = slot; + Bukkit.getScheduler().runTaskLater(main, () -> { + main.getGameManager().join(player, target, finalSlot); + }, 50); + + + } + } +} diff --git a/src/main/java/fr/gravencyg/commands/link/LinkDiscordCommand.java b/src/main/java/fr/gravencyg/commands/link/LinkDiscordCommand.java new file mode 100644 index 0000000..7059c53 --- /dev/null +++ b/src/main/java/fr/gravencyg/commands/link/LinkDiscordCommand.java @@ -0,0 +1,19 @@ +package fr.gravencyg.commands.link; + +import fr.gravencyg.CYG; +import fr.gravencyg.commands.TCommand; +import fr.gravencyg.utils.CLevel; +import org.bukkit.entity.Player; + +public class LinkDiscordCommand extends TCommand { + + public LinkDiscordCommand(CYG main) { + super(main, CLevel.LEVEL1, false, false, false, true); + } + + @Override + public void onExecute(Player player, String[] args) { + player.sendMessage("§bhttps://discord.gg/gravenmc"); + } + +} diff --git a/src/main/java/fr/gravencyg/commands/link/LinkShopCommand.java b/src/main/java/fr/gravencyg/commands/link/LinkShopCommand.java new file mode 100644 index 0000000..5800d34 --- /dev/null +++ b/src/main/java/fr/gravencyg/commands/link/LinkShopCommand.java @@ -0,0 +1,19 @@ +package fr.gravencyg.commands.link; + +import fr.gravencyg.CYG; +import fr.gravencyg.commands.TCommand; +import fr.gravencyg.utils.CLevel; +import org.bukkit.entity.Player; + +public class LinkShopCommand extends TCommand { + + public LinkShopCommand(CYG main) { + super(main, CLevel.LEVEL1, false, false, false, true); + } + + @Override + public void onExecute(Player player, String[] args) { + player.sendMessage("§bhttps://shop.gravenmc.fr"); + } + +} diff --git a/src/main/java/fr/gravencyg/commands/link/LinkTwitterCommand.java b/src/main/java/fr/gravencyg/commands/link/LinkTwitterCommand.java new file mode 100644 index 0000000..fb6b8f4 --- /dev/null +++ b/src/main/java/fr/gravencyg/commands/link/LinkTwitterCommand.java @@ -0,0 +1,19 @@ +package fr.gravencyg.commands.link; + +import fr.gravencyg.CYG; +import fr.gravencyg.commands.TCommand; +import fr.gravencyg.utils.CLevel; +import org.bukkit.entity.Player; + +public class LinkTwitterCommand extends TCommand { + + public LinkTwitterCommand(CYG main) { + super(main, CLevel.LEVEL1, false, false, false, true); + } + + @Override + public void onExecute(Player player, String[] args) { + player.sendMessage("§bhttps://twitter.com/gravenmc_cyg"); + } + +} diff --git a/src/main/java/fr/gravencyg/commands/manage/ManageFriendCommand.java b/src/main/java/fr/gravencyg/commands/manage/ManageFriendCommand.java new file mode 100644 index 0000000..144e46b --- /dev/null +++ b/src/main/java/fr/gravencyg/commands/manage/ManageFriendCommand.java @@ -0,0 +1,119 @@ +package fr.gravencyg.commands.manage; + +import fr.gravencyg.CYG; +import fr.gravencyg.commands.TCommand; +import fr.gravencyg.model.Plot; +import fr.gravencyg.utils.CLevel; +import org.bukkit.*; +import org.bukkit.command.Command; +import org.bukkit.command.CommandExecutor; +import org.bukkit.command.CommandSender; +import org.bukkit.entity.Player; + +import java.util.Random; + +public class ManageFriendCommand extends TCommand { + + private Random rd = new Random(); + + public ManageFriendCommand(CYG main) { + super(main, CLevel.LEVEL1, false, false, false, false); + } + + @Override + public void onExecute(Player player, String[] args) { + + if(args.length == 0) { + player.sendMessage("§7/§efriend§r add [surnom]" + ChatColor.GRAY + " Ajouter un ami sur votre parcelle"); + player.sendMessage("§7/§efriend§r remove [surnom] → " + ChatColor.GRAY + " Retirer un ami de votre parcelle"); + player.sendMessage("§7/§efriend§r plot [surnom] → " + ChatColor.GRAY + " Se teleporter sur la parcelle d'un ami"); + player.sendMessage("§7/§efriend§r list → " + ChatColor.GRAY + "Liste les amis sur votre parcelle"); + } + + if(args.length >= 1) { + if (args[0].equalsIgnoreCase("add")) { + + if(args.length == 1) + { + player.sendMessage("§7/§efriend§r add [surnom]" + ChatColor.GRAY + " Ajouter un ami sur votre parcelle"); + return; + } + + String pseudo = args[1]; + + Plot plot = main.getPlotManager().getStorageByUUID(player.getWorld().getName()).getPlot(player.getWorld().getName()); + + if(!plot.getFriends().contains(pseudo)) { + player.sendMessage("§rNouvel ami §e" + pseudo + "§r ajouté à votre parcelle !"); + plot.getFriends().add(pseudo); + dataManager().save(player); + } + else + { + player.sendMessage("§r" + pseudo + "§r est déjà dans vos amis !"); + } + + } + + if (args[0].equalsIgnoreCase("plot")) { + String pseudo = args[1]; + + if(args.length < 2){ + player.sendMessage("§7/§efriend§r plot [surnom] → " + ChatColor.GRAY + " Se teleporter sur la parcelle d'un ami"); + return; + } + + if(!hasPlot(pseudo)){ + player.sendMessage("§rLe joueur §9" + pseudo + "§r n'a pas de plot !"); + return; + } + + Plot plot = main.getPlotManager().getStorageByUUID(player.getWorld().getName()).getPlot(player.getWorld().getName()); + + WorldCreator worldCreator = new WorldCreator(getPlotUUID(pseudo)); + worldCreator.type(WorldType.FLAT); + worldCreator.generateStructures(false); + + World playerWorld = Bukkit.createWorld(worldCreator); + + if(plot.getFriends().contains(player.getName())) { + player.sendMessage("§rTéléportation vers la parcelle de §b" + pseudo + "§r !"); + player.teleport(new Location(playerWorld, 0, 10, 0)); + } + else + { + player.sendMessage("§rVous n'êtes pas ami avec §c" + pseudo); + } + } + + if (args[0].equalsIgnoreCase("remove")) { + String pseudo = args[1]; + + Plot plot = getPlot(player); + + if(plot.getFriends().contains(pseudo)) { + player.sendMessage("§r" + pseudo + "§c a été retiré de votre parcelle !"); + plot.getFriends().remove(pseudo); + dataManager().save(player); + } + else + { + player.sendMessage("§r" + pseudo + "§c n'est pas dans vos amis !"); + } + } + + if(args[0].equalsIgnoreCase("list")) + { + player.sendMessage("§eListe de vos amis§r pour ce Plot: "); + Plot plot = main.getPlotManager().getStorageByUUID(player.getWorld().getName()).getPlot(player.getWorld().getName()); + + for(String string : plot.getFriends()) + { + player.sendMessage("§e-§r " + string); + } + } + + } + } + +} diff --git a/src/main/java/fr/gravencyg/commands/manage/ManageLocationCommand.java b/src/main/java/fr/gravencyg/commands/manage/ManageLocationCommand.java new file mode 100644 index 0000000..68dd4da --- /dev/null +++ b/src/main/java/fr/gravencyg/commands/manage/ManageLocationCommand.java @@ -0,0 +1,67 @@ +package fr.gravencyg.commands.manage; + +import fr.gravencyg.CYG; +import fr.gravencyg.commands.TCommand; +import fr.gravencyg.menus.locations.LocationMenu; +import fr.gravencyg.utils.CLevel; +import org.bukkit.ChatColor; +import org.bukkit.command.Command; +import org.bukkit.command.CommandExecutor; +import org.bukkit.command.CommandSender; +import org.bukkit.entity.Player; + +import java.util.Random; + +public class ManageLocationCommand extends TCommand { + + public ManageLocationCommand(CYG main) { + super(main, CLevel.LEVEL1, false, false, true, false); + } + + @Override + public void onExecute(Player player, String[] args) { + + if(args.length == 0) { + player.sendMessage("§7/§elocations§r add [surnom] → " + ChatColor.GRAY + "Ajouter une nouvelle zone"); + player.sendMessage("§7/§elocations§r remove [surnom] → " + ChatColor.GRAY + "Retirer une zone"); + player.sendMessage("§7/§elocations§r removeall → " + ChatColor.GRAY + "Retirer toutes les zones"); + player.sendMessage("§7/§elocations§r menu → " + ChatColor.GRAY + "Ouvrir le menu des zones"); + } + + if(args.length >= 1) { + if(args[0].equalsIgnoreCase("add")) + { + Random rd = new Random(); + String locationName = "zone-" + rd.nextInt(9999); + + if(args.length == 2) + { + locationName = args[1]; + } + dataManager().addLocation(player, locationName, player.getLocation()); + } + if(args[0].equalsIgnoreCase("remove")) + { + if(args.length == 1) + { + player.sendMessage("/locations remove [nom]"); + return; + } + + String locationName = args[1]; + dataManager().removeLocation(player, locationName); + } + + if(args[0].equalsIgnoreCase("removeall")) + { + dataManager().removeAllLocations(player); + } + + if(args[0].equalsIgnoreCase("menu")) + { + menuManager().open(player, LocationMenu.class); + } + } + } + +} diff --git a/src/main/java/fr/gravencyg/commands/manage/ManageMessageCommand.java b/src/main/java/fr/gravencyg/commands/manage/ManageMessageCommand.java new file mode 100644 index 0000000..16e051a --- /dev/null +++ b/src/main/java/fr/gravencyg/commands/manage/ManageMessageCommand.java @@ -0,0 +1,73 @@ +package fr.gravencyg.commands.manage; + +import fr.gravencyg.CYG; +import fr.gravencyg.commands.TCommand; +import fr.gravencyg.menus.messages.MessageMenu; +import fr.gravencyg.utils.CLevel; +import org.bukkit.ChatColor; +import org.bukkit.command.Command; +import org.bukkit.command.CommandExecutor; +import org.bukkit.command.CommandSender; +import org.bukkit.entity.Player; + +import java.util.Random; + +public class ManageMessageCommand extends TCommand { + + private Random rd = new Random(); + + public ManageMessageCommand(CYG main) { + super(main, CLevel.LEVEL1, false, false, true, false); + } + + @Override + public void onExecute(Player player, String[] args) { + + if(args.length == 0) { + player.sendMessage("§7/§emessages§r add [surnom] [votre_message] → " + ChatColor.GRAY + "Ajouter un nouveau message"); + player.sendMessage("§7/§emessages§r remove [surnom] → " + ChatColor.GRAY + "Retirer un message"); + player.sendMessage("§7/§emessages§r removeall → " + ChatColor.GRAY + "Retirer tout les messages"); + player.sendMessage("§7/§emessages§r menu → " + ChatColor.GRAY + "Ouvrir le menu des messages"); + } + + if(args.length >= 1) { + if (args[0].equalsIgnoreCase("add")) { + StringBuilder msgContent = new StringBuilder(); + + if(args.length < 3) + { + player.sendMessage("§7/§emessages§r add [surnom] [votre_message] → " + ChatColor.GRAY + "Ajouter un nouveau message"); + return; + } + + String msgName = args[1]; + + for(String arg : args){ + if(arg.equals(args[0]) || arg.equals(args[1])) continue; + msgContent.append(arg).append(" "); + } + + dataManager().addMessage(player, msgName, msgContent.toString()); + } + if (args[0].equalsIgnoreCase("remove")) { + if (args.length == 1) { + player.sendMessage("/messages remove [nom]"); + return; + } + + String messageName = args[1]; + dataManager().removeMessage(player, messageName); + } + + if (args[0].equalsIgnoreCase("removeall")) { + dataManager().removeAllMessages(player); + } + + if (args[0].equalsIgnoreCase("menu")) { + menuManager().open(player, MessageMenu.class); + } + + } + } + +} diff --git a/src/main/java/fr/gravencyg/commands/manage/ManageNPCCommand.java b/src/main/java/fr/gravencyg/commands/manage/ManageNPCCommand.java new file mode 100644 index 0000000..7161caa --- /dev/null +++ b/src/main/java/fr/gravencyg/commands/manage/ManageNPCCommand.java @@ -0,0 +1,30 @@ +package fr.gravencyg.commands.manage; + +import fr.gravencyg.CYG; +import fr.gravencyg.commands.TCommand; +import fr.gravencyg.menus.locations.LocationMenu; +import fr.gravencyg.utils.CLevel; +import org.bukkit.ChatColor; +import org.bukkit.entity.Player; + +import java.util.Random; + +public class ManageNPCCommand extends TCommand { + + public ManageNPCCommand(CYG main) { + super(main, CLevel.LEVEL1, false, false, true, false); + } + + @Override + public void onExecute(Player player, String[] args) { + + if(args.length == 0) { + player.sendMessage("§7/§enpc§r add [surnom] [pseudo du joueur mc] → " + ChatColor.GRAY + " Créer un NPC avec comme pseudo le nom et comme tête celle du pseudo"); + } + + if(args.length >= 1) { + + } + } + +} diff --git a/src/main/java/fr/gravencyg/commands/manage/ManageVariablesCommand.java b/src/main/java/fr/gravencyg/commands/manage/ManageVariablesCommand.java new file mode 100644 index 0000000..d79e190 --- /dev/null +++ b/src/main/java/fr/gravencyg/commands/manage/ManageVariablesCommand.java @@ -0,0 +1,72 @@ +package fr.gravencyg.commands.manage; + +import fr.gravencyg.CYG; +import fr.gravencyg.commands.TCommand; +import fr.gravencyg.menus.messages.MessageMenu; +import fr.gravencyg.menus.variables.VariableMenu; +import fr.gravencyg.utils.CLevel; +import org.bukkit.ChatColor; +import org.bukkit.entity.Player; + +import java.util.Random; + +public class ManageVariablesCommand extends TCommand { + + private Random rd = new Random(); + + public ManageVariablesCommand(CYG main) { + super(main, CLevel.LEVEL1, false, false, true, false); + } + + @Override + public void onExecute(Player player, String[] args) { + + if(args.length == 0) { + player.sendMessage("§7/§evariables§r add [nom] [type] [contenu de la variable] → " + ChatColor.GRAY + "Ajouter une nouvelle variable"); + player.sendMessage("§7/§evariables§r menu → " + ChatColor.GRAY + "Ouvrir le menu des variables"); + } + + if(args.length >= 1) { + if (args[0].equalsIgnoreCase("add")) { + + if(args.length < 4) + { + player.sendMessage("§7/§evariables§r add [nom] [type] [contenu de la variable] → " + ChatColor.GRAY + "Ajouter une nouvelle variable"); + return; + } + + StringBuilder varContent = new StringBuilder(); + String varName = args[1]; + String type = args[2]; + + if(!type.equalsIgnoreCase("int") && !type.equalsIgnoreCase("string") && !type.equalsIgnoreCase("double")) + { + player.sendMessage("Types de variables autorisés : "); + player.sendMessage("§bint§r pour les nombres"); + player.sendMessage("§bstring§r pour les textes"); + player.sendMessage("§bdouble§r pour les nombres à virgule"); + return; + } + + for(String arg : args){ + if(arg.equals(args[0]) || arg.equals(args[1]) || arg.equals(args[2])) continue; + varContent.append(arg).append(" "); + } + + } + if (args[0].equalsIgnoreCase("remove")) { + + } + + if (args[0].equalsIgnoreCase("removeall")) { + + } + + if (args[0].equalsIgnoreCase("menu")) { + menuManager().open(player, VariableMenu.class); + } + + } + } + +} diff --git a/src/main/java/fr/gravencyg/commands/mod/ModFreezeCommand.java b/src/main/java/fr/gravencyg/commands/mod/ModFreezeCommand.java new file mode 100644 index 0000000..e517f2d --- /dev/null +++ b/src/main/java/fr/gravencyg/commands/mod/ModFreezeCommand.java @@ -0,0 +1,46 @@ +package fr.gravencyg.commands.mod; + +import fr.gravencyg.CYG; +import fr.gravencyg.commands.TCommand; +import org.bukkit.Bukkit; +import org.bukkit.command.Command; +import org.bukkit.command.CommandExecutor; +import org.bukkit.command.CommandSender; +import org.bukkit.entity.Player; + +public class ModFreezeCommand extends TCommand { + + private CYG main; + + public ModFreezeCommand(CYG main) { + super(main, true, true, false, true); + } + + @Override + public void onExecute(Player player, String[] args) { + if(args.length == 0) + { + player.sendMessage("Utilise §e/§rfreeze §7[§epseudo§7]"); + return; + } + + String targetName = args[0]; + + if(Bukkit.getPlayer(targetName) != null) + { + + Player target = Bukkit.getPlayer(targetName); + + if(!main.getFreezeModPlayers().contains(target)) + { + player.sendMessage("§b" + targetName + "§r a été gelé"); + main.getFreezeModPlayers().add(target); + } + else + { + player.sendMessage("§b" + targetName + "§r a été dégelé"); + main.getFreezeModPlayers().remove(target); + } + } + } +} diff --git a/src/main/java/fr/gravencyg/commands/mod/ModKickCommand.java b/src/main/java/fr/gravencyg/commands/mod/ModKickCommand.java new file mode 100644 index 0000000..4ba0e30 --- /dev/null +++ b/src/main/java/fr/gravencyg/commands/mod/ModKickCommand.java @@ -0,0 +1,43 @@ +package fr.gravencyg.commands.mod; + +import fr.gravencyg.CYG; +import fr.gravencyg.commands.TCommand; +import org.bukkit.Bukkit; +import org.bukkit.command.Command; +import org.bukkit.command.CommandExecutor; +import org.bukkit.command.CommandSender; +import org.bukkit.entity.Player; + +public class ModKickCommand extends TCommand { + + public ModKickCommand(CYG main) { + super(main, true, true, false, true); + } + + @Override + public void onExecute(Player player, String[] args) { + if(args.length < 2) + { + player.sendMessage("Utilise §e/§rkick §7[§epseudo§7] §7[§eRaison§7]§7"); + return; + } + String targetName = args[0]; + + if(Bukkit.getPlayer(targetName) != null) + { + Player target = Bukkit.getPlayer(targetName); + StringBuilder reason = new StringBuilder(); + + for(String arg : args){ + if(!args[0].equalsIgnoreCase(arg)) + { + reason.append(arg + " "); + } + } + + player.sendMessage(targetName + " a été éjécté pour la raison §c>>§r " + reason.toString()); + target.kickPlayer("§r[§cKick par "+player.getName()+"§r] \n\n§pPour la raison: §c\n"+reason.toString()); + + } + } +} diff --git a/src/main/java/fr/gravencyg/commands/mod/ModMuteCommand.java b/src/main/java/fr/gravencyg/commands/mod/ModMuteCommand.java new file mode 100644 index 0000000..10b29cc --- /dev/null +++ b/src/main/java/fr/gravencyg/commands/mod/ModMuteCommand.java @@ -0,0 +1,41 @@ +package fr.gravencyg.commands.mod; + +import fr.gravencyg.CYG; +import fr.gravencyg.commands.TCommand; +import org.bukkit.Bukkit; +import org.bukkit.World; +import org.bukkit.WorldCreator; +import org.bukkit.WorldType; +import org.bukkit.command.Command; +import org.bukkit.command.CommandExecutor; +import org.bukkit.command.CommandSender; +import org.bukkit.entity.Player; + +public class ModMuteCommand extends TCommand { + + public ModMuteCommand(CYG main) { + super(main, true, true, false, true); + } + + @Override + public void onExecute(Player player, String[] args) { + + if(args.length == 0) + { + player.sendMessage("Utilise §e/§rmute §7[§epseudo§7] [nombreSecondes]"); + return; + } + + String targetName = args[0]; + String duration = "100000"; + + if(args.length == 2) { + duration = args[1]; + } + + if(Integer.valueOf(duration) != null) + { + player.sendMessage(targetName + " a été mute pendant " + duration + "§bs"); + } + } +} diff --git a/src/main/java/fr/gravencyg/commands/mod/ModUnMuteCommand.java b/src/main/java/fr/gravencyg/commands/mod/ModUnMuteCommand.java new file mode 100644 index 0000000..b0eab43 --- /dev/null +++ b/src/main/java/fr/gravencyg/commands/mod/ModUnMuteCommand.java @@ -0,0 +1,27 @@ +package fr.gravencyg.commands.mod; + +import fr.gravencyg.CYG; +import fr.gravencyg.commands.TCommand; +import org.bukkit.command.Command; +import org.bukkit.command.CommandExecutor; +import org.bukkit.command.CommandSender; +import org.bukkit.entity.Player; + +public class ModUnMuteCommand extends TCommand { + + public ModUnMuteCommand(CYG main) { + super(main, true, true, false, true); + } + + @Override + public void onExecute(Player player, String[] args) { + if(args.length == 0) + { + player.sendMessage("Utilise §e/§runmute §7[§epseudo§7"); + return; + } + + String targetName = args[0]; + player.sendMessage("§rLe joueur §b"+targetName + "§r a été unmute !"); + } +} diff --git a/src/main/java/fr/gravencyg/commands/mod/ModVerifyGameCommand.java b/src/main/java/fr/gravencyg/commands/mod/ModVerifyGameCommand.java new file mode 100644 index 0000000..97b5b79 --- /dev/null +++ b/src/main/java/fr/gravencyg/commands/mod/ModVerifyGameCommand.java @@ -0,0 +1,68 @@ +package fr.gravencyg.commands.mod; + +import fr.gravencyg.CYG; +import fr.gravencyg.commands.TCommand; +import fr.gravencyg.model.Storage; +import fr.gravencyg.model.VerifyGameConfig; +import org.bukkit.Bukkit; +import org.bukkit.ChatColor; +import org.bukkit.command.Command; +import org.bukkit.command.CommandExecutor; +import org.bukkit.command.CommandSender; +import org.bukkit.entity.Player; + +public class ModVerifyGameCommand extends TCommand { + + public ModVerifyGameCommand(CYG main) { + super(main, true, false, false, true); + } + + @Override + public void onExecute(Player player, String[] args) { + + if (args.length < 2) + { + player.sendMessage("§7/§everifygame §7[§rpseudo§7] [§r§9DIAMOND_SWORD§7]§r §7[§rNUMERO_CASE§7]"); + player.sendMessage("§7/§everifygame §7[§rpseudo§7] cancel"); + return; + } + + String pseudo = args[0]; + + if(args[1].equalsIgnoreCase("cancel")) + { + + // unverify player + Storage targetStorage = dataManager().getStorages().get(pseudo); + + player.sendMessage("§aLe jeu "+targetStorage.getPlot(player.getWorld().getName()).getName()+"§r est désormais §CREFUSE"); + + targetStorage.getPlot(player.getWorld().getName()).getVerifyConfig().setVerify(false); + dataManager().save(pseudo, targetStorage.getUUID()); + // TODO gameManager().getVerifyGames().remove(pseudo); + } + else + { + // verify player + String material = args[1]; + String numberSlot = args[2]; + + Storage targetStorage = dataManager().getStorages().get(pseudo); + + player.sendMessage("§aLe jeu "+targetStorage.getPlot(player.getWorld().getName()).getName()+"§r est désormais §aVALIDE"); + + VerifyGameConfig verifyGameConfig = targetStorage.getPlot(player.getWorld().getName()).getVerifyConfig(); + verifyGameConfig.setVerify(true); + verifyGameConfig.setIcon(material); + verifyGameConfig.setSlot(Integer.valueOf(numberSlot)); + + if(!gameManager().getVerifyGames().containsKey(pseudo)) + { + gameManager().createStorageFullData(targetStorage); + } + + dataManager().save(pseudo, targetStorage.getUUID()); + } + + } +} diff --git a/src/main/java/fr/gravencyg/commands/player/PlayerActionCommand.java b/src/main/java/fr/gravencyg/commands/player/PlayerActionCommand.java new file mode 100644 index 0000000..6f7c29c --- /dev/null +++ b/src/main/java/fr/gravencyg/commands/player/PlayerActionCommand.java @@ -0,0 +1,23 @@ +package fr.gravencyg.commands.player; + +import fr.gravencyg.CYG; +import fr.gravencyg.commands.TCommand; +import fr.gravencyg.menus.all.ActionMenu; +import fr.gravencyg.utils.CLevel; +import fr.gravencyg.utils.CRank; +import org.bukkit.Material; +import org.bukkit.entity.Player; +import org.bukkit.inventory.ItemStack; + +public class PlayerActionCommand extends TCommand { + + public PlayerActionCommand(CYG main) { + super(main, CLevel.LEVEL1,false, true, false, false); + } + + public void onExecute(Player player, String[] args) { + + main.getMenuManager().open(player, ActionMenu.class); + } + +} diff --git a/src/main/java/fr/gravencyg/commands/player/PlayerBarrierCommand.java b/src/main/java/fr/gravencyg/commands/player/PlayerBarrierCommand.java new file mode 100644 index 0000000..1ff4adc --- /dev/null +++ b/src/main/java/fr/gravencyg/commands/player/PlayerBarrierCommand.java @@ -0,0 +1,24 @@ +package fr.gravencyg.commands.player; + +import fr.gravencyg.CYG; +import fr.gravencyg.commands.TCommand; +import fr.gravencyg.utils.CLevel; +import org.bukkit.Material; +import org.bukkit.Sound; +import org.bukkit.entity.Player; +import org.bukkit.inventory.ItemStack; + +public class PlayerBarrierCommand extends TCommand { + + public PlayerBarrierCommand(CYG main) { + super(main, CLevel.LEVEL3, false, false, true, false); + } + + @Override + public void onExecute(Player player, String[] args) { + player.sendMessage("§9+1§l barriere"); + player.playSound(player.getLocation(), Sound.BLOCK_NOTE_BLOCK_PLING, 2, 4); + player.getInventory().addItem(new ItemStack(Material.BARRIER)); + } + +} diff --git a/src/main/java/fr/gravencyg/commands/player/PlayerBlockConditionCommand.java b/src/main/java/fr/gravencyg/commands/player/PlayerBlockConditionCommand.java new file mode 100644 index 0000000..cb5866f --- /dev/null +++ b/src/main/java/fr/gravencyg/commands/player/PlayerBlockConditionCommand.java @@ -0,0 +1,26 @@ +package fr.gravencyg.commands.player; + +import fr.gravencyg.CYG; +import fr.gravencyg.commands.TCommand; +import fr.gravencyg.items.ItemBuilder; +import fr.gravencyg.utils.CLevel; +import org.bukkit.ChatColor; +import org.bukkit.Material; +import org.bukkit.Sound; +import org.bukkit.entity.Player; +import org.bukkit.inventory.ItemStack; + +public class PlayerBlockConditionCommand extends TCommand { + + public PlayerBlockConditionCommand(CYG main) { + super(main, CLevel.LEVEL1,false, false, false, false); + } + + public void onExecute(Player player, String[] args) { + ItemStack eventBlock = new ItemBuilder(Material.HOPPER).setName(ChatColor.BLUE+"If()") + .addLoreLine("§7Verifier si quelquechose est vrai").toItemStack(); + player.getInventory().addItem(eventBlock); + player.playSound(player.getLocation(), Sound.BLOCK_ANVIL_USE, 8, 3); + } + +} diff --git a/src/main/java/fr/gravencyg/commands/player/PlayerBlockEventCommand.java b/src/main/java/fr/gravencyg/commands/player/PlayerBlockEventCommand.java new file mode 100644 index 0000000..769b4b4 --- /dev/null +++ b/src/main/java/fr/gravencyg/commands/player/PlayerBlockEventCommand.java @@ -0,0 +1,26 @@ +package fr.gravencyg.commands.player; + +import fr.gravencyg.CYG; +import fr.gravencyg.commands.TCommand; +import fr.gravencyg.items.ItemBuilder; +import fr.gravencyg.utils.CLevel; +import org.bukkit.ChatColor; +import org.bukkit.Material; +import org.bukkit.Sound; +import org.bukkit.entity.Player; +import org.bukkit.inventory.ItemStack; + +public class PlayerBlockEventCommand extends TCommand { + + public PlayerBlockEventCommand(CYG main) { + super(main, CLevel.LEVEL1,false, false, false, false); + } + + public void onExecute(Player player, String[] args) { + ItemStack eventBlock = new ItemBuilder(Material.LAPIS_BLOCK).setName(ChatColor.BLUE+"onEvent()") + .addLoreLine("§7Declenche un évenement durant le jeu").toItemStack(); + player.getInventory().addItem(eventBlock); + player.playSound(player.getLocation(), Sound.BLOCK_ANVIL_USE, 8, 3); + } + +} diff --git a/src/main/java/fr/gravencyg/commands/player/PlayerFlyCommand.java b/src/main/java/fr/gravencyg/commands/player/PlayerFlyCommand.java new file mode 100644 index 0000000..b5d30ed --- /dev/null +++ b/src/main/java/fr/gravencyg/commands/player/PlayerFlyCommand.java @@ -0,0 +1,38 @@ +package fr.gravencyg.commands.player; + +import fr.gravencyg.CYG; +import fr.gravencyg.commands.TCommand; +import fr.gravencyg.utils.CRank; +import org.bukkit.command.Command; +import org.bukkit.command.CommandExecutor; +import org.bukkit.command.CommandSender; +import org.bukkit.entity.Player; + +public class PlayerFlyCommand extends TCommand { + + public PlayerFlyCommand(CYG main) { + super(main, false, false, false, true); + } + + @Override + public void onExecute(Player player, String[] args) { + + if(main.getDataManager().getRank(player) != CRank.PREMIUM && main.getDataManager().getRank(player).isNotMod()) + { + player.sendMessage("§fUniquement pour les §ePremiums§r et le §9Staff"); + + return; + } + + if(!player.isFlying()) { + player.sendMessage("§bVol d'oiseau §b>>§r Actif"); + player.setAllowFlight(true); + player.setFlying(true); + } + else{ + player.sendMessage("§9Vol d'oiseau §b>>§r Inactif"); + player.setAllowFlight(false); + player.setFlying(false); + } + } +} diff --git a/src/main/java/fr/gravencyg/commands/player/PlayerGameModeCommand.java b/src/main/java/fr/gravencyg/commands/player/PlayerGameModeCommand.java new file mode 100644 index 0000000..f4387a6 --- /dev/null +++ b/src/main/java/fr/gravencyg/commands/player/PlayerGameModeCommand.java @@ -0,0 +1,39 @@ +package fr.gravencyg.commands.player; + +import fr.gravencyg.CYG; +import fr.gravencyg.commands.TCommand; +import fr.gravencyg.menus.all.GameModeMenu; +import org.bukkit.Material; +import org.bukkit.Sound; +import org.bukkit.command.Command; +import org.bukkit.command.CommandExecutor; +import org.bukkit.command.CommandSender; +import org.bukkit.entity.Player; +import org.bukkit.inventory.ItemStack; + +public class PlayerGameModeCommand extends TCommand { + + public PlayerGameModeCommand(CYG main) { + super(main, false, false, false, false); + } + + @Override + public void onExecute(Player player, String[] args) { + + if(!player.isOp() && player.getWorld().getName().equalsIgnoreCase("world")) + { + player.sendMessage("§cImpossible de /gamemode au hub !"); + return; + } + + if((!getPlot(player.getName()).getFriends().contains(player.getName())) + && !player.getWorld().getName().contains(player.getUniqueId().toString())) + { + player.sendMessage("§cIl est interdit de §l/gamemode§r§c dans un plot inconnu"); + return ; + } + + menuManager().open(player, GameModeMenu.class); + } + +} diff --git a/src/main/java/fr/gravencyg/commands/player/PlayerHatCommand.java b/src/main/java/fr/gravencyg/commands/player/PlayerHatCommand.java new file mode 100644 index 0000000..b0a7370 --- /dev/null +++ b/src/main/java/fr/gravencyg/commands/player/PlayerHatCommand.java @@ -0,0 +1,35 @@ +package fr.gravencyg.commands.player; + +import fr.gravencyg.CYG; +import fr.gravencyg.commands.TCommand; +import fr.gravencyg.utils.CLevel; +import fr.gravencyg.utils.CRank; +import org.bukkit.Material; +import org.bukkit.entity.Player; +import org.bukkit.inventory.ItemStack; + +public class PlayerHatCommand extends TCommand { + + public PlayerHatCommand(CYG main) { + super(main, CLevel.LEVEL1,false, true, false, true); + } + + public void onExecute(Player player, String[] args) { + + if(main.getDataManager().getRank(player) != CRank.PREMIUM && main.getDataManager().getRank(player).isNotMod()) + { + player.sendMessage("§fUniquement pour les §ePremiums§r et le §9Staff"); + return; + } + + ItemStack inHand = player.getInventory().getItemInMainHand(); + + if(inHand.getType() != Material.AIR) + { + player.sendMessage("§eNous avons remplacé votre tête par §6"+inHand.getType().name()+"§e !"); + player.getInventory().setHelmet(inHand); + } + + } + +} diff --git a/src/main/java/fr/gravencyg/commands/player/PlayerHeadCommand.java b/src/main/java/fr/gravencyg/commands/player/PlayerHeadCommand.java new file mode 100644 index 0000000..48757f1 --- /dev/null +++ b/src/main/java/fr/gravencyg/commands/player/PlayerHeadCommand.java @@ -0,0 +1,47 @@ +package fr.gravencyg.commands.player; + +import fr.gravencyg.CYG; +import fr.gravencyg.commands.TCommand; +import fr.gravencyg.utils.CLevel; +import org.bukkit.Material; +import org.bukkit.Sound; +import org.bukkit.entity.Player; +import org.bukkit.inventory.ItemStack; +import org.bukkit.inventory.meta.SkullMeta; + +import java.util.ArrayList; + +public class PlayerHeadCommand extends TCommand { + + public PlayerHeadCommand(CYG main) { + super(main, CLevel.LEVEL6, false, false, true, false); + } + + @Override + public void onExecute(Player player, String[] args) { + + String target = player.getName(); + + if(args.length == 1) + { + target = args[0]; + } + + player.getInventory().addItem(getHead(target)); + player.playSound(player.getLocation(), Sound.BLOCK_NOTE_BLOCK_PLING, 8, 3); + } + + public static ItemStack getHead(String name) { + ItemStack item = new ItemStack(Material.PLAYER_HEAD, 1, (short) 3); + SkullMeta skull = (SkullMeta) item.getItemMeta(); + skull.setDisplayName(name); + ArrayList lore = new ArrayList<>(); + lore.add("§eCustom head"); + skull.setLore(lore); + skull.setOwner(name); + item.setItemMeta(skull); + return item; + } + +} + diff --git a/src/main/java/fr/gravencyg/commands/player/PlayerHubCommand.java b/src/main/java/fr/gravencyg/commands/player/PlayerHubCommand.java new file mode 100644 index 0000000..ad70664 --- /dev/null +++ b/src/main/java/fr/gravencyg/commands/player/PlayerHubCommand.java @@ -0,0 +1,26 @@ +package fr.gravencyg.commands.player; + +import fr.gravencyg.CYG; +import fr.gravencyg.commands.TCommand; +import fr.gravencyg.utils.CLevel; +import org.bukkit.*; +import org.bukkit.command.Command; +import org.bukkit.command.CommandExecutor; +import org.bukkit.command.CommandSender; +import org.bukkit.entity.Player; + +public class PlayerHubCommand extends TCommand { + + public PlayerHubCommand(CYG main) { + super(main, CLevel.LEVEL1, false, true, false, true); + } + + @Override + public void onExecute(Player player, String[] args) { + player.teleport(getHubLocation()); + player.setGameMode(GameMode.SURVIVAL); + + gameManager().quit(player); + player.sendTitle("§eGravenMC", "§6Code tes propres mini-jeux"); + } +} diff --git a/src/main/java/fr/gravencyg/commands/player/PlayerPingCommand.java b/src/main/java/fr/gravencyg/commands/player/PlayerPingCommand.java new file mode 100644 index 0000000..934f713 --- /dev/null +++ b/src/main/java/fr/gravencyg/commands/player/PlayerPingCommand.java @@ -0,0 +1,21 @@ +package fr.gravencyg.commands.player; + +import fr.gravencyg.CYG; +import fr.gravencyg.commands.TCommand; +import fr.gravencyg.utils.CLevel; +import net.minecraft.server.v1_16_R1.EntityPlayer; +import org.bukkit.craftbukkit.v1_16_R1.entity.CraftPlayer; +import org.bukkit.entity.Player; + +public class PlayerPingCommand extends TCommand { + + public PlayerPingCommand(CYG main) { + super(main, CLevel.LEVEL1,false, true, false, true); + } + + public void onExecute(Player player, String[] args) { + EntityPlayer nmsPlayer = ((CraftPlayer) player).getHandle(); + player.sendMessage("§9" + nmsPlayer.ping +"§r ms"); + } + +} diff --git a/src/main/java/fr/gravencyg/commands/player/PlayerPlotCommand.java b/src/main/java/fr/gravencyg/commands/player/PlayerPlotCommand.java new file mode 100644 index 0000000..10d7ca0 --- /dev/null +++ b/src/main/java/fr/gravencyg/commands/player/PlayerPlotCommand.java @@ -0,0 +1,25 @@ +package fr.gravencyg.commands.player; + +import fr.gravencyg.CYG; +import fr.gravencyg.commands.TCommand; +import fr.gravencyg.menus.plot.PlotManageMenu; +import fr.gravencyg.menus.plot.PlotMenu; +import fr.gravencyg.utils.CLevel; +import org.bukkit.entity.Player; + +public class PlayerPlotCommand extends TCommand { + + public PlayerPlotCommand(CYG main) { + super(main, CLevel.LEVEL1, false, false, false, true); + } + + @Override + public void onExecute(Player player, String[] args) { + + if (player.getWorld().getName().contains(player.getUniqueId().toString())) { + main.getMenuManager().open(player, PlotManageMenu.class); + } else { + main.getMenuManager().open(player, PlotMenu.class); + } + } +} diff --git a/src/main/java/fr/gravencyg/commands/player/PlayerUUIDCommand.java b/src/main/java/fr/gravencyg/commands/player/PlayerUUIDCommand.java new file mode 100644 index 0000000..cfc5858 --- /dev/null +++ b/src/main/java/fr/gravencyg/commands/player/PlayerUUIDCommand.java @@ -0,0 +1,21 @@ +package fr.gravencyg.commands.player; + +import fr.gravencyg.CYG; +import fr.gravencyg.commands.TCommand; +import fr.gravencyg.utils.CLevel; +import org.bukkit.command.Command; +import org.bukkit.command.CommandExecutor; +import org.bukkit.command.CommandSender; +import org.bukkit.entity.Player; + +public class PlayerUUIDCommand extends TCommand { + + public PlayerUUIDCommand(CYG main) { + super(main, CLevel.LEVEL1, false, true, false, true); + } + + @Override + public void onExecute(Player player, String[] args) { + player.sendMessage("§eVotre UUID §l>>§r " + player.getUniqueId().toString()); + } +} diff --git a/src/main/java/fr/gravencyg/commands/player/PlayerWorldEditCommand.java b/src/main/java/fr/gravencyg/commands/player/PlayerWorldEditCommand.java new file mode 100644 index 0000000..b7f3101 --- /dev/null +++ b/src/main/java/fr/gravencyg/commands/player/PlayerWorldEditCommand.java @@ -0,0 +1,63 @@ +package fr.gravencyg.commands.player; + +import fr.gravencyg.CYG; +import fr.gravencyg.commands.TCommand; +import fr.gravencyg.utils.CLevel; +import org.bukkit.*; +import org.bukkit.command.Command; +import org.bukkit.command.CommandExecutor; +import org.bukkit.command.CommandSender; +import org.bukkit.entity.Player; + +public class PlayerWorldEditCommand extends TCommand { + + public PlayerWorldEditCommand(CYG main) { + super(main, CLevel.LEVEL15,false, false, true, false); + } + + @Override + public void onExecute(Player player, String[] args) { + + if(args.length == 0) + { + player.sendMessage("§7/§ewe§r give" + ChatColor.GRAY + " Accès à l'outil du mini worldedit"); + player.sendMessage("§7/§ewe§r set [type] [data]" + ChatColor.GRAY + " Remplacer la selection par un bloc"); + player.sendMessage("§7/§ewe§r undo" + ChatColor.GRAY + " Revenir en arrière"); + player.sendMessage("§7/§ewe§r unset" + ChatColor.GRAY + " Supprimer la selection"); + return; + } + + if(args[0].equalsIgnoreCase("give")) + { + worldEditManager().give(player); + } + + if(args[0].equalsIgnoreCase("set")) + { + + if(args.length == 1) + { + player.sendMessage("§7/§ewe§r set [type] [id]" + ChatColor.GRAY + " Remplacer la selection par un bloc"); + return; + } + + int id = 0; + + if(args.length == 3) id = Integer.parseInt(args[2]); + + worldEditManager().set(player, args[1].toLowerCase(), id); + + } + + if(args[0].equalsIgnoreCase("undo")) + { + worldEditManager().undo(player); + } + + if(args[0].equalsIgnoreCase("unset")) + { + worldEditManager().unset(player); + } + + } +} diff --git a/src/main/java/fr/gravencyg/commands/player/ShortcutGameNameCommand.java b/src/main/java/fr/gravencyg/commands/player/ShortcutGameNameCommand.java new file mode 100644 index 0000000..18b0b89 --- /dev/null +++ b/src/main/java/fr/gravencyg/commands/player/ShortcutGameNameCommand.java @@ -0,0 +1,37 @@ +package fr.gravencyg.commands.player; + +import fr.gravencyg.CYG; +import fr.gravencyg.commands.TCommand; +import fr.gravencyg.menus.options.OptionMenu; +import fr.gravencyg.utils.CLevel; +import org.bukkit.ChatColor; +import org.bukkit.entity.Player; + +public class ShortcutGameNameCommand extends TCommand { + + public ShortcutGameNameCommand(CYG main) { + super(main, CLevel.LEVEL1, false, false, true, false); + } + + @Override + public void onExecute(Player player, String[] args) { + + if(args.length == 0) + { + player.sendMessage("§7/§egamename§e [nom]" + ChatColor.GRAY + " Definit le nom du jeu"); + return; + } + + StringBuilder gameName = new StringBuilder(); + + for(String arg : args) + { + gameName.append(arg); + gameName.append(" "); + } + + dataManager().setGameName(player, gameName.toString()); + + player.sendMessage("§rLe nom du jeu est désormais §7[§e"+gameName.toString()+"§7]"); + } +} diff --git a/src/main/java/fr/gravencyg/commands/player/ShortcutOptionCommand.java b/src/main/java/fr/gravencyg/commands/player/ShortcutOptionCommand.java new file mode 100644 index 0000000..7704d31 --- /dev/null +++ b/src/main/java/fr/gravencyg/commands/player/ShortcutOptionCommand.java @@ -0,0 +1,31 @@ +package fr.gravencyg.commands.player; + +import fr.gravencyg.CYG; +import fr.gravencyg.commands.TCommand; +import fr.gravencyg.menus.options.OptionMenu; +import fr.gravencyg.utils.CLevel; +import org.bukkit.entity.Player; + +public class ShortcutOptionCommand extends TCommand { + + public ShortcutOptionCommand(CYG main) { + super(main, CLevel.LEVEL1, false, false, true, false); + } + + @Override + public void onExecute(Player player, String[] args) { + if(!player.getWorld().getName().contains(player.getUniqueId().toString())) + { + player.sendMessage("§cCommande à faire sur votre parcelle uniquement"); + return; + } + + if(gameManager().isPlayerInGame(player).size() != 0) + { + player.sendMessage("§cCommande impossible durant une partie"); + return; + } + + main.getMenuManager().open(player, OptionMenu.class); + } +} diff --git a/src/main/java/fr/gravencyg/commands/player/ShortcutSetCodeCommand.java b/src/main/java/fr/gravencyg/commands/player/ShortcutSetCodeCommand.java new file mode 100644 index 0000000..ac785b3 --- /dev/null +++ b/src/main/java/fr/gravencyg/commands/player/ShortcutSetCodeCommand.java @@ -0,0 +1,32 @@ +package fr.gravencyg.commands.player; + +import fr.gravencyg.CYG; +import fr.gravencyg.commands.TCommand; +import fr.gravencyg.menus.options.OptionMenu; +import fr.gravencyg.utils.CLevel; +import org.bukkit.entity.Player; + +public class ShortcutSetCodeCommand extends TCommand { + + public ShortcutSetCodeCommand(CYG main) { + super(main, CLevel.LEVEL1, false, false, true, false); + } + + @Override + public void onExecute(Player player, String[] args) { + if(!player.getWorld().getName().contains(player.getUniqueId().toString())) + { + player.sendMessage("§cCommande à faire sur votre parcelle uniquement"); + return; + } + + if(gameManager().isPlayerInGame(player).size() != 0) + { + player.sendMessage("§cCommande impossible durant une partie"); + return; + } + + dataManager().setCode(player); + player.sendMessage("Nouveau spawn placé pour le code !"); + } +} diff --git a/src/main/java/fr/gravencyg/commands/player/ShortcutSetSpawnCommand.java b/src/main/java/fr/gravencyg/commands/player/ShortcutSetSpawnCommand.java new file mode 100644 index 0000000..7516ac8 --- /dev/null +++ b/src/main/java/fr/gravencyg/commands/player/ShortcutSetSpawnCommand.java @@ -0,0 +1,34 @@ +package fr.gravencyg.commands.player; + +import fr.gravencyg.CYG; +import fr.gravencyg.commands.TCommand; +import fr.gravencyg.menus.options.OptionMenu; +import fr.gravencyg.utils.CLevel; +import org.bukkit.entity.Player; + +public class ShortcutSetSpawnCommand extends TCommand { + + public ShortcutSetSpawnCommand(CYG main) { + super(main, CLevel.LEVEL1, false, false, true, false); + } + + @Override + public void onExecute(Player player, String[] args) { + + if(!player.getWorld().getName().contains(player.getUniqueId().toString())) + { + player.sendMessage("§cCommande à faire sur votre parcelle uniquement"); + return; + } + + if(gameManager().isPlayerInGame(player).size() != 0) + { + player.sendMessage("§cCommande impossible durant une partie"); + return; + } + + dataManager().setSpawn(player); + player.sendMessage("Nouveau spawn placé pour le /plot !"); + + } +} diff --git a/src/main/java/fr/gravencyg/commands/shortcut/ShopPremiumCommand.java b/src/main/java/fr/gravencyg/commands/shortcut/ShopPremiumCommand.java new file mode 100644 index 0000000..f9a5fe7 --- /dev/null +++ b/src/main/java/fr/gravencyg/commands/shortcut/ShopPremiumCommand.java @@ -0,0 +1,93 @@ +package fr.gravencyg.commands.shortcut; + +import fr.gravencyg.CYG; +import fr.gravencyg.manager.CYGDataManager; +import fr.gravencyg.menus.all.ActionMenu; +import fr.gravencyg.menus.options.OptionMenu; +import fr.gravencyg.model.Storage; +import fr.gravencyg.utils.CLevel; +import fr.gravencyg.utils.CRank; +import org.bukkit.*; +import org.bukkit.command.Command; +import org.bukkit.command.CommandExecutor; +import org.bukkit.command.CommandSender; +import org.bukkit.entity.Player; + +public class ShopPremiumCommand implements CommandExecutor { + + private CYG main; + + public ShopPremiumCommand(CYG main) { + this.main = main; + } + + @Override + public boolean onCommand(CommandSender sender, Command command, String s, String[] args) { + + if(!sender.isOp()) + { + return false; + } + + if(args.length < 2) + { + sender.sendMessage("/premium add [pseudo]"); + return false; + } + + String targetName = args[1]; + + // usage -> /premium add player + // usage -> /premium remove player + if(args[0].equalsIgnoreCase("add")) + { + + if(main.getDataManager().getStorages().containsKey(targetName)) + { + Bukkit.getServer().broadcastMessage("§7§e[Boutique]§7 "+targetName+" viens d'acheter le grade §ePremium !"); + CYGDataManager dataManager = main.getDataManager(); + + if (dataManager.getLevel(targetName) < 15) { + dataManager.setLevel(targetName, "15"); + } + + dataManager.getStorages().get(targetName).setRank("premium"); + dataManager.save(targetName, dataManager.getStorages().get(targetName).getUUID()); + + if(Bukkit.getPlayer(targetName) != null) + { + Player target = Bukkit.getPlayer(targetName); + main.getScoreboardManager().updatePlayerRank(target); + CRank r = dataManager.getRank(target); + target.setPlayerListName("[" + r.getColor() + "" + r.getSigle() + "§r] " + target.getName()); + } + + } + else{ + sender.sendMessage("Ce joueur n'a jamais rejoins le serveur"); + } + } + + if(args[0].equalsIgnoreCase("remove")) + { + if(main.getDataManager().getStorages().containsKey(targetName)) + { + CYGDataManager dataManager = main.getDataManager(); + + dataManager.getStorages().get(targetName).setRank("joueur"); + dataManager.save(targetName, dataManager.getStorages().get(targetName).getUUID()); + + if(Bukkit.getPlayer(targetName) != null) + { + Player target = Bukkit.getPlayer(targetName); + main.getScoreboardManager().updatePlayerRank(target); + CRank r = dataManager.getRank(target); + target.setPlayerListName("[" + r.getColor() + "" + r.getSigle() + "§r] " + target.getName()); + } + + } + } + + return false; + } +} diff --git a/src/main/java/fr/gravencyg/game/CYGame.java b/src/main/java/fr/gravencyg/game/CYGame.java new file mode 100644 index 0000000..eb489a5 --- /dev/null +++ b/src/main/java/fr/gravencyg/game/CYGame.java @@ -0,0 +1,206 @@ +package fr.gravencyg.game; + +import fr.gravencyg.actions.team.Team; +import fr.gravencyg.model.CYGameMode; +import fr.gravencyg.model.GameConfig; +import fr.gravencyg.model.MaterialAndData; +import fr.gravencyg.model.Storage; +import fr.gravencyg.utils.CEvent; +import org.bukkit.Location; +import org.bukkit.block.Block; +import org.bukkit.entity.Player; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +public class CYGame { + + private Storage storage; + private GameConfig config; + private Map> teams; + private List players; + private int countdown; + private CYGameMode gameMode; + + private boolean canFallDamage; + private boolean canBuild; + private boolean canFight; + + private Map breakBlocks; + private List placedBlocks; + private Map lifes; + + private int minPlayers; + private CYGameState state; + private int lifesPerPlayer; + private int maxPlayers; + private String ownerUUID; + private int gameId; + + public CYGame(Storage storage, int gameId) { + this.storage = storage; + this.config = storage.getPlots().get(gameId).getConfig(); + this.ownerUUID = storage.getUUID(); + this.gameId = gameId; + this.setup(); + } + + public void setup() { + this.players = new ArrayList<>(); + this.teams = new HashMap<>(); + this.countdown = config.getAutoStartTime(); + this.minPlayers = config.getAutoStartPlayer(); + this.maxPlayers = config.getMaxPlayers(); + this.lifes = new HashMap<>(); + this.state = CYGameState.WAITING; + this.gameMode = CYGameMode.DEATH_MATCH; + this.lifesPerPlayer = config.getLifes(); + this.canBuild = false; + this.canFight = false; + + this.clearRegenSave(); + } + + public void createTeam(Team team) { + teams.put(team, new ArrayList<>()); + } + + public void clearRegenSave() { + this.breakBlocks = new HashMap<>(); + this.placedBlocks = new ArrayList<>(); + } + + public void addPlayer(Player player) { + this.players.add(player); + this.lifes.put(player, lifesPerPlayer); + } + + public void removeLife(Player player){ + if(lifes.containsKey(player)) + { + int currentLife = lifes.get(player); + lifes.put(player, currentLife - 1); + } + } + + public boolean canRespawn(Player player){ + if(lifes.containsKey(player)) + { + return lifes.get(player) >= 1; + } + + return false; + } + + public boolean sameTeam(Player player1, Player player2) + { + if(getTeamPlayer(player1).equals(getTeamPlayer(player2))) + { + return true; + } + return false; + } + + public void eliminatePlayer(Player player) { + this.players.remove(player); + this.lifes.remove(player); + + if(hasTeamSystem()) + { + Team t = getTeamPlayer(player); + getTeams().get(t).remove(player); // remove player from team + } + + } + + public boolean hasTeamSystem(){ + return getTeams().size() >= 2; + } + + public Team getTeamPlayer(Player player) + { + Team tm = Team.BLUE; + + for(Map.Entry> t : getTeams().entrySet()) + { + if(t.getValue().contains(player)) + { + tm = t.getKey(); + break; + } + } + + return tm; + } + + public void setCountdown(int i) { this.countdown = i;} + + public void setState(CYGameState state) { this.state = state; } + + public void togglePvP() { this.canFight = !canFight; } + + public void toggleBuild() { this.canBuild = !canBuild; } + + public void toggleFallDamage() { this.canFallDamage = !canFallDamage; } + + public void decrementCountdown(){ this.countdown -= 1; } + + public Storage getStorage() { return storage; } + + public List getPlayers() { return players; } + + public String getName() { return config.getGameName(); } + + public Map getBreakBlocks(){ return breakBlocks; } + + public List getPlacedBlocks(){ return placedBlocks; } + + public boolean canBuild() { return canBuild; } + + public boolean canFight() { return canFight; } + + public boolean hasStarted() { return state == CYGameState.PLAYING; } + + public int getAutoStartMin() { return config.getAutoStartPlayer(); } + + public boolean isState(CYGameState state) { return this.state == state; } + + public boolean isMode(CYGameMode mode) { return this.gameMode == mode; } + + public boolean isTeamExist(Team team){ return teams.containsKey(team); } + + public CYGameState getState() { return state; } + + public int getCountdown() { return countdown; } + + public boolean canDamageFall() { return canFallDamage; } + + public int getMaxPlayers() { return maxPlayers; } + + public int getPlayerIndex(Player player) { + int i = 0; + for(Player pl : players) + { + if(pl.equals(player)) return i; + i++; + } + return 0; + } + + + public Map> getTeams() { return teams; } + + public int getLife(Player player) { + return lifes.get(player); + } + + public String getUUID() { + return ownerUUID; + } + + public int getGameId() { + return gameId; + } +} diff --git a/src/main/java/fr/gravencyg/game/CYGameManager.java b/src/main/java/fr/gravencyg/game/CYGameManager.java new file mode 100644 index 0000000..bea0ede --- /dev/null +++ b/src/main/java/fr/gravencyg/game/CYGameManager.java @@ -0,0 +1,365 @@ +package fr.gravencyg.game; + +import fr.gravencyg.CYG; +import fr.gravencyg.actions.team.Team; +import fr.gravencyg.model.MaterialAndData; +import fr.gravencyg.model.Plot; +import fr.gravencyg.model.Storage; +import fr.gravencyg.model.VerifyGameConfig; +import fr.gravencyg.utils.CEvent; +import org.bukkit.Bukkit; +import org.bukkit.GameMode; +import org.bukkit.Location; +import org.bukkit.Material; +import org.bukkit.block.Block; +import org.bukkit.boss.BossBar; +import org.bukkit.entity.Player; +import org.bukkit.potion.PotionEffect; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +public class CYGameManager { + + private CYG main; + + private Map> games = new HashMap<>(); + private Map verifyGames = new HashMap<>(); + private List onLoopEnable = new ArrayList<>(); + + public CYGameManager(CYG main) + { + + this.main = main; + + for(Map.Entry st : main.getDataManager().getStorages().entrySet()) + { + createStorageFullData(st.getValue()); + } + + } + + public void createStorageFullData(Storage st) { + for(Plot plot : st.getPlots()) { + if (plot != null) { + VerifyGameConfig verifyGameConfig = plot.getVerifyConfig(); + if (verifyGameConfig.isVerify()) + this.verifyGames.put(verifyGameConfig.getSlot(), st); + } + } + } + + public void create(String ownerName, int gameID){ + Storage storage = main.getDataManager().getStorages().get(ownerName); + + CYGame game = new CYGame(storage, gameID); + + if(!games.containsKey(ownerName)) + { + games.put(ownerName, new ArrayList<>()); + } + + List g = games.get(ownerName); + g.add(game); + games.put(ownerName, g); + } + + public void createTeam(CYGame game, Team team) { + game.createTeam(team); + } + + public void join(Player player, String targetName, int gameId) { + CYGame game = games.get(targetName).get(gameId); + + if(game == null) { + player.sendMessage("§cErreur sur le jeu, merci de contacter un modérateur"); + return; + } + + Plot targetPlot = main.getDataManager().getStorages().get(targetName).getPlots().get(gameId); + + if(!targetPlot.getEvents().containsKey("onJoin")){ + player.sendMessage("§cJeu invalide ! §lle créateur a oublié le onJoin()"); + + return; + } + + if(game.getPlayers().contains(player)) + { + player.sendMessage("§cTu es déjà dans le jeu !"); + return; + } + + if(game.getPlayers().size() == game.getMaxPlayers()){ + player.sendMessage("§cLe jeu est full !"); + return; + } + + player.teleport(targetPlot.getSpawn(game.getStorage().getUUID()+"#" + gameId)); + player.setLevel(0); + player.setHealth(20); + player.getEnderChest().clear(); + player.setFoodLevel(20); + player.getInventory().clear(); + player.setFlying(false); + player.setAllowFlight(false); + + if(game.isState(CYGameState.WAITING) || game.isState(CYGameState.STARTING)) { + game.addPlayer(player); + player.setGameMode(GameMode.SURVIVAL); + + main.getScoreboardManager().unload(player); + main.getScoreboardManager().loadGame(player, game); + + broadcast(game, player.getName() + " a rejoint le jeu !"); + main.getScoreboardManager().updateInGameTotalPlayers(game); + + runEvent(CEvent.JOIN, game, player); + } + + if(game.isState(CYGameState.PLAYING) || game.isState(CYGameState.FINISH)) + { + player.setGameMode(GameMode.SPECTATOR); + } + } + + public void death(Player player){ + CYGame game = main.getGameManager().getCurrentGame(player); + + game.removeLife(player); + player.sendMessage(game.getLife(player) + " vie(s) restante !"); + + if(!game.canRespawn(player)) + { + eliminate(player, game); + } + else{ + player.setHealth(20); + player.setFoodLevel(20); + + for(PotionEffect potionEffect : player.getActivePotionEffects()) + { + player.removePotionEffect(potionEffect.getType()); + } + } + } + + public void quit(Player player) { + + player.teleport(main.spawnLocation); + player.getInventory().clear(); + + + for(BossBar bossBarEntry : main.getBarActions()) + { + if(bossBarEntry.getPlayers().contains(player)) + { + bossBarEntry.removeAll(); + } + } + + for(Map.Entry> g : games.entrySet()) + { + for(CYGame gm : g.getValue()) { + if (gm.getPlayers().contains(player)) { + gm.eliminatePlayer(player); + + for (BossBar bossBarEntry : main.getBarActions()) { + if (bossBarEntry.getPlayers().contains(player)) { + bossBarEntry.removeAll(); + } + } + + main.getScoreboardManager().unload(player); + main.getScoreboardManager().load(player); + + player.getInventory().clear(); + player.setHealth(20); + player.setFoodLevel(20); + player.setFireTicks(0); + + player.setGameMode(GameMode.SURVIVAL); + + for (PotionEffect potionEffect : player.getActivePotionEffects()) { + player.removePotionEffect(potionEffect.getType()); + } + + broadcast(gm, player.getName() + " a quitter le jeu !"); + main.getScoreboardManager().updateInGameTotalPlayers(gm); + } + + } + } + } + + public void eliminate(Player player, CYGame game) { + + if (game.getPlayers().contains(player)) + { + game.eliminatePlayer(player); + main.getScoreboardManager().unload(player); + main.getScoreboardManager().load(player); + + player.getInventory().clear(); + player.setGameMode(GameMode.SURVIVAL); + + for(PotionEffect potionEffect : player.getActivePotionEffects()) + { + player.removePotionEffect(potionEffect.getType()); + } + + if(main.getFreezeGamePlayers().contains(player)){ + main.getFreezeGamePlayers().remove(player); + } + + broadcast(game, player.getName() + " est éliminé du jeu !"); + + + main.getDataManager().addTrophy(player, 3); + player.sendMessage("§r+ §e3§r Trophés de participation !"); + player.teleport(main.spawnLocation); + + main.getScoreboardManager().updateInGameTotalPlayers(game); + + if(game.getPlayers().size() == 1 || game.getPlayers().size() == 0) + { + game.setState(CYGameState.FINISH); + main.getGameManager().stop(game); + } + } + } + + public void broadcast(CYGame game, String message) { + for(Player player : game.getPlayers()) + { + player.sendMessage("§7[§e"+game.getName()+"§7]§r " + message); + } + } + + public void playLoop() { + for(Map.Entry> g : main.getGameManager().getGames().entrySet()) + { + for(CYGame game : g.getValue()) + { + if(!onLoopEnable.contains(game.getStorage()) && game.isState(CYGameState.PLAYING)) { + if(game.getPlayers().size() == 0) continue; + runEvent(CEvent.LOOP, game, game.getPlayers().get(0)); + onLoopEnable.add(game.getStorage()); + } + } + } + } + + public void regenMap(CYGame game) { + for(Block placed : game.getPlacedBlocks()) + { + placed.setType(Material.AIR); + } + + for(Map.Entry breaked : game.getBreakBlocks().entrySet()) + { + breaked.getKey().getBlock().setType(breaked.getValue().getMaterial()); + //breaked.getKey().getBlock().setData(breaked.getValue().getData()); + + } + + game.clearRegenSave(); + } + + public void runEvent(CEvent event, CYGame game, Player player, Block block, Material material) { + String ownerPlotUUId = game.getStorage().getUUID(); + + if(game.getStorage().getPlot(player.getWorld().getName()).hasEvent(event.getEventName())) { + main.getCompilerManager().runEvent(player, ownerPlotUUId + "#" + game.getGameId(), event.getEventName(), false, event.isAffectingAllPlayers(), block, material); + } + } + + public void runEvent(CEvent event, Storage storage, Player player) { + String ownerPlotUUId = storage.getUUID(); + + if(storage.getPlot(player.getWorld().getName()).hasEvent(event.getEventName())) { + main.getCompilerManager().runEvent(player, ownerPlotUUId, event.getEventName(), false, event.isAffectingAllPlayers(), null, Material.LAPIS_BLOCK); + } + } + + public void runEvent(CEvent event, CYGame game, Player player) { + runEvent(event, game, player, null, Material.LAPIS_BLOCK); + } + + public void runBlockEvent(CEvent event, CYGame game, Player player, Block block) { + runEvent(event, game, player, block, block.getType()); + } + + public boolean hasPendingGame(String ownerName, int gameId) { + return games.containsKey(ownerName); + } + + public void stop(CYGame game) { + String key = ""; + + for(Player player : game.getPlayers()) + { + eliminate(player, game); + } + + regenMap(game); + + game.setup(); + + for(Map.Entry> game1 : games.entrySet()) + { + for(CYGame c : game1.getValue()) + { + if(c.equals(game)) + { + key = game1.getKey(); + } + } + } + + games.remove(key); + + } + public List isPlayerInGame(Player player) { + + List gs = new ArrayList<>(); + + for(Map.Entry> d : games.entrySet()) { + for (CYGame game : d.getValue()) { + if (game.getPlayers().contains(player)) { + gs.add(game); + } + } + } + + return gs; + } + + public CYGame getCurrentGame(Player player) { + for(Map.Entry> d : games.entrySet()) + { + for(CYGame g : d.getValue()) + { + if(g.getPlayers().contains(player)) + { + return g; + } + } + } + + return null; + } + + public Map getVerifyGames(){ return verifyGames; } + + public Map> getGames() { return games;} + + + public void removeLoopStorage(Storage storage) { + if (onLoopEnable.contains(storage)) { + onLoopEnable.remove(storage); + } + } +} diff --git a/src/main/java/fr/gravencyg/game/CYGameState.java b/src/main/java/fr/gravencyg/game/CYGameState.java new file mode 100644 index 0000000..7f7ee1f --- /dev/null +++ b/src/main/java/fr/gravencyg/game/CYGameState.java @@ -0,0 +1,21 @@ +package fr.gravencyg.game; + +public enum CYGameState { + + WAITING("En attente"), + STARTING("Démarrage"), + PLAYING("En Partie"), + FINISH("Fin"); + + private String name; + + CYGameState(String name) + { + this.name = name; + } + + public String getName() + { + return name; + } +} diff --git a/src/main/java/fr/gravencyg/items/Armor.java b/src/main/java/fr/gravencyg/items/Armor.java new file mode 100644 index 0000000..efa5f5f --- /dev/null +++ b/src/main/java/fr/gravencyg/items/Armor.java @@ -0,0 +1,7 @@ +package fr.gravencyg.items; + +public enum Armor { + + HELMET, CHESTPLATE, LEGGINGS, BOOTS; + +} diff --git a/src/main/java/fr/gravencyg/items/ArmorManager.java b/src/main/java/fr/gravencyg/items/ArmorManager.java new file mode 100644 index 0000000..551293c --- /dev/null +++ b/src/main/java/fr/gravencyg/items/ArmorManager.java @@ -0,0 +1,66 @@ +package fr.gravencyg.items; + +import java.util.HashMap; +import java.util.Map; + +import org.bukkit.Material; +import org.bukkit.entity.Player; +import org.bukkit.inventory.ItemStack; + +public class ArmorManager { + + private Map armors = new HashMap<>(); + + public ArmorManager() { + + armors.put(Material.LEATHER_HELMET, Armor.HELMET); + armors.put(Material.CHAINMAIL_HELMET, Armor.HELMET); + armors.put(Material.IRON_HELMET, Armor.HELMET); + armors.put(Material.GOLDEN_HELMET, Armor.HELMET); + armors.put(Material.DIAMOND_HELMET, Armor.HELMET); + armors.put(Material.SKELETON_SKULL, Armor.HELMET); + + armors.put(Material.LEATHER_CHESTPLATE, Armor.CHESTPLATE); + armors.put(Material.CHAINMAIL_CHESTPLATE, Armor.CHESTPLATE); + armors.put(Material.IRON_CHESTPLATE, Armor.CHESTPLATE); + armors.put(Material.GOLDEN_CHESTPLATE, Armor.CHESTPLATE); + armors.put(Material.DIAMOND_CHESTPLATE, Armor.CHESTPLATE); + + armors.put(Material.LEATHER_LEGGINGS, Armor.LEGGINGS); + armors.put(Material.CHAINMAIL_LEGGINGS, Armor.LEGGINGS); + armors.put(Material.IRON_LEGGINGS, Armor.LEGGINGS); + armors.put(Material.GOLDEN_LEGGINGS, Armor.LEGGINGS); + armors.put(Material.DIAMOND_LEGGINGS, Armor.LEGGINGS); + + armors.put(Material.LEATHER_BOOTS, Armor.BOOTS); + armors.put(Material.CHAINMAIL_BOOTS, Armor.BOOTS); + armors.put(Material.IRON_BOOTS, Armor.BOOTS); + armors.put(Material.GOLDEN_BOOTS, Armor.BOOTS); + armors.put(Material.DIAMOND_BOOTS, Armor.BOOTS); + + } + + public void addItem(Player player, ItemStack item){ + + Material mat = item.getType(); + + if(armors.containsKey(mat)) + { + + switch(armors.get(mat)) + { + case HELMET: player.getInventory().setHelmet(item); break; + case CHESTPLATE: player.getInventory().setChestplate(item); break; + case LEGGINGS: player.getInventory().setLeggings(item); break; + case BOOTS: player.getInventory().setBoots(item); break; + default: break; + } + + return; + } + + player.getInventory().addItem(item); + + } + +} \ No newline at end of file diff --git a/src/main/java/fr/gravencyg/items/ItemBuilder.java b/src/main/java/fr/gravencyg/items/ItemBuilder.java new file mode 100644 index 0000000..d31f82a --- /dev/null +++ b/src/main/java/fr/gravencyg/items/ItemBuilder.java @@ -0,0 +1,225 @@ +package fr.gravencyg.items; + +import org.bukkit.DyeColor; +import org.bukkit.Material; +import org.bukkit.inventory.ItemStack; +import org.bukkit.inventory.meta.LeatherArmorMeta; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import java.util.Map; + +import org.bukkit.Color; +import org.bukkit.enchantments.Enchantment; +import org.bukkit.inventory.meta.ItemMeta; +import org.bukkit.inventory.meta.SkullMeta; + +/** + * Easily create itemstacks, without messing your hands. + * Note that if you do use this in one of your projects, leave this notice. + * Please do credit me if you do use this in one of your projects. + * @author NonameSL + */ +public class ItemBuilder { + private ItemStack is; + /** + * Create a new ItemBuilder from scratch. + * @param m The material to create the ItemBuilder with. + */ + public ItemBuilder(Material m){ + this(m, 1); + } + /** + * Create a new ItemBuilder over an existing itemstack. + * @param is The itemstack to create the ItemBuilder over. + */ + public ItemBuilder(ItemStack is){ + this.is=is; + } + /** + * Create a new ItemBuilder from scratch. + * @param m The material of the item. + * @param amount The amount of the item. + */ + public ItemBuilder(Material m, int amount){ + is= new ItemStack(m, amount); + } + /** + * Create a new ItemBuilder from scratch. + * @param m The material of the item. + * @param amount The amount of the item. + * @param durability The durability of the item. + */ + public ItemBuilder(Material m, int amount, byte durability){ + is = new ItemStack(m, amount, durability); + } + /** + * Clone the ItemBuilder into a new one. + * @return The cloned instance. + */ + public ItemBuilder clone(){ + return new ItemBuilder(is); + } + /** + * Change the durability of the item. + * @param dur The durability to set it to. + */ + public ItemBuilder setDurability(short dur){ + is.setDurability(dur); + return this; + } + /** + * Set the displayname of the item. + * @param name The name to change it to. + */ + public ItemBuilder setName(String name){ + ItemMeta im = is.getItemMeta(); + im.setDisplayName(name); + is.setItemMeta(im); + return this; + } + /** + * Add an unsafe enchantment. + * @param ench The enchantment to add. + * @param level The level to put the enchant on. + */ + public ItemBuilder addUnsafeEnchantment(Enchantment ench, int level){ + is.addUnsafeEnchantment(ench, level); + return this; + } + /** + * Remove a certain enchant from the item. + * @param ench The enchantment to remove + */ + public ItemBuilder removeEnchantment(Enchantment ench){ + is.removeEnchantment(ench); + return this; + } + /** + * Set the skull owner for the item. Works on skulls only. + * @param owner The name of the skull's owner. + */ + public ItemBuilder setSkullOwner(String owner){ + try{ + SkullMeta im = (SkullMeta)is.getItemMeta(); + im.setOwner(owner); + is.setItemMeta(im); + }catch(ClassCastException expected){} + return this; + } + /** + * Add an enchant to the item. + * @param ench The enchant to add + * @param level The level + */ + public ItemBuilder addEnchant(Enchantment ench, int level){ + ItemMeta im = is.getItemMeta(); + im.addEnchant(ench, level, true); + is.setItemMeta(im); + return this; + } + /** + * Add multiple enchants at once. + * @param enchantments The enchants to add. + */ + public ItemBuilder addEnchantments(Map enchantments){ + is.addEnchantments(enchantments); + return this; + } + /** + * Sets infinity durability on the item by setting the durability to Short.MAX_VALUE. + */ + public ItemBuilder setInfinityDurability(){ + is.setDurability(Short.MAX_VALUE); + return this; + } + /** + * Re-sets the lore. + * @param lore The lore to set it to. + */ + public ItemBuilder setLore(String... lore){ + ItemMeta im = is.getItemMeta(); + im.setLore(Arrays.asList(lore)); + is.setItemMeta(im); + return this; + } + /** + * Re-sets the lore. + * @param lore The lore to set it to. + */ + public ItemBuilder setLore(List lore) { + ItemMeta im = is.getItemMeta(); + im.setLore(lore); + is.setItemMeta(im); + return this; + } + + public ItemBuilder removeLoreLine(String line){ + ItemMeta im = is.getItemMeta(); + List lore = new ArrayList<>(im.getLore()); + if(!lore.contains(line))return this; + lore.remove(line); + im.setLore(lore); + is.setItemMeta(im); + return this; + } + /** + * Remove a lore line. + * @param index The index of the lore line to remove. + */ + public ItemBuilder removeLoreLine(int index){ + ItemMeta im = is.getItemMeta(); + List lore = new ArrayList<>(im.getLore()); + if(index<0||index>lore.size())return this; + lore.remove(index); + im.setLore(lore); + is.setItemMeta(im); + return this; + } + /** + * Add a lore line. + * @param line The lore line to add. + */ + public ItemBuilder addLoreLine(String line){ + ItemMeta im = is.getItemMeta(); + List lore = new ArrayList<>(); + if(im.hasLore())lore = new ArrayList<>(im.getLore()); + lore.add(line); + im.setLore(lore); + is.setItemMeta(im); + return this; + } + /** + * Add a lore line. + * @param line The lore line to add. + * @param pos The index of where to put it. + */ + public ItemBuilder addLoreLine(String line, int pos){ + ItemMeta im = is.getItemMeta(); + List lore = new ArrayList<>(im.getLore()); + lore.set(pos, line); + im.setLore(lore); + is.setItemMeta(im); + return this; + } + /** + * Sets the armor color of a leather armor piece. Works only on leather armor pieces. + * @param color The color to set it to. + */ + public ItemBuilder setLeatherArmorColor(Color color){ + try{ + LeatherArmorMeta im = (LeatherArmorMeta)is.getItemMeta(); + im.setColor(color); + is.setItemMeta(im); + }catch(ClassCastException expected){} + return this; + } + /** + * Retrieves the itemstack from the ItemBuilder. + * @return The itemstack created/modified by the ItemBuilder instance. + */ + public ItemStack toItemStack(){ + return is; + } +} diff --git a/src/main/java/fr/gravencyg/listeners/BlockListener.java b/src/main/java/fr/gravencyg/listeners/BlockListener.java new file mode 100644 index 0000000..ef99269 --- /dev/null +++ b/src/main/java/fr/gravencyg/listeners/BlockListener.java @@ -0,0 +1,270 @@ +package fr.gravencyg.listeners; + +import fr.gravencyg.CYG; +import fr.gravencyg.game.CYGame; +import fr.gravencyg.manager.CYGHologramManager; +import fr.gravencyg.menus.all.*; +import fr.gravencyg.menus.locations.LocationSelectMenu; +import fr.gravencyg.menus.messages.MessageSelectMenu; +import fr.gravencyg.model.MaterialAndData; +import fr.gravencyg.model.Plot; +import fr.gravencyg.model.Storage; +import fr.gravencyg.utils.CEvent; +import org.bukkit.ChatColor; +import org.bukkit.Material; +import org.bukkit.World; +import org.bukkit.block.Block; +import org.bukkit.block.Chest; +import org.bukkit.block.Dropper; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.Listener; +import org.bukkit.event.block.*; +import org.bukkit.event.player.PlayerInteractEvent; + +public class BlockListener implements Listener { + + private CYG main; + + public BlockListener(CYG main) { + this.main = main; + } + + @EventHandler + public void onPlace(BlockPlaceEvent event) { + + Player player = event.getPlayer(); + Block block = event.getBlock(); + + // DISABLE PLACING BLOCK IN THE HUB + if(block.getWorld().getName().equalsIgnoreCase("world") && !player.getName().equalsIgnoreCase("GravenYT") && !player.getName().equalsIgnoreCase("FragZzH")) + { + event.setCancelled(true); + } + + Plot plot = main.getDataManager().getStorageByUUID(player.getWorld().getName()).getPlot(player.getWorld().getName()); + + if(plot != null ) { + if (main.getGameManager().isPlayerInGame(player).size() != 0) { + CYGame game = main.getGameManager().getCurrentGame(player); + if (!game.canBuild()) { + event.setCancelled(true); + } else { + game.getPlacedBlocks().add(block); + main.getGameManager().runBlockEvent(CEvent.PLACE, game, player, block); + } + } else if (main.getGameManager().isPlayerInGame(player).size()==0 && !block.getWorld().getName().contains(player.getUniqueId().toString()) + && !plot.getFriends().contains(player.getName())) { + event.setCancelled(true); + } + } + } + + @EventHandler + public void onBreak(BlockBreakEvent event) { + + Player player = event.getPlayer(); + Block block = event.getBlock(); + + if (block.getWorld().getName().equalsIgnoreCase("world") && !player.getName().equalsIgnoreCase("GravenYT") && !player.getName().equalsIgnoreCase("FragZzH")) { + event.setCancelled(true); + return; + } + + + Plot plot = main.getDataManager().getStorageByUUID(player.getWorld().getName()).getPlot(player.getWorld().getName()); + + if(plot != null) { + + if (main.getGameManager().isPlayerInGame(player).size()!=0) { + CYGame game = main.getGameManager().getCurrentGame(player); + if (!game.canBuild()) { + event.setCancelled(true); + } else { + game.getBreakBlocks().put(block.getLocation(), new MaterialAndData(block.getType(), block.getData())); + main.getGameManager().runBlockEvent(CEvent.BREAK, game, player, block); + } + + } else if (main.getGameManager().isPlayerInGame(player).size()==0 && !block.getWorld().getName().contains(player.getUniqueId().toString()) + && !plot.getFriends().contains(player.getName())) { + event.setCancelled(true); + } + + if (block.getType() == Material.LAPIS_BLOCK) { + World world = block.getWorld(); + + // the block breaker is the owner of the plot + if (world.getName().contains(player.getUniqueId().toString())) { + + main.getDataManager().removeEvent(player, block); + main.getDataManager().save(player); + + CYGHologramManager hologramManager = main.getHologramManager(); + hologramManager.removeHologram(block); + } + } + } + + } + + @EventHandler + public void onSign(BlockPistonExtendEvent event){ + event.setCancelled(true); + } + + @EventHandler + public void onSign(SignChangeEvent event){ + for(int i = 0; i < event.getLines().length; i++) { + event.setLine(i, event.getLine(i).replace("&", "§")); + } + } + + @EventHandler + public void onDispense(BlockDispenseEvent event){ + event.setCancelled(true); + } + + @EventHandler + public void onDispense(BlockSpreadEvent event){ + if(event.getBlock().getType() == Material.MYCELIUM) { + event.setCancelled(true); + } + } + + @EventHandler + public void onClickBlock(PlayerInteractEvent event) { + + Player player = event.getPlayer(); + + if(player.getWorld().getName().equalsIgnoreCase("world")) return; + + + Storage storage = main.getDataManager().getStorageByUUID(player.getWorld().getName()); + Plot plot = storage.getPlot(player.getWorld().getName()); + + if(plot != null) { + + boolean isNotFriendOrOwner = !plot.getFriends().contains(player.getName()) && !storage.getDisplayName().equalsIgnoreCase(player.getName()); + + if(!isNotFriendOrOwner && player.getInventory().getItemInMainHand().getType() == Material.GOLDEN_HOE && event.getClickedBlock().getType() != Material.AIR) + { + + Block block = event.getClickedBlock(); + main.getWorldEditManager().setPoint(player, block.getLocation()); + event.setCancelled(true); + return; + } + + + if(event.getAction() == Action.LEFT_CLICK_AIR && player.getInventory().getItemInMainHand().getType() != Material.AIR) { + main.getGameManager().runEvent(CEvent.LEFT_CLICK, storage, player); + } + + if(event.getAction() == Action.RIGHT_CLICK_AIR) { + main.getGameManager().runEvent(CEvent.RIGHT_CLICK, storage, player); + } + + if(event.getAction() == Action.RIGHT_CLICK_BLOCK && event.getClickedBlock().getType() != Material.AIR) { + + Block block = event.getClickedBlock(); + if (block.getType() == Material.LAPIS_BLOCK) { + + if (isNotFriendOrOwner) { + player.sendMessage("§cVous devez faire partit des développeurs de ce jeu"); + event.setCancelled(true); + return; + } + + main.getMenuManager().open(player, EventMenu.class); + main.getEventBlockCache().put(player, block); + + } + + if (block.getType() == Material.BEACON) { + + event.setCancelled(true); + + if (isNotFriendOrOwner) { + player.sendMessage("§cVous devez faire partit des développeurs de ce jeu"); + event.setCancelled(true); + return; + } + + if (!player.isSneaking()) { + main.getMenuManager().open(player, LocationSelectMenu.class); + + main.getEventBlockCache().put(player, block); + } + + } + + if (block.getType() == Material.CHEST) { + Chest chest = (Chest) event.getClickedBlock().getState(); + + if (chest.getCustomName().equalsIgnoreCase(ChatColor.BLUE + "Stuff()")) { + if (isNotFriendOrOwner) { + player.sendMessage("§cVous devez faire partit des développeurs de ce jeu"); + event.setCancelled(true); + } + } + + } + + if (block.getType() == Material.DROPPER) { + Dropper dropper = (Dropper) event.getClickedBlock().getState(); + + if (dropper.getCustomName().equalsIgnoreCase(ChatColor.BLUE + "DropItem()")) { + if (isNotFriendOrOwner) { + player.sendMessage("§cVous devez faire partit des développeurs de ce jeu"); + event.setCancelled(true); + } + } + + } + + if (block.getType() == Material.BOOKSHELF || block.getType() == Material.SEA_LANTERN || block.getType() == Material.SOUL_SAND) { + + event.setCancelled(true); + + if (isNotFriendOrOwner) { + player.sendMessage("§cVous devez faire partit des développeurs de ce jeu"); + event.setCancelled(true); + return; + } + + if (!player.isSneaking()) { + main.getMenuManager().open(player, MessageSelectMenu.class); + main.getEventBlockCache().put(player, block); + } + + } + } + + + } + + // DISABLE BLOCKS + if (event.getAction() == Action.RIGHT_CLICK_AIR || event.getAction() == Action.RIGHT_CLICK_BLOCK) { + if (player.getInventory().getItemInMainHand().getType() == Material.OAK_BOAT || + player.getInventory().getItemInMainHand().getType() == Material.ACACIA_BOAT || + player.getInventory().getItemInMainHand().getType() == Material.BIRCH_BOAT || + player.getInventory().getItemInMainHand().getType() == Material.JUNGLE_BOAT || + player.getInventory().getItemInMainHand().getType() == Material.DARK_OAK_BOAT || + player.getInventory().getItemInMainHand().getType() == Material.SPRUCE_BOAT) { + event.setCancelled(true); + } + } + + // HUB DISABLE ITEMS + if(player.getWorld().getName().equalsIgnoreCase("world")) + { + if(player.getInventory().getItemInMainHand().getType() == Material.SPLASH_POTION || + player.getInventory().getItemInMainHand().getType() == Material.LAVA_BUCKET || + player.getInventory().getItemInMainHand().getType() == Material.WATER_BUCKET) { + event.setCancelled(true); + } + } + + } + +} \ No newline at end of file diff --git a/src/main/java/fr/gravencyg/listeners/ChatListener.java b/src/main/java/fr/gravencyg/listeners/ChatListener.java new file mode 100644 index 0000000..3a06c7a --- /dev/null +++ b/src/main/java/fr/gravencyg/listeners/ChatListener.java @@ -0,0 +1,55 @@ +package fr.gravencyg.listeners; + +import fr.gravencyg.CYG; +import fr.gravencyg.utils.CRank; +import org.bukkit.ChatColor; +import org.bukkit.GameMode; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.Listener; +import org.bukkit.event.player.AsyncPlayerChatEvent; +import org.bukkit.event.player.PlayerJoinEvent; +import org.bukkit.event.player.PlayerQuitEvent; + +public class ChatListener implements Listener { + + private CYG main; + + public ChatListener(CYG main) { + this.main = main; + } + + @EventHandler + public void onChat(AsyncPlayerChatEvent event) { + + Player player = event.getPlayer(); + + String message = event.getMessage().replace("%",""); + + // Set join message + CRank rank = CRank.JOUEUR; + boolean verifyGame = false; + int level = 0; + int trophys = 0; + + rank = main.getDataManager().getRank(player); + level = main.getDataManager().getLevel(player.getName()); + trophys = main.getDataManager().getTrophys(player.getName()); + + String msg = rank.getColor() + "" + + rank.getName() + " §r| Lvl " + + rank.getColor() + + level + + " §r- §r §e" + + trophys + + " T §r|§r " + + player.getName(); + + msg += " §7>> " + rank.getColor() + "" + message; + + event.setFormat(msg); + + } + + +} diff --git a/src/main/java/fr/gravencyg/listeners/PlayerListener.java b/src/main/java/fr/gravencyg/listeners/PlayerListener.java new file mode 100644 index 0000000..7498662 --- /dev/null +++ b/src/main/java/fr/gravencyg/listeners/PlayerListener.java @@ -0,0 +1,315 @@ +package fr.gravencyg.listeners; + +import fr.gravencyg.CYG; +import fr.gravencyg.game.CYGame; +import fr.gravencyg.game.CYGameState; +import fr.gravencyg.utils.CEvent; +import fr.gravencyg.utils.CRank; +import org.bukkit.*; +import org.bukkit.block.Block; +import org.bukkit.entity.Entity; +import org.bukkit.entity.EntityType; +import org.bukkit.entity.Player; +import org.bukkit.entity.Projectile; +import org.bukkit.event.EventHandler; +import org.bukkit.event.Listener; +import org.bukkit.event.entity.EntityDamageByEntityEvent; +import org.bukkit.event.entity.EntityDamageEvent; +import org.bukkit.event.entity.PlayerDeathEvent; +import org.bukkit.event.player.*; +import org.bukkit.event.server.ServerListPingEvent; + +public class PlayerListener implements Listener { + + private CYG main; + + public PlayerListener(CYG main) { + this.main = main; + } + + @EventHandler + public void onPing(ServerListPingEvent e){ + e.setMaxPlayers(Bukkit.getOnlinePlayers().size() + 1); + } + + @EventHandler + public void onJoin(PlayerJoinEvent event) { + + Player player = event.getPlayer(); + + // Set player to CREATIVE mode + player.setGameMode(GameMode.SURVIVAL); + + // Teleport to hub + player.teleport(main.spawnLocation); + + if(!player.isOp()) { + player.setAllowFlight(false); + player.setFlying(false); + } + + // Set Hub time to 0 + player.getWorld().setTime(0); + player.getInventory().clear(); + + // Create player file + main.getDataManager().createProfileIfNotExist(player); + + main.getDataManager().refreshLevel(player.getName()); + + // Display NPCs + main.getNpcManager().display(player); + + // Set Level + player.setLevel(main.getDataManager().getLevel(player.getName())); + + // Join title + player.sendTitle("§eGravenMC", "§6Code tes propres mini-jeux"); + + // Set join message + CRank rank = main.getDataManager().getRank(player); + + if(rank == CRank.PREMIUM || rank.isMod()) { + event.setJoinMessage(rank.getColor() + "" + rank.getName() + ChatColor.RESET + " - " + player.getName() + ChatColor.RESET + " se connecte !"); + } + else{ + event.setJoinMessage(null); + } + + player.setPlayerListName(ChatColor.YELLOW + "§r[§r" + rank.getColor() + "" + rank.getSigle() + "§r] " + player.getName()); + + // Scoreboard + main.getScoreboardManager().load(player); + } + + @EventHandler + public void onQuit(PlayerQuitEvent event) { + + Player player = event.getPlayer(); + + CRank rank = main.getDataManager().getRank(player); + + if(rank == CRank.PREMIUM || rank.isMod()) { + event.setQuitMessage(rank.getColor() + "" + rank.getName() + ChatColor.RESET + " - " + player.getName() + ChatColor.RESET + " se deconnecte !"); + } + else{ + event.setQuitMessage(null); + } + + // Scoreboard + main.getScoreboardManager().unload(player); + main.getScoreboardManager().updateTotalPlayers(); + main.getGameManager().quit(player); + + } + + @EventHandler + public void onPlayerMove(PlayerMoveEvent event) { + Player player = event.getPlayer(); + + if(main.getFreezeModPlayers().contains(player) || main.getFreezeGamePlayers().contains(player)) { + event.setTo(event.getFrom()); + } + + if(main.getGameManager().isPlayerInGame(player).size()!=0) + { + CYGame game = main.getGameManager().getCurrentGame(player); + if(game.isState(CYGameState.PLAYING)) + { + if(player.getLocation().getY() <= 0) { + player.teleport(new Location(player.getWorld(), 0, 20, 0)); + player.setFallDistance(20); + main.getGameManager().runEvent(CEvent.VOID, game, player); + main.getGameManager().death(player); + } + else{ + + Block bottom = player.getLocation().clone().add(0, -1, 0).getBlock(); + + if(bottom.getType() != Material.AIR) { + main.getGameManager().runBlockEvent(CEvent.WALK, game, player, bottom); + } + + } + } + + } + } + + @EventHandler + public void onDeath(PlayerDeathEvent event) + { + event.setDeathMessage(null); + + Bukkit.getScheduler().scheduleSyncDelayedTask(main, () -> { + event.getEntity().spigot().respawn(); + }, 1L); + + } + + @EventHandler + public void onItemDrop(PlayerDropItemEvent event) + { + if(event.getPlayer().getWorld().getName().equalsIgnoreCase("world")) + { + event.setCancelled(true); + } + } + + @EventHandler + public void onDamage(EntityDamageEvent event) { + Entity victim = event.getEntity(); + if(victim.getType() == EntityType.PLAYER) + { + Player victimP = (Player) victim; + if(main.getGameManager().isPlayerInGame(victimP).size()!=0) + { + + CYGame game = main.getGameManager().getCurrentGame(victimP); + + if(!game.hasStarted()) + { + event.setCancelled(true); + return; + } + + if(event.getCause() == EntityDamageEvent.DamageCause.FALL || event.getCause() == EntityDamageEvent.DamageCause.FALLING_BLOCK + && game.canDamageFall()) + { + event.setCancelled(true); + return; + } + + if(victimP.getHealth() - event.getDamage() <= 0) + { + event.setCancelled(true); + victimP.setGameMode(GameMode.SPECTATOR); + main.getGameManager().death(victimP.getPlayer()); + main.getGameManager().runEvent(CEvent.DEATH, game, victimP); + + return; + } + + + }else { + + + if (event.getCause() == EntityDamageEvent.DamageCause.VOID) { + event.setCancelled(true); + victimP.teleport(new Location(victimP.getWorld(), 0, 20, 0)); + + } + } + + if (victimP.getHealth() - event.getDamage() <= 0) { + event.setCancelled(true); + } + + } + + } + + @EventHandler + public void onCommand(PlayerCommandPreprocessEvent event) { + Player player = event.getPlayer(); + String[] args = event.getMessage().split(" "); + + if((args[0].contains("worldedit") || args[0].contains("//") ) && player.isOp()) + { + event.setCancelled(true); + } + + if(args[0].equalsIgnoreCase("/ver")) + { + event.setCancelled(true); + } + + if(args[0].equalsIgnoreCase("/tell")) + { + event.setCancelled(true); + } + + if(args[0].equalsIgnoreCase("/w")) + { + event.setCancelled(true); + } + + if(args[0].equalsIgnoreCase("?")) + { + event.setCancelled(true); + } + + if(args[0].equalsIgnoreCase("/me")) + { + event.setCancelled(true); + } + } + + @EventHandler + public void onPvP(EntityDamageByEntityEvent event) { + Entity damager = event.getDamager(); + Entity victim = event.getEntity(); + + if(damager.getType() == EntityType.ARROW) { + Player victimP = (Player) victim; + Player shooter = (Player) ((Projectile)event.getDamager()).getShooter(); + + if(main.getGameManager().isPlayerInGame(victimP).size()!=0) + { + CYGame game = main.getGameManager().getCurrentGame(victimP); + if(!game.canFight()) + { + event.setCancelled(true); + } + + if(game.sameTeam(victimP.getPlayer(), shooter) && game.hasTeamSystem()) + { + damager.sendMessage("§cVous êtes dans la même équipe !"); + event.setCancelled(true); + } + + if(victimP.getHealth() - event.getDamage() <= 0) + { + main.getGameManager().runEvent(CEvent.KILL, game, shooter); + } + } + } + + if(damager.getType() == EntityType.PLAYER && victim.getType() == EntityType.PLAYER) + { + Player victimP = (Player) victim; + if(main.getGameManager().isPlayerInGame(victimP).size()!=0) + { + CYGame game = main.getGameManager().getCurrentGame(victimP); + if(!game.canFight()) + { + event.setCancelled(true); + } + + if(game.sameTeam(victimP.getPlayer(), (Player) damager) && game.hasTeamSystem()) + { + damager.sendMessage("§cVous êtes dans la même équipe !"); + event.setCancelled(true); + } + + if(victimP.getHealth() - event.getDamage() <= 0) + { + main.getGameManager().runEvent(CEvent.KILL, game, ((Player) damager).getPlayer()); + } + } + } + + + } + + @EventHandler + public void onTeleport(PlayerTeleportEvent event){ + if (event.getCause() == PlayerTeleportEvent.TeleportCause.ENDER_PEARL && event.getPlayer().getWorld().getName().equalsIgnoreCase("world")){ + event.setCancelled(true); + } + + if (event.getPlayer().getGameMode() == GameMode.SPECTATOR && event.getCause().equals(PlayerTeleportEvent.TeleportCause.SPECTATE)) + event.setCancelled(true); + } + +} diff --git a/src/main/java/fr/gravencyg/listeners/WorldListener.java b/src/main/java/fr/gravencyg/listeners/WorldListener.java new file mode 100644 index 0000000..fcf260e --- /dev/null +++ b/src/main/java/fr/gravencyg/listeners/WorldListener.java @@ -0,0 +1,125 @@ +package fr.gravencyg.listeners; + +import fr.gravencyg.CYG; +import fr.gravencyg.menus.all.EventMenu; +import org.bukkit.Bukkit; +import org.bukkit.GameMode; +import org.bukkit.Location; +import org.bukkit.Material; +import org.bukkit.block.Block; +import org.bukkit.block.CreatureSpawner; +import org.bukkit.entity.EntityType; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.Listener; +import org.bukkit.event.block.*; +import org.bukkit.event.entity.*; +import org.bukkit.event.player.PlayerChangedWorldEvent; +import org.bukkit.event.player.PlayerInteractEvent; +import org.bukkit.event.weather.WeatherChangeEvent; +import org.bukkit.event.world.PortalCreateEvent; +import org.bukkit.potion.PotionEffect; + +public class WorldListener implements Listener { + + private CYG main; + + public WorldListener(CYG main) { + this.main = main; + } + + @EventHandler + public void onWeather(WeatherChangeEvent event) { + event.setCancelled(true); + } + + @EventHandler + public void onFire(BlockBurnEvent event){ + event.setCancelled(true); + } + + @EventHandler + public void onFeed(FoodLevelChangeEvent event){ + if(event.getEntity().getWorld().getName().equalsIgnoreCase("world")) { + event.setFoodLevel(20); + } + } + + @EventHandler + public void onWorldChange(PlayerChangedWorldEvent event) { + Player player = event.getPlayer(); + + if(player.getWorld().getName().equalsIgnoreCase("world")) { + main.getNpcManager().display(player); + player.setLevel(main.getDataManager().getLevel(player.getName())); + player.setHealth(20); + player.setGameMode(GameMode.SURVIVAL); + + if(main.getFreezeGamePlayers().contains(player)){ + main.getFreezeGamePlayers().remove(player); + } + + for(PotionEffect potionEffect : player.getActivePotionEffects()) + { + player.removePotionEffect(potionEffect.getType()); + } + + if(player.getName().equalsIgnoreCase("GravenYT")) { + player.setGameMode(GameMode.CREATIVE); + } + + if(!player.isOp()) { + player.setAllowFlight(false); + player.setFlying(false); + } + + } + else{ + + main.getHologramManager().registerHologram(player.getWorld()); + } + + player.getWorld().setGameRuleValue("announceAdvancements", "false"); + player.getInventory().clear(); + player.getWorld().setTime(0); + } + + @EventHandler + public void onDamage(EntityDamageEvent event) { + if(event.getEntity().getWorld().getName().equalsIgnoreCase("world")) { + event.setCancelled(true); + } + } + + @EventHandler + public void onLeafDecay(LeavesDecayEvent event){ + event.setCancelled(true); + } + + @EventHandler + public void onExplode(EntityExplodeEvent event) { + event.setCancelled(true); + } + + @EventHandler + public void onBlockDisable(BlockRedstoneEvent e) { + e.getBlock().setType(Material.AIR); + } + + @EventHandler + public void onPortal(PortalCreateEvent event) { + event.setCancelled(true); + } + + @EventHandler + public void onMonsterSpawn(CreatureSpawnEvent event) { + if(event.getSpawnReason() != CreatureSpawnEvent.SpawnReason.CUSTOM && + (event.getEntity().getType() != EntityType.PLAYER && event.getEntity().getType() != EntityType.ARMOR_STAND) + && (event.getEntity().getType() != EntityType.BOAT && event.getEntity().getType() != EntityType.WITHER) + && (event.getEntity().getType() != EntityType.ENDER_DRAGON)) + { + event.setCancelled(true); + } + } + +} \ No newline at end of file diff --git a/src/main/java/fr/gravencyg/manager/CYGCompilerManager.java b/src/main/java/fr/gravencyg/manager/CYGCompilerManager.java new file mode 100644 index 0000000..98d57c2 --- /dev/null +++ b/src/main/java/fr/gravencyg/manager/CYGCompilerManager.java @@ -0,0 +1,116 @@ +package fr.gravencyg.manager; + +import fr.gravencyg.CYG; +import fr.gravencyg.model.ActionProcess; +import fr.gravencyg.utils.CEvent; +import fr.gravencyg.utils.LocationUtils; +import org.bukkit.*; +import org.bukkit.block.Block; +import org.bukkit.block.BlockFace; +import org.bukkit.entity.Player; + +import java.util.*; + +public class CYGCompilerManager { + + private CYG main; + public CYGCompilerManager(CYG main) { this.main = main; } + + private List processedBlocks = new ArrayList<>(); + + public void runEventByBlock(Player player, String uuid, Block block) { + // for each event of the current uuid map + for(Map.Entry e : main.getDataManager().getStorageByUUID(uuid).getPlot(player.getWorld().getName()).getEvents().entrySet()){ + // found an event + if (e.getValue().equalsIgnoreCase(LocationUtils.fromLocToString(block.getLocation()))) + { + runEvent(player, uuid, e.getKey(), true, false, player.getLocation().clone().add(0, -1, 0).getBlock(), Material.LAPIS_BLOCK); + } + } + } + + public void runEvent(Player executor, String ownerPlotUUID, String eventName, boolean unitTestMode, boolean isAffectingAllPlayers, Block blk, Material material) { + + Block startingBlock = LocationUtils.fromStringToLoc(ownerPlotUUID, main.getDataManager() + .getStorageByUUID(ownerPlotUUID) + .getPlot(executor.getWorld().getName()) + .getEvents().get(eventName)) + .getBlock(); + + if (unitTestMode) { + broadcastEvent(ownerPlotUUID, ChatColor.GRAY + "Execution de l'evenement " + ChatColor.BLUE + eventName + "()"); + } + + List players = new ArrayList<>(); + + if (isAffectingAllPlayers) { + Bukkit.getOnlinePlayers().stream().filter(p -> p.getWorld().getName().contains(ownerPlotUUID)).forEach(players::add); + } else { + players.add(executor); + } + + List processusDirection = new ArrayList<>(); + + for (BlockFace bf : BlockFace.values()) { + if (bf.equals(BlockFace.EAST) || bf.equals(BlockFace.NORTH) || bf.equals(BlockFace.WEST) || bf.equals(BlockFace.SOUTH)) { + Block b = startingBlock.getRelative(bf.getOppositeFace()); + if(b.getType() != Material.AIR) processusDirection.add(bf); + } + } + + for(BlockFace uniqueBf : processusDirection) + { + List blocks = new ArrayList<>(); + blocks.add(startingBlock); + + for(int i = 0; i < 100; i++) + { + + Block lastBlock = blocks.get(blocks.size()-1); + Block b = lastBlock.getRelative(uniqueBf.getOppositeFace()); + + if(b.getType() != Material.AIR && b.getType() != Material.LAPIS_BLOCK && !blocks.contains(b)) + { + int iterations = 1; + + if(b.getType() == Material.LEGACY_WOOD_STEP) + iterations = 10; // 1 S + + if(b.getType() == Material.LEGACY_STEP) + iterations = 100; // 10 S + + if(b.getType() == Material.LEGACY_STONE) + iterations = 600; // 10 S + + for(int f = 0; f < iterations; f++) { + blocks.add(b); + } + + } + + } + + processedBlocks.add(new ActionProcess(players, blocks, blk, material)); + + } + + } + + + + public void broadcastEvent(String ownerPlotUUID, String message) { + for(Player player : Bukkit.getOnlinePlayers()) + { + if(player.getWorld().getName().equalsIgnoreCase(ownerPlotUUID)) + { + player.getWorld().playSound(player.getLocation(), Sound.BLOCK_NOTE_BLOCK_PLING, 9, 9); + player.sendMessage(ChatColor.RESET + "\n\n>>> " + message + ChatColor.RESET + " <<<\n\n"); + } + } + } + + public List getProcessedBlocks() { + return processedBlocks; + } + +} diff --git a/src/main/java/fr/gravencyg/manager/CYGDataManager.java b/src/main/java/fr/gravencyg/manager/CYGDataManager.java new file mode 100644 index 0000000..bd54235 --- /dev/null +++ b/src/main/java/fr/gravencyg/manager/CYGDataManager.java @@ -0,0 +1,435 @@ +package fr.gravencyg.manager; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import fr.gravencyg.CYG; +import fr.gravencyg.model.GameConfig; +import fr.gravencyg.model.Plot; +import fr.gravencyg.model.Storage; +import fr.gravencyg.utils.CLevel; +import fr.gravencyg.utils.CRank; +import fr.gravencyg.utils.LocationUtils; +import org.bukkit.Bukkit; +import org.bukkit.ChatColor; +import org.bukkit.Location; +import org.bukkit.block.Block; +import org.bukkit.entity.Player; + +import java.io.*; +import java.lang.reflect.Type; +import java.util.*; + +public class CYGDataManager { + + private CYG main; + + private Map storages; + + public CYGDataManager(CYG main) { + this.main = main; + this.storages = new HashMap<>(); + + loadStorage(); + } + + public void loadStorage() { + File folder = new File("plugins/CYG/storage/"); + File [] files = folder.listFiles(); + for (int i = 0; i < files.length; i++){ + if (files[i].isFile()){ //this line weeds out other directories/folders + Storage storageData = (Storage) loadJson(Storage.class, files[i]); + storages.put(storageData.getDisplayName(), storageData); + } + } + + System.out.println(storages.size() + " profiles chargés"); + } + + public Storage getStorageByUUID(String name) { + String fullName = name.split("#")[0]; + for(Map.Entry storage : storages.entrySet()) + { + if (storage.getValue().getUUID().equalsIgnoreCase(fullName)) + { + return storage.getValue(); + } + } + return new Storage(); + } + + public void createProfileIfNotExist(Player player) { + + System.out.println("Create new profile for " + player.getName() + " uuid: " + player.getUniqueId().toString()); + + // create folder if not exist + File folder = new File("plugins/CYG/storage/"); + if (!folder.exists()) folder.mkdir(); + + // check if file already exist + File file = new File("plugins/CYG/storage/" + player.getUniqueId().toString() + ".json"); + + if (!file.exists()){ + Storage storage = new Storage(player); + this.storages.put(player.getName(), storage); + this.save(player); + } + + Storage storage = getStorageByUUID(player.getUniqueId().toString()); + storage.setPseudo(player); + this.save(player); + + } + + private void saveJson(Object object, Type type, File out) { + + OutputStream outputStream = null; + Gson gson = new GsonBuilder().enableComplexMapKeySerialization().setPrettyPrinting() + .create(); + try { + outputStream = new FileOutputStream(out); + BufferedWriter bufferedWriter = new BufferedWriter(new OutputStreamWriter(outputStream, "UTF-8")); + + gson.toJson(object, type, bufferedWriter); + bufferedWriter.close(); + + } catch (FileNotFoundException e) { + e.printStackTrace(); + } catch (IOException e) { + e.printStackTrace(); + } finally { + if (outputStream != null) { + try { + outputStream.flush(); + outputStream.close(); + } catch (IOException e) { + } + } + } + + } + + + private Object loadJson(Type type, File file) { + Object jsonData = null; + + InputStream inputStream = null; + Gson gson = new GsonBuilder().enableComplexMapKeySerialization().setPrettyPrinting() + .create(); + try { + inputStream = new FileInputStream(file); + InputStreamReader streamReader; + streamReader = new InputStreamReader(inputStream, "UTF-8"); + + jsonData = gson.fromJson(streamReader, type); + streamReader.close(); + + } catch (FileNotFoundException e) { + e.printStackTrace(); + } catch (IOException e) { + e.printStackTrace(); + } finally { + if (inputStream != null) { + try { + inputStream.close(); + } catch (IOException e) { + } + } + } + return jsonData; + } + + public CRank getRank(Player player) { + CRank rank = CRank.JOUEUR; + + for(CRank r : CRank.values()) + { + if(r.name().toLowerCase().equalsIgnoreCase(storages.get(player.getName()).getRank())) + { + rank = r; + } + } + + return rank; + } + + public void addLocation(Player player, String name, Location location) { + Storage playerStorage = storages.get(player.getName()); + if(playerStorage.getPlot(player.getWorld().getName()) != null) { + + if(playerStorage.getPlot(player.getWorld().getName()).checkLocationExist(name)) { + player.sendMessage("\n\nZone §e"+name+"§r éxistante ! Tape /locations remove §e"+name+"§e\n\n"); + return; + } + + playerStorage.getPlot(player.getWorld().getName()).addLocation( + name, + LocationUtils.fromLocToStringComplete(location) + ); + } + save(player); + player.sendMessage("\n\nNouvelle zone §e[§r"+name+"§e] §aajoutée§r en " + LocationUtils.fromLocToString2(location)); + + } + + public void addMessage(Player player, String name, String messageContent) { + Storage playerStorage = storages.get(player.getName()); + if(playerStorage.getPlot(player.getWorld().getName()) != null) { + + if(playerStorage.getPlot(player.getWorld().getName()).checkMessages(name)) { + player.sendMessage("\n\nMessage §e"+name+"§r éxistant ! Tape /messages remove §e"+name+"§e\n\n"); + return; + } + + playerStorage.getPlot(player.getWorld().getName()).addMessage( + name, + messageContent + ); + } + save(player); + player.sendMessage("\n\nNouveau message §e[§r"+name+"§e] §aajoutée§r ! \n§r" + messageContent.replace("&","§")); + + } + + + public void addLocationSet(Player player, Location location, String locName) { + Storage playerStorage = storages.get(player.getName()); + if(playerStorage.getPlot(player.getWorld().getName()) != null) { + playerStorage.getPlot(player.getWorld().getName()).addLocationSet(LocationUtils.fromLocToString(location), locName); + } + save(player); + } + + public void addLocationSet(String ownerUUID, Location location, String locName) { + Storage playerStorage = getStorageByUUID(ownerUUID); + if(playerStorage.getPlot(location.getWorld().getName()) != null) { + playerStorage.getPlot(location.getWorld().getName()).addLocationSet(LocationUtils.fromLocToString(location), locName); + } + save(playerStorage.getDisplayName(), ownerUUID); + + } + + public void addMessageSet(Player player, Location location, String message) { + Storage playerStorage = storages.get(player.getName()); + if(playerStorage.getPlot(player.getWorld().getName()) != null) { + playerStorage.getPlot(player.getWorld().getName()).addMessageSet(LocationUtils.fromLocToString(location), message); + } + save(player); + + } + + public void addMessageSet(String string, Location location, String message) { + Storage playerStorage = getStorageByUUID(string); + if(playerStorage.getPlot(location.getWorld().getName()) != null) { + playerStorage.getPlot(location.getWorld().getName()).addMessageSet(LocationUtils.fromLocToString(location), message); + } + save(playerStorage.getDisplayName(), string); + + } + + public void removeLocation(Player player, String locationName) { + Storage playerStorage = storages.get(player.getName()); + if(playerStorage.getPlot(player.getWorld().getName()) != null) { + + if(!playerStorage.getPlot(player.getWorld().getName()).checkLocationExist(locationName)) { + player.sendMessage("\n\nZone §e"+locationName+"§r inéxistante"); + return; + } + + playerStorage.getPlot(player.getWorld().getName()).removeLocation(locationName); + } + save(player); + player.sendMessage("\n\nSuppression de la zone §c[§r"+locationName+"§c] !"); + + } + + public void removeMessage(Player player, String messageName) { + Storage playerStorage = storages.get(player.getName()); + if(playerStorage.getPlot(player.getWorld().getName()) != null) { + + if(!playerStorage.getPlot(player.getWorld().getName()).checkMessages(messageName)) { + player.sendMessage("\n\nMessage §e"+messageName+"§r inéxistant"); + return; + } + + playerStorage.getPlot(player.getWorld().getName()).removeMessage(messageName); + } + save(player); + player.sendMessage("\n\nSuppression du message §c[§r"+messageName+"§c] !"); + + } + + public void removeAllLocations(Player player) { + Storage playerStorage = storages.get(player.getName()); + + if(playerStorage.getPlot(player.getWorld().getName()) != null) { + playerStorage.getPlot(player.getWorld().getName()).getLocationsSet().clear(); + playerStorage.getPlot(player.getWorld().getName()).getLocations().clear(); + } + save(player); + player.sendMessage("\n\n§9Toutes les locations ont été supprimées !"); + + } + + public void removeAllMessages(Player player) { + Storage playerStorage = storages.get(player.getName()); + + if(playerStorage.getPlot(player.getWorld().getName()) != null) { + playerStorage.getPlot(player.getWorld().getName()).getMessageSet().clear(); + playerStorage.getPlot(player.getWorld().getName()).getMessages().clear(); + } + save(player); + player.sendMessage("\n\n§9Tout les messages ont été supprimés !"); + + } + + public void updateEvent(Player player, String key, String value) { + getStorageByUUID(player.getWorld().getName()).getPlot(player.getWorld().getName()).updateEvent(key, value); + save(player); + } + + public void removeEvent(Player player, Block block) { + List eventToRemove = new ArrayList<>(); + + for (Map.Entry event : storages.get(player.getName()).getPlot(player.getWorld().getName()).getEvents().entrySet()) { + if (event.getValue().equalsIgnoreCase(LocationUtils.fromLocToString(block.getLocation()))) + { + player.sendMessage(ChatColor.GRAY+"Evenement " + ChatColor.BLUE+ event.getKey() + "()" + ChatColor.BLUE +" supprimé§r du bloc en " +LocationUtils.fromLocToString(block.getLocation())); + eventToRemove.add(event.getKey()); + + main.getHologramManager().removeHologram(block); + storages.get(player.getName()).getPlot(player.getWorld().getName()).removeEvent(event.getKey()); + } + } + + eventToRemove.forEach(storages.get(player.getName()).getPlot(player.getWorld().getName()).getEvents()::remove); + } + + public void removeEvent(Player player, String uuid, Block block) { + List eventToRemove = new ArrayList<>(); + + for (Map.Entry event : getStorageByUUID(uuid).getPlot(player.getWorld().getName()).getEvents().entrySet()) { + if (event.getValue().equalsIgnoreCase(LocationUtils.fromLocToString(block.getLocation()))) + { + player.sendMessage(ChatColor.GRAY+"Evenement " + ChatColor.BLUE+ event.getKey() + "()" + ChatColor.BLUE +" supprimé§r du bloc en " +LocationUtils.fromLocToString(block.getLocation())); + eventToRemove.add(event.getKey()); + + main.getHologramManager().removeHologram(block); + getStorageByUUID(uuid).getPlot(player.getWorld().getName()).removeEvent(event.getKey()); + } + } + + eventToRemove.forEach(storages.get(player.getName()).getPlot(player.getWorld().getName()).getEvents()::remove); + } + + public void save(Player player) { + File file = new File("plugins/CYG/storage/" + player.getUniqueId().toString() + ".json"); + saveJson(storages.get(player.getName()), Storage.class, file); + } + + + public void save(String name, String uuid) { + File file = new File("plugins/CYG/storage/" + uuid + ".json"); + saveJson(storages.get(name), Storage.class, file); + } + + + public Map getStorages() { + return storages; + } + + public Plot getPlotFromWorldLocationOf(Player player) { + Plot plot = new Plot(player); + + for (Map.Entry storage : storages.entrySet()) { + if(player.getWorld().getName().contains(storage.getValue().getUUID())) + { + return storage.getValue().getPlot(player.getWorld().getName()); + } + } + + return plot; + } + + public int getLevel(String name) { + return getStorages().get(name).getLevel(); + } + + public int getTrophys(String name) { + return getStorages().get(name).getTrophys(); + } + + public GameConfig getConfig(String name) { return getStorages().get(name).getConfig(name); } + + + public void setSpawn(Player player) { + storages.get(player.getName()).getPlot(player.getWorld().getName()).setSpawn(LocationUtils.fromLocToStringComplete(player.getLocation())); + save(player); + } + + public void setGameName(Player player, String gameName) { + storages.get(player.getName()).getPlot(player.getWorld().getName()).getConfig().setName(gameName); + save(player); + } + + public void setCode(Player player) { + storages.get(player.getName()).getPlot(player.getWorld().getName()).setCode(LocationUtils.fromLocToStringComplete(player.getLocation())); + save(player); + } + + public void addTrophy(Player player, int amount) { + Storage storage = storages.get(player.getName()); + storage.addTrophy(amount); + save(player); + refreshLevel(player.getName()); + } + + public void setLevel(String pseudo, String newLevel) { + int newLevelI = Integer.parseInt(newLevel); + int trophys = CLevel.values()[newLevelI-1].getTrophy(); + + Storage storage = storages.get(pseudo); + storage.setTrophy(trophys); + + refreshLevel(pseudo); + } + + public int getBorderSize(Player player) { + return CLevel.findLevelByTrophy(getTrophys(player.getName())).getPlotSize().getBorderSize(); + } + + public int getMaxPlotPerPlayer(Player player) { + CRank rank = getRank(player); + int level = getLevel(player.getName()); + int maxPlots = 1; + + System.out.println(level); + if(level >= 10) maxPlots = 2; + if(rank == CRank.PREMIUM || rank.isMod()) maxPlots = 3; + + return maxPlots; + } + + public void refreshLevel(String pseudo) { + Storage storage = storages.get(pseudo); + int trophys = storage.getTrophys(); + CLevel lvl = CLevel.findLevelByTrophy(trophys); + + storage.setLevel(lvl.getRealLevel()); + save(pseudo, main.getDataManager().getStorages().get(pseudo).getUUID()); + + if(Bukkit.getPlayer(pseudo) != null) { + Player player = Bukkit.getPlayer(pseudo); + main.getScoreboardManager().updatePlayerLevel(player); + main.getScoreboardManager().updatePlayerTrophy(player); + } + } + + public Location getSpawn(Player player) { return storages.get(player.getName()).getPlot(player.getWorld().getName()).getSpawn(player.getUniqueId().toString()); } + + public Location getSpawn(String name, String uuid) { return storages.get(name).getPlot(uuid).getSpawn(uuid); } + + public Location getCode(Player player) { return storages.get(player.getName()).getPlot(player.getWorld().getName()).getCode(player.getUniqueId().toString()); } + + + +} diff --git a/src/main/java/fr/gravencyg/manager/CYGHologramManager.java b/src/main/java/fr/gravencyg/manager/CYGHologramManager.java new file mode 100644 index 0000000..e0f3dc0 --- /dev/null +++ b/src/main/java/fr/gravencyg/manager/CYGHologramManager.java @@ -0,0 +1,101 @@ +package fr.gravencyg.manager; + +import fr.gravencyg.CYG; +import fr.gravencyg.model.Storage; +import fr.gravencyg.utils.LocationUtils; +import org.bukkit.*; +import org.bukkit.block.Block; +import org.bukkit.entity.ArmorStand; +import org.bukkit.entity.EntityType; + +import java.util.HashMap; +import java.util.Map; + +public class CYGHologramManager { + + private CYG main; + + public CYGHologramManager(CYG main) { this.main = main; } + + private Map holograms = new HashMap<>(); + + public void registerHologram(World world) { + + Storage targetStorage = main.getDataManager().getStorageByUUID(world.getName()); + + if(targetStorage != null && targetStorage.getPlot(world.getName()) != null) + { + for (Map.Entry e: targetStorage.getPlot(world.getName()).getEvents().entrySet()) { + Location loc = LocationUtils.fromStringToLoc(world.getName(), e.getValue()); + if(!holograms.containsKey(loc)) { + loc.getBlock().setType(Material.LAPIS_BLOCK); + registerEventHologram(loc, e.getKey()); + } + + } + } + } + + public ArmorStand registerHologram(Location loc, String text) { + + Location location = new Location(loc.getWorld(), loc.getX(), loc.getY() + 0.3, loc.getZ(), loc.getYaw(), loc.getPitch()); + ArmorStand stand = (ArmorStand) loc.getWorld().spawnEntity(location, EntityType.ARMOR_STAND); + + stand.setCustomName(text); + stand.setCustomNameVisible(true); + stand.setSmall(false); + stand.setGravity(false); + stand.setVisible(false); + + // register hologram + holograms.put(loc, stand); + return stand; + } + + public ArmorStand registerBoxCollider(Location loc, String text) { + + Location location = new Location(loc.getWorld(), loc.getX(), loc.getY() + 0.1, loc.getZ(), loc.getYaw(), loc.getPitch()); + ArmorStand stand = (ArmorStand) loc.getWorld().spawnEntity(location, EntityType.ARMOR_STAND); + + stand.setCustomName(text); + stand.setCustomNameVisible(false); + stand.setSmall(false); + stand.setGravity(false); + stand.setVisible(false); + + // register hologram + holograms.put(loc, stand); + return stand; + } + + public ArmorStand registerEventHologram(Location loc, String eventName) { + + Location location = new Location(loc.getWorld(), loc.getX() + 0.5, loc.getY() + 1, loc.getZ() + 0.5, loc.getYaw(), loc.getPitch()); + ArmorStand stand = (ArmorStand) loc.getWorld().spawnEntity(location, EntityType.ARMOR_STAND); + + stand.setCustomName(ChatColor.BLUE + eventName + "()"); + stand.setCustomNameVisible(true); + stand.setSmall(true); + stand.setGravity(false); + stand.setVisible(false); + + // register hologram + holograms.put(loc, stand); + return stand; + } + + public void removeHologram(Block block) { + if (holograms.containsKey(block.getLocation())) { + ArmorStand stand = holograms.get(block.getLocation()); + stand.remove(); + } + } + + public void removeAllHolograms() { + for(Map.Entry stands : holograms.entrySet()) { + removeHologram(stands.getKey().getBlock()); + } + } + + +} diff --git a/src/main/java/fr/gravencyg/manager/CYGPlotManager.java b/src/main/java/fr/gravencyg/manager/CYGPlotManager.java new file mode 100644 index 0000000..c4b5c02 --- /dev/null +++ b/src/main/java/fr/gravencyg/manager/CYGPlotManager.java @@ -0,0 +1,113 @@ +package fr.gravencyg.manager; + +import fr.gravencyg.CYG; +import fr.gravencyg.model.Plot; +import fr.gravencyg.model.Storage; +import fr.gravencyg.utils.CLevel; +import fr.gravencyg.utils.CRank; +import org.bukkit.*; +import org.bukkit.entity.Player; + +import java.util.List; +import java.util.Map; + +public class CYGPlotManager { + + private CYG main; + private CYGDataManager dataManager; + + public CYGPlotManager(CYG main){ + this.main = main; + this.dataManager = main.getDataManager(); + } + + public void createPlot(Player player, int index) { + List playerPlot = getPlotsByPlayer(player); + int maxPlotPerPlayer = 3; + + if(playerPlot.size() < maxPlotPerPlayer) { + getStorageByPlayer(player).createPlot(player); + + player.sendMessage(ChatColor.GOLD + "Création d'une parcelle..."); + createWorld(player, index); + + dataManager.save(player); + } + else{ + player.sendMessage(ChatColor.GOLD + "Vous ne pouvez pas créer plus de §e" + maxPlotPerPlayer + "§r parcelles.."); + + } + } + + public void createWorld(Player player, int index){ + WorldCreator worldCreator = new WorldCreator(player.getUniqueId().toString() + "_" + index); + worldCreator.type(WorldType.FLAT); + worldCreator.generateStructures(false); + + World playerWorld = Bukkit.createWorld(worldCreator); + WorldBorder worldBorder = playerWorld.getWorldBorder(); + int borderSize = main.getDataManager().getBorderSize(player); + + if (borderSize != worldBorder.getSize() && !player.isOp()) { + worldBorder.setCenter(new Location(playerWorld, 0, 0, 0)); + worldBorder.setSize(borderSize); + } + + teleportPlayer(player, player.getUniqueId().toString(), index); + } + + public boolean isPlotExist(String ownerUUID, int index){ + return getStorageByUUID(ownerUUID).getPlots().size() != index; + } + + public void teleportPlayer(Player player, String ownerPlotUUId, int index) { + player.sendMessage("§eTéléportation vers le plot n°" + (index+1)); + + WorldCreator worldCreator = new WorldCreator(player.getUniqueId().toString() + "_" + index); + World playerWorld = Bukkit.createWorld(worldCreator); + worldCreator.type(WorldType.FLAT); + worldCreator.generateStructures(false); + + Bukkit.getScheduler().runTaskLater(main, () -> { + player.teleport(new Location(playerWorld, 0, 20, 0)); + player.setGameMode(GameMode.CREATIVE); + + // apply worldborder + WorldBorder worldBorder = player.getWorld().getWorldBorder(); + int borderSize = main.getDataManager().getBorderSize(player); + + if (borderSize != worldBorder.getSize()) { + worldBorder.setCenter(new Location(player.getWorld(), 0, 0, 0)); + worldBorder.setSize(borderSize); + } + + }, 100); + } + + public Storage getStorageByUUID(String name) { + for(Map.Entry storage : dataManager.getStorages().entrySet()) + { + if (name.contains(storage.getValue().getUUID())) + { + return storage.getValue(); + } + } + return new Storage(); + } + + public Storage getStorageByPlayer(Player player){ + return dataManager.getStorages().get(player.getName()); + } + + public List getPlotsByPlayer(Player player){ + return getStorageByPlayer(player).getPlots(); + } + + public String getGameNameFromPlot(Player player, int i) { + if(getStorageByUUID(player.getUniqueId().toString()).getPlots().size() -1 >= i) + { + return getStorageByUUID(player.getUniqueId().toString()).getPlots().get(i).getName(); + } + return "§7Aucun jeu pour le moment"; + } +} diff --git a/src/main/java/fr/gravencyg/manager/CYGWorleditManager.java b/src/main/java/fr/gravencyg/manager/CYGWorleditManager.java new file mode 100644 index 0000000..c8610c2 --- /dev/null +++ b/src/main/java/fr/gravencyg/manager/CYGWorleditManager.java @@ -0,0 +1,164 @@ +package fr.gravencyg.manager; + +import fr.gravencyg.CYG; +import fr.gravencyg.items.ItemBuilder; +import fr.gravencyg.model.MaterialAndData; +import fr.gravencyg.utils.LocationUtils; +import org.bukkit.*; +import org.bukkit.entity.Player; + +import java.util.*; + +public class CYGWorleditManager { + + private CYG main; + + private Map points = new HashMap<>(); + private Map> lastAction = new HashMap<>(); + + private HashMap materials = new HashMap<>(); + + public CYGWorleditManager(CYG main) + { + this.main = main; + + for(Material material : Material.values()) + { + materials.put(material.name().toLowerCase(), material); + } + } + + public void give(Player player) + { + player.playSound(player.getLocation(), Sound.BLOCK_ANVIL_USE, 3, 3); + player.getInventory().addItem(new ItemBuilder(Material.GOLDEN_HOE, 1) + .setName("§eMini Worledit") + .addLoreLine("§7Clic droit/Clic Gauche") + .addLoreLine("-> ").toItemStack()); + } + + public void setPoint(Player player, Location point) + { + if(!points.containsKey(player)) + { + points.put(player, new Location[]{ point, point}); + point.getBlock().setType(Material.GLASS); + player.sendMessage("§7[§eMiniWE§7]§r " + LocationUtils.fromLocToString2(point) + " est le 1er point !"); + return; + } + + Location[] locations = points.get(player); + locations[1] = point; + point.getBlock().setType(Material.GLASS); + + player.sendMessage("§7[§eMiniWE§7]§r " + LocationUtils.fromLocToString2(point) + " est le 2eme point !"); + + } + public void set(Player player, String name) { + set(player, name, 0); + } + + public void set(Player player, String name, int id) { + + if(!points.containsKey(player)) + { + player.sendMessage("§7[§eMiniWE§7]§r Aucun point n'a été placé ! "); + return; + } + + if(!materials.containsKey(name)) + { + player.sendMessage("§7[§eMiniWE§7]§r Le materiel "+name.toUpperCase()+" n'existe pas ! "); + return; + } + + Location[] locs = points.get(player); + Location corner1 = locs[0]; + Location corner2 = locs[1]; + Map blocks = getBlocks(corner1, corner2); + + if(blocks.size() > 15000) + { + player.sendMessage("§7[§eMiniWE§7]§r Attention la limite est de 15000 blocs ! (§c15000<"+blocks.size()+"§r)"); + return; + } + + for(Map.Entry b : blocks.entrySet()) { + b.getKey().getBlock().setType(materials.get(name.toLowerCase())); + //b.getKey().getBlock().setData((byte) id); + } + + player.playSound(player.getLocation(), Sound.BLOCK_ANVIL_USE, 2, 8); + player.sendMessage("§7[§eMiniWE§7]§r Et voila ! Pas content ? /we undo "); + + + points.remove(player); + + lastAction.put(player, blocks); + + } + + public void undo(Player player) { + + if(!lastAction.containsKey(player)) + { + player.sendMessage("§7[§eMiniWE§7]§r Il n'y aucune dernière action ! "); + return; + } + + for(Map.Entry b: lastAction.get(player).entrySet()) + { + b.getKey().getBlock().setType(b.getValue().getMaterial()); + //b.getKey().getBlock().setData(b.getValue().getData()); + } + + player.sendMessage("§7[§eMiniWE§7]§r On reviens au départ "); + player.playSound(player.getLocation(), Sound.ENTITY_ENDERMAN_TELEPORT, 2, 8); + + lastAction.remove(player); + + } + + public void unset(Player player) { + + if(!points.containsKey(player)) + { + player.sendMessage("§7[§eMiniWE§7]§r Il n'y aucune selection ! "); + return; + } + + player.sendMessage("§7[§eMiniWE§7]§r Suppression de la selection "); + player.playSound(player.getLocation(), Sound.ENTITY_ENDERMAN_TELEPORT, 2, 8); + + Location[] loc = points.get(player); + loc[0].getBlock().breakNaturally(); + loc[1].getBlock().breakNaturally(); + + points.clear(); + } + + public Map getBlocks(Location corner1, Location corner2){ + Map yourBlocks = new HashMap<>(); + + int topBlockX = Math.max(corner1.getBlockX(), corner2.getBlockX()); + int topBlockY = Math.max(corner1.getBlockY(), corner2.getBlockY()); + int topBlockZ = Math.max(corner1.getBlockZ(), corner2.getBlockZ()); + int bottomBlockX = Math.min(corner1.getBlockX(), corner2.getBlockX()); + int bottomBlockY = Math.min(corner1.getBlockY(), corner2.getBlockY()); + int bottomBlockZ = Math.min(corner1.getBlockZ(), corner2.getBlockZ()); + for (int x = bottomBlockX; x <= topBlockX; x++) { + for (int y = bottomBlockY; y <= topBlockY; y++) { + for (int z = bottomBlockZ; z <= topBlockZ; z++) { + Location loc = new Location(corner1.getWorld(), x, y, z); + yourBlocks.put(loc, new MaterialAndData(loc.getBlock().getType(), loc.getBlock().getData())); + } + } + } + + return yourBlocks; + } + + + + +} diff --git a/src/main/java/fr/gravencyg/menus/CustomMenuManager.java b/src/main/java/fr/gravencyg/menus/CustomMenuManager.java new file mode 100644 index 0000000..1d4760b --- /dev/null +++ b/src/main/java/fr/gravencyg/menus/CustomMenuManager.java @@ -0,0 +1,101 @@ +package fr.gravencyg.menus; + +import fr.gravencyg.CYG; +import fr.gravencyg.menus.all.*; +import fr.gravencyg.menus.core.CustomMenu; +import fr.gravencyg.menus.locations.LocationMenu; +import fr.gravencyg.menus.locations.LocationSelectMenu; +import fr.gravencyg.menus.messages.MessageMenu; +import fr.gravencyg.menus.messages.MessageSelectMenu; +import fr.gravencyg.menus.options.*; +import fr.gravencyg.menus.plot.PlayPlayerMenu; +import fr.gravencyg.menus.plot.PlotManageMenu; +import fr.gravencyg.menus.plot.PlotMenu; +import fr.gravencyg.menus.variables.VariableMenu; +import fr.gravencyg.menus.variables.VariableSelectMenu; +import org.bukkit.Bukkit; +import org.bukkit.entity.Player; +import org.bukkit.inventory.Inventory; + +import java.util.HashMap; +import java.util.Map; + +public class CustomMenuManager { + + public Map, CustomMenu> registeredMenus = new HashMap<>(); + + private Map inventoryPageSystem = new HashMap<>(); + + public CustomMenuManager(CYG main) { + // registerer Inventories + addMenu(new ActionMenu(main)); + addMenu(new EventMenu(main)); + addMenu(new LocationSelectMenu(main)); + addMenu(new LocationMenu(main)); + addMenu(new MessageMenu(main)); + addMenu(new PlayMenu(main)); + addMenu(new MessageSelectMenu(main)); + addMenu(new UpgradeMenu(main)); + + addMenu(new OptionMenu(main)); + addMenu(new OptionAutostartMenu(main)); + addMenu(new OptionStartingTimeMenu(main)); + addMenu(new OptionWhitelistMenu(main)); + addMenu(new OptionMaxPlayersMenu(main)); + addMenu(new OptionLifeMenu(main)); + + addMenu(new GameModeMenu(main)); + addMenu(new VariableMenu(main)); + addMenu(new VariableSelectMenu(main)); + addMenu(new PlotMenu(main)); + addMenu(new PlotManageMenu(main)); + addMenu(new PlotMenu(main)); + addMenu(new PlayPlayerMenu(main)); + + } + + public void addMenu(CustomMenu m){ + this.registeredMenus.put(m.getClass(), m); + } + + public void open(Player player, Class gClass){ + + if(!this.registeredMenus.containsKey(gClass)) return; + + if(!inventoryPageSystem.containsKey(player)) { + inventoryPageSystem.put(player, 0); + } + + CustomMenu menu = this.registeredMenus.get(gClass); + Inventory inv = Bukkit.createInventory(null, menu.getSize(), menu.name()); + menu.contents(player, inv); + player.openInventory(inv); + + } + + public void nextPage(Player player){ + if(inventoryPageSystem.containsKey(player)) { + inventoryPageSystem.put(player, inventoryPageSystem.get(player) + 1); + } + } + + public void previousPage(Player player){ + if(inventoryPageSystem.containsKey(player)) { + inventoryPageSystem.put(player, inventoryPageSystem.get(player) - 1); + } + } + + public int getCurrentPage(Player player){ + if(inventoryPageSystem.containsKey(player)) { + return inventoryPageSystem.get(player); + } + return 0; + } + + public void backToStart(Player player) { + if(inventoryPageSystem.containsKey(player)) { + inventoryPageSystem.remove(player); + } + } + +} diff --git a/src/main/java/fr/gravencyg/menus/all/ActionMenu.java b/src/main/java/fr/gravencyg/menus/all/ActionMenu.java new file mode 100644 index 0000000..6623a1e --- /dev/null +++ b/src/main/java/fr/gravencyg/menus/all/ActionMenu.java @@ -0,0 +1,92 @@ +package fr.gravencyg.menus.all; + +import fr.gravencyg.CYG; +import fr.gravencyg.actions.Action; +import fr.gravencyg.items.ItemBuilder; +import fr.gravencyg.menus.core.CustomMenu; +import org.bukkit.ChatColor; +import org.bukkit.Material; +import org.bukkit.Sound; +import org.bukkit.entity.Player; +import org.bukkit.inventory.Inventory; +import org.bukkit.inventory.ItemStack; + +import java.util.Map; + +public class ActionMenu implements CustomMenu { + + private CYG main; + + public ActionMenu(CYG main) { + this.main = main; + } + + @Override + public String name() { + return "Actions Menu"; + } + + @Override + public void contents(Player player, Inventory inv) { + + inv.setItem(0, new ItemBuilder(Material.LAPIS_BLOCK).setName(ChatColor.BLUE+"onEvent()") + .addLoreLine("§7Declenche un évenement durant le jeu").toItemStack()); + + int count = 1; + + for(Map.Entry action : main.getActionBlocks().getActions().entrySet()) { + + Material material = action.getKey(); + + if(material == Material.BREWING_STAND) material = Material.BREWING_STAND; + + if(action.getValue().getRequireLevel().getRealLevel() > main.getDataManager().getLevel(player.getName())) + { + inv.setItem(action.getValue().getSlot(), new ItemBuilder(Material.COAL_BLOCK) + .setName("§c" + action.getValue().title()) + .addLoreLine(action.getValue().lore()) + .addLoreLine("§cVous devez être §nniveau "+action.getValue().getRequireLevel().getRealLevel()+"§r§c !") + .toItemStack()); + } + else { + + inv.setItem(action.getValue().getSlot(), new ItemBuilder(material) + .setName(action.getValue().title()) + .addLoreLine(action.getValue().lore()) + .toItemStack()); + } + + count += 1; + } + + } + + @Override + public void onClick(Player player, Inventory inv, ItemStack current, int slot) { + if (current != null && current.getType() != Material.AIR) + { + + if(current.getType() == Material.COAL_BLOCK) + { + player.playSound(player.getLocation(), Sound.ENTITY_VILLAGER_NO, 3, 8); + return; + } + + if(current.getType() == Material.WHITE_WOOL) + { + player.getInventory().addItem(new ItemBuilder(Material.BLUE_WOOL, 1, (byte)11).setName("§9Equipe Bleu").toItemStack()); + player.getInventory().addItem(new ItemBuilder(Material.RED_WOOL, 1, (byte)14).setName("§cEquipe Rouge").toItemStack()); + return; + } + + if(current.hasItemMeta() && current.getItemMeta().hasLore()) { + + player.getInventory().addItem(new ItemBuilder(current.getType(), 1) + .setName(current.getItemMeta().getDisplayName()).toItemStack()); + } + } + } + + @Override + public int getSize() { return 54; } +} diff --git a/src/main/java/fr/gravencyg/menus/all/EventMenu.java b/src/main/java/fr/gravencyg/menus/all/EventMenu.java new file mode 100644 index 0000000..2edcfc2 --- /dev/null +++ b/src/main/java/fr/gravencyg/menus/all/EventMenu.java @@ -0,0 +1,155 @@ +package fr.gravencyg.menus.all; + +import fr.gravencyg.CYG; +import fr.gravencyg.items.ItemBuilder; +import fr.gravencyg.manager.CYGHologramManager; +import fr.gravencyg.menus.core.CustomMenu; +import fr.gravencyg.model.Plot; +import fr.gravencyg.model.Storage; +import fr.gravencyg.utils.CEvent; +import fr.gravencyg.utils.LocationUtils; +import org.bukkit.Bukkit; +import org.bukkit.ChatColor; +import org.bukkit.Location; +import org.bukkit.Material; +import org.bukkit.block.Block; +import org.bukkit.enchantments.Enchantment; +import org.bukkit.entity.Player; +import org.bukkit.inventory.Inventory; +import org.bukkit.inventory.ItemStack; + +import java.util.Map; + +public class EventMenu implements CustomMenu { + + private CYG main; + + public EventMenu(CYG main) { + this.main = main; + } + + @Override + public String name() { + return "Choisir un évenement"; + } + + @Override + public void contents(Player player, Inventory inv) { + + int i = 0; + + for(CEvent event : CEvent.values()) { + + boolean applyMetaSkull = false; + boolean applyEnchant = false; + + // get selected event name to apply enchantment + if(main.getEventBlockCache().containsKey(player)) { + Plot plot = main.getDataManager().getStorageByUUID(player.getWorld().getName()).getPlot(player.getWorld().getName()); + if(plot.getEvents().containsKey(event.getEventName())) + { + Block selectedBlockInCache = main.getEventBlockCache().get(player); + + if(plot.getEvents().get(event.getEventName()).equals(LocationUtils.fromLocToString(selectedBlockInCache.getLocation()))){ + applyEnchant = true; + } + } + + } + + if(i == 0) applyMetaSkull = true; + + inv.setItem(i, getEventBlock(event.getMaterial(), event.getEventName(), event.getDescription(), applyEnchant, applyMetaSkull)); + + i += 1; + } + + inv.setItem(26, new ItemBuilder(Material.COMPASS) + .setName(ChatColor.BLUE + "Démarrer le code") + .addLoreLine(ChatColor.GRAY + "Cliquez ici pour tester votre code").toItemStack()); + + + } + + public ItemStack getEventBlock(Material material, String eventName, String description, boolean applyEnchant, boolean applyMetaSkull) { + + byte data = 0; + + if(applyMetaSkull) data = 3; + + ItemBuilder itemBuilder = new ItemBuilder(material, 1, data) + .setName(ChatColor.BLUE + eventName + "()") + .addLoreLine(ChatColor.GRAY + description); + + if(applyEnchant) + itemBuilder.addEnchant(Enchantment.DURABILITY, 10); + + return itemBuilder.toItemStack(); + } + + @Override + public void onClick(Player player, Inventory inv, ItemStack current, int slot) { + if (current != null && main.getEventBlockCache().containsKey(player)) + { + Block selectedBlockInCache = main.getEventBlockCache().get(player); + + if(current.getType() == null) return; + + if(slot < CEvent.values().length) { + + player.closeInventory(); + + CEvent event = CEvent.values()[slot]; + Storage storage = main.getDataManager().getStorageByUUID(player.getWorld().getName()); + Plot plot = storage.getPlot(player.getWorld().getName()); + + // event already exist + if(plot.getEvents().containsValue(LocationUtils.fromLocToString(selectedBlockInCache.getLocation()))); + { + for(Map.Entry e: plot.getEvents().entrySet()) + { + if(e.getValue().equals(LocationUtils.fromLocToString(selectedBlockInCache.getLocation()))) + { + main.getDataManager().removeEvent(player, player.getWorld().getName(), selectedBlockInCache); + } + } + } + + // event already exist + if(plot.getEvents().containsKey(event.getEventName())) + { + String eve = plot.getEvents().get(event.getEventName()); + Block block = LocationUtils.fromStringToLoc(storage.getUUID(), eve).getBlock(); + main.getDataManager().removeEvent(player, block); + main.getDataManager().save(player); + + CYGHologramManager hologramManager = main.getHologramManager(); + hologramManager.removeHologram(block); + } + + player.sendMessage(ChatColor.GRAY + "Evenement " + ChatColor.BLUE + event.getEventName() + ChatColor.GRAY + " placé !"); + updateEvent(player, event.getEventName(), selectedBlockInCache.getLocation()); + + } + + if(current.getType() == Material.COMPASS) + { + player.closeInventory(); + + main.getCompilerManager().runEventByBlock(player, player.getWorld().getName(), selectedBlockInCache); + } + + } + } + + private void updateEvent(Player player, String event, Location blockLocation) { + main.getDataManager().updateEvent(player, event, LocationUtils.fromLocToString(blockLocation)); + + CYGHologramManager hologramManager = main.getHologramManager(); + hologramManager.removeHologram(blockLocation.getBlock()); + hologramManager.registerEventHologram(blockLocation, event); + } + + @Override + public int getSize() { return 27; } +} diff --git a/src/main/java/fr/gravencyg/menus/all/GameModeMenu.java b/src/main/java/fr/gravencyg/menus/all/GameModeMenu.java new file mode 100644 index 0000000..1d0b19b --- /dev/null +++ b/src/main/java/fr/gravencyg/menus/all/GameModeMenu.java @@ -0,0 +1,58 @@ +package fr.gravencyg.menus.all; + +import fr.gravencyg.CYG; +import fr.gravencyg.actions.Action; +import fr.gravencyg.items.ItemBuilder; +import fr.gravencyg.menus.core.CustomMenu; +import org.bukkit.ChatColor; +import org.bukkit.GameMode; +import org.bukkit.Material; +import org.bukkit.Sound; +import org.bukkit.entity.Player; +import org.bukkit.inventory.Inventory; +import org.bukkit.inventory.ItemStack; + +import java.util.Map; + +public class GameModeMenu implements CustomMenu { + + private CYG main; + + public GameModeMenu(CYG main) { + this.main = main; + } + + @Override + public String name() { + return "GameMode Menu"; + } + + @Override + public void contents(Player player, Inventory inv) { + inv.setItem(1, new ItemBuilder(Material.GRASS, 1).setName("§aSurvie").toItemStack()); + inv.setItem(3, new ItemBuilder(Material.DIRT, 1).setName("§aAventure").toItemStack()); + inv.setItem(5, new ItemBuilder(Material.GOLD_BLOCK, 1).setName("§aCréatif").toItemStack()); + inv.setItem(7, new ItemBuilder(Material.DIAMOND_BLOCK, 1).setName("§aSpectateur").toItemStack()); + } + + @Override + public void onClick(Player player, Inventory inv, ItemStack current, int slot) { + if (current != null && current.getType() != Material.AIR) + { + player.closeInventory(); + player.playSound(player.getLocation(), Sound.AMBIENT_CAVE, 7, 6); + switch (current.getType()) + { + case GRASS: player.setGameMode(GameMode.SURVIVAL); break; + case DIRT: player.setGameMode(GameMode.ADVENTURE); break; + case GOLD_BLOCK: player.setGameMode(GameMode.CREATIVE); break; + case DIAMOND_BLOCK: player.setGameMode(GameMode.SPECTATOR); break; + + default: break; + } + } + } + + @Override + public int getSize() { return 9; } +} diff --git a/src/main/java/fr/gravencyg/menus/all/PlayMenu.java b/src/main/java/fr/gravencyg/menus/all/PlayMenu.java new file mode 100644 index 0000000..24a6cf6 --- /dev/null +++ b/src/main/java/fr/gravencyg/menus/all/PlayMenu.java @@ -0,0 +1,69 @@ +package fr.gravencyg.menus.all; + +import fr.gravencyg.CYG; +import fr.gravencyg.actions.Action; +import fr.gravencyg.items.ItemBuilder; +import fr.gravencyg.menus.core.CustomMenu; +import fr.gravencyg.model.Plot; +import fr.gravencyg.model.Storage; +import fr.gravencyg.model.VerifyGameConfig; +import org.bukkit.ChatColor; +import org.bukkit.Material; +import org.bukkit.Sound; +import org.bukkit.entity.Player; +import org.bukkit.inventory.Inventory; +import org.bukkit.inventory.ItemStack; + +import java.util.Map; + +public class PlayMenu implements CustomMenu { + + private CYG main; + + public PlayMenu(CYG main) { + this.main = main; + } + + @Override + public String name() { + return "Jouer"; + } + + @Override + public void contents(Player player, Inventory inv) { + for(Map.Entry st: main.getGameManager().getVerifyGames().entrySet()) + { + Storage storage = st.getValue(); + int id = 0; + for(Plot plot : storage.getPlots()) + { + VerifyGameConfig verifyGameConfig = plot.getVerifyConfig(); + String state = "En Attente"; + + if(verifyGameConfig.isVerify()) { + + inv.setItem(verifyGameConfig.getSlot(), + new ItemBuilder(verifyGameConfig.getMaterial(), 1) + .setName("§e" + plot.getName() + "§7 by " + storage.getDisplayName()) + .addLoreLine("§eStatus : " + state) + .addLoreLine("/play " + storage.getDisplayName() + " " + id) + .toItemStack() + ); + } + id ++; + } + } + } + + @Override + public void onClick(Player player, Inventory inv, ItemStack current, int slot) { + if(main.getGameManager().getVerifyGames().containsKey(slot)) + { + player.closeInventory(); + player.chat(current.getItemMeta().getLore().get(1)); + } + } + + @Override + public int getSize() { return 54; } +} diff --git a/src/main/java/fr/gravencyg/menus/all/UpgradeMenu.java b/src/main/java/fr/gravencyg/menus/all/UpgradeMenu.java new file mode 100644 index 0000000..300523c --- /dev/null +++ b/src/main/java/fr/gravencyg/menus/all/UpgradeMenu.java @@ -0,0 +1,111 @@ +package fr.gravencyg.menus.all; + +import fr.gravencyg.CYG; +import fr.gravencyg.items.ItemBuilder; +import fr.gravencyg.menus.core.CustomMenu; +import fr.gravencyg.utils.CLevel; +import fr.gravencyg.utils.PlotSize; +import org.bukkit.Material; +import org.bukkit.Sound; +import org.bukkit.entity.Player; +import org.bukkit.inventory.Inventory; +import org.bukkit.inventory.ItemStack; + +public class UpgradeMenu implements CustomMenu { + + private CYG main; + + public UpgradeMenu(CYG main) { + this.main = main; + } + + @Override + public String name() { + return "Améliorer"; + } + + @Override + public void contents(Player player, Inventory inv) { + + int[] graySlot = {9, 10, 11, 12, 13, 14, 15, 16, 28, 29, 30, 31, 32, 33, 34, 35, 45, 46, 47, 48, 49, 50, 51, 52}; + int[] level = {0, 1, 2, 3, 4, 5, 6, 7, 8, 17, 26, 25, 24, 23, 22, 21, 20, 19, 18, 27, 36, 37, 38, 39, 40, 41, 42, 43, 44, 53}; + + for(int gray : graySlot) + { + inv.setItem(gray, new ItemBuilder(Material.BLACK_STAINED_GLASS, 1, (byte)7).setName(" ").toItemStack()); + } + + int count = 1; + + int playerLevel = main.getDataManager().getLevel(player.getName()); + + for(int lvl : level) + { + Material material; + String name = ""; + byte data = 0; + + if(count <= playerLevel) + { + material = Material.GREEN_STAINED_GLASS; + name = "Niveau §9" + count + " §7[§eUNLOCKED§7]"; + data = 13; + } + else + { + name = "Niveau §9" + count + " §7[§cLOCKED§7]"; + material = Material.COAL_BLOCK; + } + + ItemBuilder item = new ItemBuilder(material, count, data).setName(name); + CLevel completeLevel = CLevel.values()[count-1]; + PlotSize plotSize = completeLevel.getPlotSize(); + + item.addLoreLine(""); + + if(plotSize != PlotSize.NONE) { + item.addLoreLine("§eParcelle " + plotSize.getName() + " : " + plotSize.getBorderSize() + " x " + plotSize.getBorderSize()); + item.addLoreLine(""); + } + + if(completeLevel.getCommands().size() != 0) { + item.addLoreLine("§fLes Commandes:"); + item.addLoreLine(""); + for (String lore : completeLevel.getCommands()) { + item.addLoreLine("§f" + lore); + } + } + + if(completeLevel.getLoreActions().size() != 0) { + item.addLoreLine(""); + item.addLoreLine("§fLes Blocs:"); + item.addLoreLine(""); + + for (String action : completeLevel.getLoreActions()) { + item.addLoreLine("§f" + action); + } + } + + item.addLoreLine(""); + item.addLoreLine("§f>> "+ completeLevel.getTrophy() +" §etrophés requis §f<<"); + + inv.setItem(lvl, item.toItemStack()); + count += 1; + } + } + + @Override + public void onClick(Player player, Inventory inv, ItemStack current, int slot) { + if(current.getType() == Material.COAL_BLOCK) + { + player.playSound(player.getLocation(), Sound.ENTITY_VILLAGER_NO, 2, 7); + } + if(current.getType() == Material.BLACK_STAINED_GLASS) + { + player.playSound(player.getLocation(), Sound.ENTITY_VILLAGER_YES, 2, 7); + } + } + + @Override + public int getSize() { return 54; } +} diff --git a/src/main/java/fr/gravencyg/menus/core/CustomMenu.java b/src/main/java/fr/gravencyg/menus/core/CustomMenu.java new file mode 100644 index 0000000..8f56194 --- /dev/null +++ b/src/main/java/fr/gravencyg/menus/core/CustomMenu.java @@ -0,0 +1,17 @@ +package fr.gravencyg.menus.core; + +import org.bukkit.entity.Player; +import org.bukkit.inventory.Inventory; +import org.bukkit.inventory.ItemStack; + +public interface CustomMenu { + + String name(); + + void contents(Player player, Inventory inv); + + void onClick(Player player, Inventory inv, ItemStack current, int slot); + + int getSize(); + +} diff --git a/src/main/java/fr/gravencyg/menus/core/CustomMenuListener.java b/src/main/java/fr/gravencyg/menus/core/CustomMenuListener.java new file mode 100644 index 0000000..9f729fe --- /dev/null +++ b/src/main/java/fr/gravencyg/menus/core/CustomMenuListener.java @@ -0,0 +1,54 @@ +package fr.gravencyg.menus.core; + +import fr.gravencyg.CYG; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.Listener; +import org.bukkit.event.inventory.InventoryClickEvent; +import org.bukkit.event.inventory.InventoryCloseEvent; +import org.bukkit.inventory.Inventory; +import org.bukkit.inventory.ItemStack; + +public class CustomMenuListener implements Listener { + + private CYG main; + + public CustomMenuListener(CYG main) { + this.main = main; + } + + @EventHandler + public void onClick(InventoryClickEvent event){ + + Player player = (Player) event.getWhoClicked(); + Inventory inv = event.getInventory(); + ItemStack current = event.getCurrentItem(); + + if(event.getCurrentItem() == null) return; + + this.main.getMenuManager().registeredMenus.values().stream() + .filter(menu -> event.getView().getTitle().equalsIgnoreCase(menu.name())) + .forEach(menu -> { + menu.onClick(player, inv, current, event.getSlot()); + event.setCancelled(true); + }); + + } + + @EventHandler + public void onClose(InventoryCloseEvent event) + { + Player player = (Player) event.getPlayer(); + if(main.getEventBlockCache().containsValue(player)); + { + main.getEventBlockCache().remove((Player) event.getPlayer()); + main.getMenuManager().backToStart(player); + } + + if(main.getTargetPlayMenu().containsKey(player)); + { + main.getTargetPlayMenu().remove(player); + } + } + +} diff --git a/src/main/java/fr/gravencyg/menus/locations/LocationMenu.java b/src/main/java/fr/gravencyg/menus/locations/LocationMenu.java new file mode 100644 index 0000000..f1479d7 --- /dev/null +++ b/src/main/java/fr/gravencyg/menus/locations/LocationMenu.java @@ -0,0 +1,122 @@ +package fr.gravencyg.menus.locations; + +import fr.gravencyg.CYG; +import fr.gravencyg.items.ItemBuilder; +import fr.gravencyg.menus.core.CustomMenu; +import fr.gravencyg.menus.options.OptionMenu; +import fr.gravencyg.model.Storage; +import fr.gravencyg.utils.LocationUtils; +import org.bukkit.Bukkit; +import org.bukkit.ChatColor; +import org.bukkit.Location; +import org.bukkit.Material; +import org.bukkit.enchantments.Enchantment; +import org.bukkit.entity.Player; +import org.bukkit.inventory.Inventory; +import org.bukkit.inventory.ItemStack; +import org.bukkit.inventory.meta.ItemMeta; + +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.Set; + +public class LocationMenu implements CustomMenu { + + private CYG main; + + public LocationMenu(CYG main) { + this.main = main; + } + + @Override + public String name() { + return "Les Zones"; + } + + @Override + public void contents(Player player, Inventory inv) { + + inv.clear(); + + Storage playerStorage = main.getDataManager().getStorageByUUID(player.getWorld().getName()); + int currentPage = main.getMenuManager().getCurrentPage(player); + int maxItemPerPage = 45; + + if(playerStorage.getPlot(player.getWorld().getName()) != null) { + + Map locations = playerStorage.getPlot(player.getWorld().getName()).getLocations(); + int numberOfLocations = locations.size(); + + + // place locations + int start = currentPage * maxItemPerPage; + int stop = (currentPage * maxItemPerPage) + maxItemPerPage; + + List key = Arrays.asList(locations.keySet().toArray(new String[0])); + + int count = 0; + + for(int i = start; i < stop; i++){ + + if(key.size() <= i) break; + + String k = key.get(i); + String v = locations.get(k); + + // place beacon item + ItemStack locationItem = new ItemBuilder(Material.BEACON, 1) + .setName(ChatColor.BLUE+ k) + .addLoreLine(ChatColor.GRAY + LocationUtils.fromStringToSimpleString(player.getUniqueId().toString(), v)) + .toItemStack(); + + inv.setItem(count, locationItem); + count++; + } + + // multi page required + if(numberOfLocations > maxItemPerPage) + { + if(currentPage != 0) inv.setItem(45, new ItemBuilder(Material.ARROW, 1).setName("§9Revenir à la page " + (currentPage - 1)).toItemStack()); // previous button + if(key.size() > maxItemPerPage * (currentPage + 1)) inv.setItem(53, new ItemBuilder(Material.ARROW, 1).setName("§9Aller à la page " + (currentPage + 1)).toItemStack()); // next button + } + + } + + + } + + @Override + public void onClick(Player player, Inventory inv, ItemStack current, int slot) { + + if(slot == 45 && current.getType() == Material.ARROW) + { + inv.clear(); + main.getMenuManager().previousPage(player); + contents(player, inv); + } + + if(slot == 53 && current.getType() == Material.ARROW) + { + inv.clear(); + main.getMenuManager().nextPage(player); + contents(player, inv); + } + + if (current != null && current.getType() == Material.BEACON && current.hasItemMeta() && current.getItemMeta().hasLore()) + { + player.closeInventory(); + + ItemMeta iM = current.getItemMeta(); + String lore = iM.getLore().get(0).split("§7")[1]; + Location location = LocationUtils.fromString2toLoc(player.getWorld().getName(), lore); + + player.teleport(location); + + } + } + + @Override + public int getSize() { return 54; } + +} diff --git a/src/main/java/fr/gravencyg/menus/locations/LocationSelectMenu.java b/src/main/java/fr/gravencyg/menus/locations/LocationSelectMenu.java new file mode 100644 index 0000000..ebf94c4 --- /dev/null +++ b/src/main/java/fr/gravencyg/menus/locations/LocationSelectMenu.java @@ -0,0 +1,149 @@ +package fr.gravencyg.menus.locations; + +import fr.gravencyg.CYG; +import fr.gravencyg.items.ItemBuilder; +import fr.gravencyg.menus.core.CustomMenu; +import fr.gravencyg.model.Plot; +import fr.gravencyg.model.Storage; +import fr.gravencyg.utils.LocationUtils; +import org.bukkit.Bukkit; +import org.bukkit.ChatColor; +import org.bukkit.Location; +import org.bukkit.Material; +import org.bukkit.block.Block; +import org.bukkit.enchantments.Enchantment; +import org.bukkit.entity.Player; +import org.bukkit.inventory.Inventory; +import org.bukkit.inventory.ItemStack; +import org.bukkit.inventory.meta.ItemMeta; + +import java.util.Arrays; +import java.util.List; +import java.util.Map; + +public class LocationSelectMenu implements CustomMenu { + + private CYG main; + + public LocationSelectMenu(CYG main) { + this.main = main; + } + + @Override + public String name() { + return "Choisir une zone"; + } + + @Override + public void contents(Player player, Inventory inv) { + + inv.clear(); + + Storage playerStorage = main.getDataManager().getStorageByUUID(player.getWorld().getName()); + int currentPage = main.getMenuManager().getCurrentPage(player); + int maxItemPerPage = 45; + + if(playerStorage.getPlot(player.getWorld().getName()) != null) { + + Map locations = playerStorage.getPlot(player.getWorld().getName()).getLocations(); + int numberOfLocations = locations.size(); + + + // place locations + int start = currentPage * maxItemPerPage; + int stop = (currentPage * maxItemPerPage) + maxItemPerPage; + + List key = Arrays.asList(locations.keySet().toArray(new String[0])); + + int count = 0; + + for(int i = start; i < stop; i++){ + + if(key.size() <= i) break; + + String k = key.get(i); + String v = locations.get(k); + boolean applyEnchant = false; + + // get selected event name to apply enchantment + if(main.getEventBlockCache().containsKey(player)) { + + Block selectedBlockInCache = main.getEventBlockCache().get(player); + Plot plot = main.getDataManager().getStorages().get(player.getName()).getPlot(player.getWorld().getName()); + + if(plot.getLocationsSet().containsKey(LocationUtils.fromLocToString(selectedBlockInCache.getLocation()))) + { + if(plot.getLocationsSet().get(LocationUtils.fromLocToString(selectedBlockInCache.getLocation())).equals(v)){ + applyEnchant = true; + } + } + + } + + // place beacon item + + inv.setItem(count, getLocationBlock(ChatColor.BLUE+ k, ChatColor.GRAY + LocationUtils.fromStringToSimpleString(player.getUniqueId().toString(), v), applyEnchant)); + + count++; + } + + // multi page required + if(numberOfLocations > maxItemPerPage) + { + if(currentPage != 0) inv.setItem(45, new ItemBuilder(Material.ARROW, 1).setName("§9Revenir à la page " + (currentPage - 1)).toItemStack()); // previous button + if(key.size() > maxItemPerPage * (currentPage + 1)) inv.setItem(53, new ItemBuilder(Material.ARROW, 1).setName("§9Aller à la page " + (currentPage + 1)).toItemStack()); // next button + } + + } + + + } + + public ItemStack getLocationBlock(String name, String lore, boolean applyEnchant) { + ItemBuilder itemBuilder = new ItemBuilder(Material.BEACON, 1) + .setName(name) + .addLoreLine(lore); + + if(applyEnchant) + itemBuilder.addEnchant(Enchantment.DURABILITY, 10); + + return itemBuilder.toItemStack(); + } + + @Override + public void onClick(Player player, Inventory inv, ItemStack current, int slot) { + + if(slot == 45 && current.getType() == Material.ARROW) + { + inv.clear(); + main.getMenuManager().previousPage(player); + contents(player, inv); + } + + if(slot == 53 && current.getType() == Material.ARROW) + { + inv.clear(); + main.getMenuManager().nextPage(player); + contents(player, inv); + } + + if (current != null && current.getType() == Material.BEACON && current.hasItemMeta() && current.getItemMeta().hasLore() + && main.getEventBlockCache().containsKey(player)) + { + Block selectedBlockInCache = main.getEventBlockCache().get(player); + + String name = current.getItemMeta().getDisplayName().replace("§9",""); + + main.getDataManager().addLocationSet(player.getWorld().getName(), selectedBlockInCache.getLocation(), name); + + player.sendMessage("§e"+name + "§r définit !"); + + player.closeInventory(); + } + + } + + @Override + public int getSize() { return 54; } + +} diff --git a/src/main/java/fr/gravencyg/menus/messages/MessageMenu.java b/src/main/java/fr/gravencyg/menus/messages/MessageMenu.java new file mode 100644 index 0000000..9eecd64 --- /dev/null +++ b/src/main/java/fr/gravencyg/menus/messages/MessageMenu.java @@ -0,0 +1,103 @@ +package fr.gravencyg.menus.messages; + +import fr.gravencyg.CYG; +import fr.gravencyg.items.ItemBuilder; +import fr.gravencyg.menus.core.CustomMenu; +import fr.gravencyg.model.Storage; +import org.bukkit.ChatColor; +import org.bukkit.Material; +import org.bukkit.entity.Player; +import org.bukkit.inventory.Inventory; +import org.bukkit.inventory.ItemStack; + +import java.util.Arrays; +import java.util.List; +import java.util.Map; + +public class MessageMenu implements CustomMenu { + + private CYG main; + + public MessageMenu(CYG main) { + this.main = main; + } + + @Override + public String name() { + return "Les Messages"; + } + + @Override + public void contents(Player player, Inventory inv) { + + inv.clear(); + + Storage playerStorage = main.getDataManager().getStorageByUUID(player.getWorld().getName()); + int currentPage = main.getMenuManager().getCurrentPage(player); + int maxItemPerPage = 45; + + if(playerStorage.getPlot(player.getWorld().getName()) != null) { + + Map messages = playerStorage.getPlot(player.getWorld().getName()).getMessages(); + int numberOfMessages = messages.size(); + + + // place locations + int start = currentPage * maxItemPerPage; + int stop = (currentPage * maxItemPerPage) + maxItemPerPage; + + List key = Arrays.asList(messages.keySet().toArray(new String[0])); + + int count = 0; + + for(int i = start; i < stop; i++){ + + if(key.size() <= i) break; + + String k = key.get(i); + String v = messages.get(k).replace("&"," §"); + + // place beacon item + ItemStack locationItem = new ItemBuilder(Material.PAPER, 1) + .setName(ChatColor.BLUE+ k) + .addLoreLine(ChatColor.GRAY + v) + .toItemStack(); + + inv.setItem(count, locationItem); + count++; + } + + // multi page required + if(numberOfMessages > maxItemPerPage) + { + if(currentPage != 0) inv.setItem(45, new ItemBuilder(Material.ARROW, 1).setName("§9Revenir à la page " + (currentPage - 1)).toItemStack()); // previous button + if(key.size() > maxItemPerPage * (currentPage + 1)) inv.setItem(53, new ItemBuilder(Material.ARROW, 1).setName("§9Aller à la page " + (currentPage + 1)).toItemStack()); // next button + } + + } + + + } + + @Override + public void onClick(Player player, Inventory inv, ItemStack current, int slot) { + + if(slot == 45 && current.getType() == Material.ARROW) + { + inv.clear(); + main.getMenuManager().previousPage(player); + contents(player, inv); + } + + if(slot == 53 && current.getType() == Material.ARROW) + { + inv.clear(); + main.getMenuManager().nextPage(player); + contents(player, inv); + } + } + + @Override + public int getSize() { return 54; } + +} diff --git a/src/main/java/fr/gravencyg/menus/messages/MessageSelectMenu.java b/src/main/java/fr/gravencyg/menus/messages/MessageSelectMenu.java new file mode 100644 index 0000000..160a9d1 --- /dev/null +++ b/src/main/java/fr/gravencyg/menus/messages/MessageSelectMenu.java @@ -0,0 +1,145 @@ +package fr.gravencyg.menus.messages; + +import fr.gravencyg.CYG; +import fr.gravencyg.items.ItemBuilder; +import fr.gravencyg.menus.core.CustomMenu; +import fr.gravencyg.model.Plot; +import fr.gravencyg.model.Storage; +import fr.gravencyg.utils.LocationUtils; +import org.bukkit.ChatColor; +import org.bukkit.Material; +import org.bukkit.block.Block; +import org.bukkit.enchantments.Enchantment; +import org.bukkit.entity.Player; +import org.bukkit.inventory.Inventory; +import org.bukkit.inventory.ItemStack; + +import java.util.Arrays; +import java.util.List; +import java.util.Map; + +public class MessageSelectMenu implements CustomMenu { + + private CYG main; + + public MessageSelectMenu(CYG main) { + this.main = main; + } + + @Override + public String name() { + return "Choisir un message"; + } + + @Override + public void contents(Player player, Inventory inv) { + + inv.clear(); + + Storage playerStorage = main.getDataManager().getStorageByUUID(player.getWorld().getName()); + int currentPage = main.getMenuManager().getCurrentPage(player); + int maxItemPerPage = 45; + + if(playerStorage.getPlot(player.getWorld().getName()) != null) { + + Map messages = playerStorage.getPlot(player.getWorld().getName()).getMessages(); + int numberOfMessages = messages.size(); + + // place locations + int start = currentPage * maxItemPerPage; + int stop = (currentPage * maxItemPerPage) + maxItemPerPage; + + List key = Arrays.asList(messages.keySet().toArray(new String[0])); + + int count = 0; + + for(int i = start; i < stop; i++){ + + if(key.size() <= i) break; + + String k = key.get(i); + String v = messages.get(k).replace("&"," §"); + boolean applyEnchant = false; + + // get selected event name to apply enchantment + if(main.getEventBlockCache().containsKey(player)) { + + Block selectedBlockInCache = main.getEventBlockCache().get(player); + Plot plot = main.getDataManager().getStorages().get(player.getName()).getPlot(player.getWorld().getName()); + + if(plot.getMessageSet().containsKey(LocationUtils.fromLocToString(selectedBlockInCache.getLocation()))) + { + if(plot.getMessageSet().get(LocationUtils.fromLocToString(selectedBlockInCache.getLocation())).equals(v)){ + applyEnchant = true; + } + } + + } + + // place beacon item + inv.setItem(count, getMessagesBlock(ChatColor.BLUE+ k, ChatColor.GRAY+ v, applyEnchant)); + + count++; + } + + // multi page required + if(numberOfMessages > maxItemPerPage) + { + if(currentPage != 0) inv.setItem(45, new ItemBuilder(Material.ARROW, 1).setName("§9Revenir à la page " + (currentPage - 1)).toItemStack()); // previous button + if(key.size() > maxItemPerPage * (currentPage + 1)) inv.setItem(53, new ItemBuilder(Material.ARROW, 1).setName("§9Aller à la page " + (currentPage + 1)).toItemStack()); // next button + } + + } + + + } + + public ItemStack getMessagesBlock(String name, String lore, boolean applyEnchant) { + ItemBuilder itemBuilder = new ItemBuilder(Material.PAPER, 1) + .setName(name) + .addLoreLine(lore); + + if(applyEnchant) + itemBuilder.addEnchant(Enchantment.DURABILITY, 10); + + return itemBuilder.toItemStack(); + } + + @Override + public void onClick(Player player, Inventory inv, ItemStack current, int slot) { + + if(slot == 45 && current.getType() == Material.ARROW) + { + inv.clear(); + main.getMenuManager().previousPage(player); + contents(player, inv); + } + + if(slot == 53 && current.getType() == Material.ARROW) + { + inv.clear(); + main.getMenuManager().nextPage(player); + contents(player, inv); + } + + if (current != null && current.getType() == Material.PAPER && current.hasItemMeta() && current.getItemMeta().hasLore() + && main.getEventBlockCache().containsKey(player)) + { + + Block selectedBlockInCache = main.getEventBlockCache().get(player); + + String name = current.getItemMeta().getDisplayName().replace("§9",""); + + main.getDataManager().addMessageSet(player.getWorld().getName(), selectedBlockInCache.getLocation(), name); + + player.sendMessage("§e"+name + "§r définit !"); + + player.closeInventory(); + } + + } + + @Override + public int getSize() { return 54; } + +} diff --git a/src/main/java/fr/gravencyg/menus/options/OptionAutostartMenu.java b/src/main/java/fr/gravencyg/menus/options/OptionAutostartMenu.java new file mode 100644 index 0000000..2e7f144 --- /dev/null +++ b/src/main/java/fr/gravencyg/menus/options/OptionAutostartMenu.java @@ -0,0 +1,83 @@ +package fr.gravencyg.menus.options; + +import fr.gravencyg.CYG; +import fr.gravencyg.items.ItemBuilder; +import fr.gravencyg.menus.core.CustomMenu; +import fr.gravencyg.model.GameConfig; +import fr.gravencyg.model.Plot; +import fr.gravencyg.model.Storage; +import org.bukkit.Material; +import org.bukkit.enchantments.Enchantment; +import org.bukkit.entity.Player; +import org.bukkit.inventory.Inventory; +import org.bukkit.inventory.ItemStack; + +public class OptionAutostartMenu implements CustomMenu { + + private CYG main; + + public OptionAutostartMenu(CYG main) { + this.main = main; + } + + @Override + public String name() { + return "Minimum de joueurs"; + } + + @Override + public void contents(Player player, Inventory inv) { + + Storage playerStorage = main.getDataManager().getStorages().get(player.getName()); + GameConfig config = playerStorage.getConfig(player.getWorld().getName()); + + for(int i : new int[]{ 1, 2, 4, 8, 12, 16, 20 }) + { + inv.addItem(getItem(i, config)); + } + + inv.setItem(8, new ItemBuilder(Material.ARROW, 1).setName("§9Revenir en arrière").toItemStack()); + + } + + private ItemStack getItem(int i, GameConfig config) { + ItemBuilder it = new ItemBuilder(Material.REDSTONE, i, (byte)3) + .setName("§e" + i + " §fjoueurs pour commencer"); + + if(config.getAutoStartPlayer() == i) + { + it.addLoreLine("§a[SELECTED]"); + it.addEnchant(Enchantment.DURABILITY, 1); + } + + return it.toItemStack(); + } + + @Override + public void onClick(Player player, Inventory inv, ItemStack current, int slot) { + + if(slot == 8) + { + player.closeInventory(); + main.getMenuManager().open(player, OptionMenu.class); + } + else + { + if(current.getType() == Material.REDSTONE) + { + Plot plot = main.getDataManager().getStorages().get(player.getName()).getPlot(player.getWorld().getName()); + plot.getConfig().setAutoStartPlayer(current.getAmount()); + main.getDataManager().save(player); + + player.sendMessage("§fLe jeu commenceras désormais à §e" + current.getAmount()+"§r joueurs" ); + + inv.clear(); + + contents(player, inv); + } + } + } + + @Override + public int getSize() { return 9; } +} diff --git a/src/main/java/fr/gravencyg/menus/options/OptionLifeMenu.java b/src/main/java/fr/gravencyg/menus/options/OptionLifeMenu.java new file mode 100644 index 0000000..75e4e69 --- /dev/null +++ b/src/main/java/fr/gravencyg/menus/options/OptionLifeMenu.java @@ -0,0 +1,83 @@ +package fr.gravencyg.menus.options; + +import fr.gravencyg.CYG; +import fr.gravencyg.items.ItemBuilder; +import fr.gravencyg.menus.core.CustomMenu; +import fr.gravencyg.model.GameConfig; +import fr.gravencyg.model.Plot; +import fr.gravencyg.model.Storage; +import org.bukkit.Material; +import org.bukkit.enchantments.Enchantment; +import org.bukkit.entity.Player; +import org.bukkit.inventory.Inventory; +import org.bukkit.inventory.ItemStack; + +public class OptionLifeMenu implements CustomMenu { + + private CYG main; + + public OptionLifeMenu(CYG main) { + this.main = main; + } + + @Override + public String name() { + return "Nombre de vies"; + } + + @Override + public void contents(Player player, Inventory inv) { + + + Storage playerStorage = main.getDataManager().getStorages().get(player.getName()); + GameConfig config = playerStorage.getConfig(player.getWorld().getName()); + + for(int i : new int[]{ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 12, 16, 24}) + { + inv.addItem(getItem(i, config)); + } + + inv.setItem(26, new ItemBuilder(Material.ARROW, 1).setName("§9Revenir en arrière").toItemStack()); + + } + + private ItemStack getItem(int i, GameConfig config) { + ItemBuilder it = new ItemBuilder(Material.POTION, i) + .setName("§e" + i + " §fvie(s) avant elimination"); + + if(config.getLifes() == i) + { + it.addLoreLine("§a[SELECTED]"); + it.addEnchant(Enchantment.DURABILITY, 1); + } + + return it.toItemStack(); + } + + @Override + public void onClick(Player player, Inventory inv, ItemStack current, int slot) { + if(slot == 26) + { + player.closeInventory(); + main.getMenuManager().open(player, OptionMenu.class); + } + else + { + if(current.getType() == Material.POTION) + { + Plot plot = main.getDataManager().getStorages().get(player.getName()).getPlot(player.getWorld().getName()); + plot.getConfig().setLifes(current.getAmount()); + main.getDataManager().save(player); + + player.sendMessage("§fChaque joueur aura §c" + current.getAmount()+"§r vies sur le jeu avant d'etre éliminé !" ); + + inv.clear(); + + contents(player, inv); + } + } + } + + @Override + public int getSize() { return 27; } +} diff --git a/src/main/java/fr/gravencyg/menus/options/OptionMaxPlayersMenu.java b/src/main/java/fr/gravencyg/menus/options/OptionMaxPlayersMenu.java new file mode 100644 index 0000000..243eeb6 --- /dev/null +++ b/src/main/java/fr/gravencyg/menus/options/OptionMaxPlayersMenu.java @@ -0,0 +1,82 @@ +package fr.gravencyg.menus.options; + +import fr.gravencyg.CYG; +import fr.gravencyg.items.ItemBuilder; +import fr.gravencyg.menus.core.CustomMenu; +import fr.gravencyg.model.GameConfig; +import fr.gravencyg.model.Plot; +import fr.gravencyg.model.Storage; +import org.bukkit.Material; +import org.bukkit.enchantments.Enchantment; +import org.bukkit.entity.Player; +import org.bukkit.inventory.Inventory; +import org.bukkit.inventory.ItemStack; + +public class OptionMaxPlayersMenu implements CustomMenu { + + private CYG main; + + public OptionMaxPlayersMenu(CYG main) { + this.main = main; + } + + @Override + public String name() { + return "Nombre de joueurs max"; + } + + @Override + public void contents(Player player, Inventory inv) { + + Storage playerStorage = main.getDataManager().getStorages().get(player.getName()); + GameConfig config = playerStorage.getConfig(player.getWorld().getName()); + + for(int i : new int[]{ 2, 4, 6, 8, 10, 12, 16, 20 }) + { + inv.addItem(getItem(i, config)); + } + + inv.setItem(26, new ItemBuilder(Material.ARROW, 1).setName("§9Revenir en arrière").toItemStack()); + + } + + @Override + public void onClick(Player player, Inventory inv, ItemStack current, int slot) { + if(slot == 26) + { + player.closeInventory(); + main.getMenuManager().open(player, OptionMenu.class); + } + else + { + if(current.getType() == Material.PLAYER_HEAD) + { + Plot plot = main.getDataManager().getStorages().get(player.getName()).getPlot(player.getWorld().getName()); + plot.getConfig().setMaxPlayers(current.getAmount()); + main.getDataManager().save(player); + + player.sendMessage("§fLe nombre maximum de joueurs est désormais de §e" + current.getAmount()+"§r" ); + + inv.clear(); + contents(player, inv); + } + } + } + + private ItemStack getItem(int i, GameConfig config) { + ItemBuilder it = new ItemBuilder(Material.PLAYER_HEAD, i, (byte)3) + .setName("§e" + i + " §fjoueurs au maximum"); + + if(config.getMaxPlayers() == i) + { + it.addLoreLine("§a[SELECTED]"); + it.addEnchant(Enchantment.DURABILITY, 1); + } + + return it.toItemStack(); + } + + + @Override + public int getSize() { return 27; } +} diff --git a/src/main/java/fr/gravencyg/menus/options/OptionMenu.java b/src/main/java/fr/gravencyg/menus/options/OptionMenu.java new file mode 100644 index 0000000..b6ffbac --- /dev/null +++ b/src/main/java/fr/gravencyg/menus/options/OptionMenu.java @@ -0,0 +1,104 @@ +package fr.gravencyg.menus.options; + +import fr.gravencyg.CYG; +import fr.gravencyg.items.ItemBuilder; +import fr.gravencyg.menus.core.CustomMenu; +import fr.gravencyg.model.GameConfig; +import fr.gravencyg.model.Storage; +import org.bukkit.Material; +import org.bukkit.entity.Player; +import org.bukkit.inventory.Inventory; +import org.bukkit.inventory.ItemStack; + +public class OptionMenu implements CustomMenu { + + private CYG main; + + public OptionMenu(CYG main) { + this.main = main; + } + + @Override + public String name() { + return "Configurer son jeu"; + } + + @Override + public void contents(Player player, Inventory inv) { + + Storage playerStorage = main.getDataManager().getStorages().get(player.getName()); + GameConfig config = playerStorage.getConfig(player.getWorld().getName()); + + inv.setItem(10, new ItemBuilder(Material.PAPER, 1) + .setName("Nom Du Jeu§7") + .addLoreLine("§e"+config.getGameName()) + .toItemStack()); + + inv.setItem(11, new ItemBuilder(Material.REDSTONE, config.getAutoStartPlayer()) + .setName("§fDémarrage automatique§7") + .addLoreLine("§e"+config.getAutoStartPlayer() + "§f Joueur(s)") + .toItemStack()); + + inv.setItem(12, new ItemBuilder(Material.PLAYER_HEAD, config.getMaxPlayers(), (byte)3) + .setName("§fMaximum de joueurs") + .addLoreLine("§e" + config.getMaxPlayers() + "§f Joueurs") + .toItemStack()); + + inv.setItem(13, new ItemBuilder(Material.LEGACY_WATCH, config.getAutoStartTime()) + .setName("§fDurée de demarrage§7") + .addLoreLine("§e"+config.getAutoStartTime() + "§f secondes") + .toItemStack()); + + inv.setItem(14, new ItemBuilder(Material.REDSTONE_BLOCK, 1) + .setName("§fWhitelist§7") + .addLoreLine("§e" + config.isWhitelist()) + .toItemStack()); + + inv.setItem(15, new ItemBuilder(Material.POTION, config.getLifes()) + .setName("§fNombre de vies§7") + .addLoreLine("§e" + config.getLifes()+"§e vies par joueur") + .toItemStack()); + + } + + @Override + public void onClick(Player player, Inventory inv, ItemStack current, int slot) { + switch (current.getType()) + { + case PAPER: + player.closeInventory(); + player.chat("/plot gamename"); + break; + case REDSTONE: + player.closeInventory(); + main.getMenuManager().open(player, OptionAutostartMenu.class); + break; + + case PLAYER_HEAD: + player.closeInventory(); + main.getMenuManager().open(player, OptionMaxPlayersMenu.class); + break; + + case LEGACY_WATCH: + player.closeInventory(); + main.getMenuManager().open(player, OptionStartingTimeMenu.class); + break; + + case REDSTONE_BLOCK: + player.closeInventory(); + main.getMenuManager().open(player, OptionWhitelistMenu.class); + break; + + case POTION: + player.closeInventory(); + main.getMenuManager().open(player, OptionLifeMenu.class); + break; + + default: + break; + } + } + + @Override + public int getSize() { return 27; } +} diff --git a/src/main/java/fr/gravencyg/menus/options/OptionStartingTimeMenu.java b/src/main/java/fr/gravencyg/menus/options/OptionStartingTimeMenu.java new file mode 100644 index 0000000..12015fb --- /dev/null +++ b/src/main/java/fr/gravencyg/menus/options/OptionStartingTimeMenu.java @@ -0,0 +1,82 @@ +package fr.gravencyg.menus.options; + +import fr.gravencyg.CYG; +import fr.gravencyg.items.ItemBuilder; +import fr.gravencyg.menus.core.CustomMenu; +import fr.gravencyg.model.GameConfig; +import fr.gravencyg.model.Plot; +import fr.gravencyg.model.Storage; +import org.bukkit.Material; +import org.bukkit.enchantments.Enchantment; +import org.bukkit.entity.Player; +import org.bukkit.inventory.Inventory; +import org.bukkit.inventory.ItemStack; + +public class OptionStartingTimeMenu implements CustomMenu { + + private CYG main; + + public OptionStartingTimeMenu(CYG main) { + this.main = main; + } + + @Override + public String name() { + return "Temps de lancement"; + } + + @Override + public void contents(Player player, Inventory inv) { + + Storage playerStorage = main.getDataManager().getStorages().get(player.getName()); + GameConfig config = playerStorage.getConfig(player.getWorld().getName()); + + for(int i : new int[]{ 5, 10, 15, 30, 60 }) + { + inv.addItem(getItem(i, config)); + } + + inv.setItem(8, new ItemBuilder(Material.ARROW, 1).setName("§9Revenir en arrière").toItemStack()); + + } + + @Override + public void onClick(Player player, Inventory inv, ItemStack current, int slot) { + if(slot == 8) + { + player.closeInventory(); + main.getMenuManager().open(player, OptionMenu.class); + } + else + { + if(current.getType() == Material.LEGACY_WATCH) + { + Plot plot = main.getDataManager().getStorages().get(player.getName()).getPlot(player.getWorld().getName()); + plot.getConfig().setAutoStartTime(current.getAmount()); + main.getDataManager().save(player); + + player.sendMessage("§fLe jeu commenceras désormais en §e" + current.getAmount()+"§r secondes" ); + + inv.clear(); + + contents(player, inv); + } + } + } + + private ItemStack getItem(int i, GameConfig config) { + ItemBuilder it = new ItemBuilder(Material.LEGACY_WATCH, i, (byte)3) + .setName("§e" + i + " §fsecondes avant de lancer"); + + if(config.getAutoStartTime() == i) + { + it.addLoreLine("§a[SELECTED]"); + it.addEnchant(Enchantment.DURABILITY, 1); + } + + return it.toItemStack(); + } + + @Override + public int getSize() { return 9; } +} diff --git a/src/main/java/fr/gravencyg/menus/options/OptionWhitelistMenu.java b/src/main/java/fr/gravencyg/menus/options/OptionWhitelistMenu.java new file mode 100644 index 0000000..5789b39 --- /dev/null +++ b/src/main/java/fr/gravencyg/menus/options/OptionWhitelistMenu.java @@ -0,0 +1,73 @@ +package fr.gravencyg.menus.options; + +import fr.gravencyg.CYG; +import fr.gravencyg.items.ItemBuilder; +import fr.gravencyg.menus.core.CustomMenu; +import fr.gravencyg.model.GameConfig; +import fr.gravencyg.model.Plot; +import fr.gravencyg.model.Storage; +import org.bukkit.Material; +import org.bukkit.enchantments.Enchantment; +import org.bukkit.entity.Player; +import org.bukkit.inventory.Inventory; +import org.bukkit.inventory.ItemStack; + +public class OptionWhitelistMenu implements CustomMenu { + + private CYG main; + + public OptionWhitelistMenu(CYG main) { + this.main = main; + } + + @Override + public String name() { + return "Whitelist"; + } + + @Override + public void contents(Player player, Inventory inv) { + + Storage playerStorage = main.getDataManager().getStorages().get(player.getName()); + GameConfig config = playerStorage.getConfig(player.getWorld().getName()); + inv.setItem(3, new ItemBuilder(Material.REDSTONE_BLOCK, 1).setName("§aActiver la Whitelist").addLoreLine("§7Seulement les amis peuvent rejoindre").toItemStack()); + inv.setItem(5, new ItemBuilder(Material.COAL_BLOCK, 1).setName("§cDésactiver la Whitelist").addLoreLine("§7Tout le monde peut rejoindre").toItemStack()); + + inv.setItem(8, new ItemBuilder(Material.ARROW, 1).setName("§9Revenir en arrière").toItemStack()); + + } + + @Override + public void onClick(Player player, Inventory inv, ItemStack current, int slot) { + if(slot == 8) + { + player.closeInventory(); + main.getMenuManager().open(player, OptionMenu.class); + } + else + { + if(current.getType() == Material.REDSTONE_BLOCK) + { + Plot plot = main.getDataManager().getStorages().get(player.getName()).getPlot(player.getWorld().getName()); + plot.getConfig().setWhitelist(true); + main.getDataManager().save(player); + + player.sendMessage("§fWhitelist §aActivé"); + } + + if(current.getType() == Material.COAL_BLOCK) + { + Plot plot = main.getDataManager().getStorages().get(player.getName()).getPlot(player.getWorld().getName()); + plot.getConfig().setWhitelist(false); + main.getDataManager().save(player); + + player.sendMessage("§fWhitelist §cDésactivé"); + + contents(player, inv); + } + } + } + + @Override + public int getSize() { return 9; } +} diff --git a/src/main/java/fr/gravencyg/menus/plot/PlayPlayerMenu.java b/src/main/java/fr/gravencyg/menus/plot/PlayPlayerMenu.java new file mode 100644 index 0000000..a3bdca8 --- /dev/null +++ b/src/main/java/fr/gravencyg/menus/plot/PlayPlayerMenu.java @@ -0,0 +1,89 @@ +package fr.gravencyg.menus.plot; + +import fr.gravencyg.CYG; +import fr.gravencyg.items.ItemBuilder; +import fr.gravencyg.menus.core.CustomMenu; +import fr.gravencyg.model.Plot; +import fr.gravencyg.model.Storage; +import org.bukkit.*; +import org.bukkit.entity.Player; +import org.bukkit.inventory.Inventory; +import org.bukkit.inventory.ItemStack; + +import java.util.List; + +public class PlayPlayerMenu implements CustomMenu { + + private CYG main; + + public PlayPlayerMenu(CYG main) { + this.main = main; + } + + @Override + public String name() { + return "Jouer à un jeu"; + } + + @Override + public void contents(Player player, Inventory inv) { + String target = main.getTargetPlayMenu().get(player); + Storage storage = main.getDataManager().getStorages().get(target); + List plots = storage.getPlots(); + int i = 0; + + for(Plot plot : plots) + { + inv.setItem(i, new ItemBuilder(plot.getVerifyConfig().getMaterial()) + .setName(main.getPlotManager().getGameNameFromPlot(player, i)) + .addLoreLine("§e>> Clique pour rejoindre <<").toItemStack()); + i++; + } + + player.sendMessage("Ouverture du menu de jeu de §e" + target); + } + + @Override + public void onClick(Player player, Inventory inv, ItemStack current, int slot) { + if(current.getType() != Material.AIR && current.hasItemMeta()) + { + String target = main.getTargetPlayMenu().get(player); + Storage storage = main.getDataManager().getStorages().get(target); + Plot targetPlot = storage.getPlots().get(slot); + + if(main.getGameManager().isPlayerInGame(player).size() != 0) { + main.getGameManager().quit(player); + } + + if(targetPlot.getConfig().isWhitelist() && !targetPlot.getFriends().contains(player.getName()) && !player.getName().equalsIgnoreCase(storage.getDisplayName())) + { + player.sendMessage("Le jeu est actuellement en §cWhitelist"); + return; + } + + if(!main.getGameManager().hasPendingGame(target, slot)) + { + main.getGameManager().create(target, slot); + player.sendMessage("§7>>§r Création d'une partie pour le jeu de §e"+ target); + } + + player.sendMessage("§7>>§r Vous avez rejoint \""+targetPlot.getName()+"\" par§e "+ target); + + WorldCreator worldCreator = new WorldCreator(storage.getUUID()+"#" + slot); + worldCreator.type(WorldType.FLAT); + + World playerWorld = Bukkit.createWorld(worldCreator); + + // wait 3 seconds before teleport the player + Bukkit.getScheduler().runTaskLater(main, () -> { + main.getGameManager().join(player, target, slot); + }, 50); + + + player.closeInventory(); + } + } + + @Override + public int getSize() { return 9; } +} diff --git a/src/main/java/fr/gravencyg/menus/plot/PlotManageMenu.java b/src/main/java/fr/gravencyg/menus/plot/PlotManageMenu.java new file mode 100644 index 0000000..70fe88a --- /dev/null +++ b/src/main/java/fr/gravencyg/menus/plot/PlotManageMenu.java @@ -0,0 +1,90 @@ +package fr.gravencyg.menus.plot; + +import fr.gravencyg.CYG; +import fr.gravencyg.actions.Action; +import fr.gravencyg.items.ItemBuilder; +import fr.gravencyg.menus.all.ActionMenu; +import fr.gravencyg.menus.core.CustomMenu; +import fr.gravencyg.menus.options.OptionMenu; +import fr.gravencyg.model.GameConfig; +import fr.gravencyg.model.Storage; +import org.bukkit.Material; +import org.bukkit.entity.Player; +import org.bukkit.inventory.Inventory; +import org.bukkit.inventory.ItemStack; + +public class PlotManageMenu implements CustomMenu { + + private CYG main; + + public PlotManageMenu(CYG main) { + this.main = main; + } + + @Override + public String name() { + return "Gestion du Plot"; + } + + @Override + public void contents(Player player, Inventory inv) { + + + inv.setItem(11, new ItemBuilder(Material.NAME_TAG, 1) + .setName("§eRéglages§7") + .addLoreLine("§eConfigurer son jeu") + .addLoreLine("§fRaccourci §9/options") + .toItemStack()); + + inv.setItem(12, new ItemBuilder(Material.CHEST, 1) + .setName("§eActions§7") + .addLoreLine("§eObtenir des blocs de code") + .addLoreLine("§fRaccourci §9/actions ou /ac") + .toItemStack()); + + inv.setItem(13, new ItemBuilder(Material.BEACON, 1) + .setName("§eZone de Spawn§7") + .addLoreLine("§eTéléportation") + .toItemStack()); + + inv.setItem(14, new ItemBuilder(Material.HOPPER, 1) + .setName("§eZone du code§7") + .addLoreLine("§eTéléportation") + .toItemStack()); + + } + + @Override + public void onClick(Player player, Inventory inv, ItemStack current, int slot) { + + Storage storage = main.getPlotManager().getStorageByUUID(player.getWorld().getName()); + String uuid = player.getWorld().getName(); + + switch (current.getType()) + { + case NAME_TAG: + player.closeInventory(); + main.getMenuManager().open(player, OptionMenu.class); + break; + + case CHEST: + player.closeInventory(); + main.getMenuManager().open(player, ActionMenu.class); + break; + + case BEACON: + player.teleport(storage.getPlot(uuid).getSpawn(uuid)); + player.sendMessage("§eTéléportation vers le spawn..."); + break; + + case HOPPER: + player.teleport(storage.getPlot(uuid).getCode(uuid)); + player.sendMessage("§9Téléportation vers le code..."); + break; + } + + } + + @Override + public int getSize() { return 45; } +} diff --git a/src/main/java/fr/gravencyg/menus/plot/PlotMenu.java b/src/main/java/fr/gravencyg/menus/plot/PlotMenu.java new file mode 100644 index 0000000..403454a --- /dev/null +++ b/src/main/java/fr/gravencyg/menus/plot/PlotMenu.java @@ -0,0 +1,69 @@ +package fr.gravencyg.menus.plot; + +import fr.gravencyg.CYG; +import fr.gravencyg.items.ItemBuilder; +import fr.gravencyg.menus.core.CustomMenu; +import fr.gravencyg.model.Storage; +import fr.gravencyg.model.VerifyGameConfig; +import fr.gravencyg.utils.CRank; +import org.bukkit.Material; +import org.bukkit.entity.Player; +import org.bukkit.inventory.Inventory; +import org.bukkit.inventory.ItemStack; + +import java.util.Map; + +public class PlotMenu implements CustomMenu { + + private CYG main; + + public PlotMenu(CYG main) { + this.main = main; + } + + @Override + public String name() { + return "Plot"; + } + + @Override + public void contents(Player player, Inventory inv) { + int maxPlotPerPlayer = main.getDataManager().getMaxPlotPerPlayer(player); + + for(int i = 0; i < 3; i++) + { + if(maxPlotPerPlayer > i) + inv.setItem(i, new ItemBuilder(Material.GRASS_BLOCK).setName("§eParcelle "+(i+1)+" §r(§aDisponible§r)") + .addLoreLine("§fNom du jeu") + .addLoreLine("§e" + main.getPlotManager().getGameNameFromPlot(player, i)) + .addLoreLine("§d") + .addLoreLine("§e>> Clique pour rejoindre <<").toItemStack()); + else if(i == 1 ) { + inv.setItem(i, new ItemBuilder(Material.COAL_BLOCK).setName("§eParcelle " + (i + 1) + " §r(§cIndisponible§r)") + .addLoreLine("§c>> Débloqué avec le niveau 10 <<").toItemStack()); + } + else{ + inv.setItem(i, new ItemBuilder(Material.COAL_BLOCK).setName("§eParcelle " + (i + 1) + " §r(§cIndisponible§r)").addLoreLine("§c>> Débloqué avec le grade Premium <<").toItemStack()); + } + } + } + + @Override + public void onClick(Player player, Inventory inv, ItemStack current, int slot) { + if(current.getType() == Material.GRASS_BLOCK && current.hasItemMeta()) + { + player.closeInventory(); + + if(main.getPlotManager().isPlotExist(player.getUniqueId().toString(), slot)) + { + main.getPlotManager().teleportPlayer(player, player.getUniqueId().toString(), slot); + } + else{ + main.getPlotManager().createPlot(player, slot); + } + } + } + + @Override + public int getSize() { return 9; } +} diff --git a/src/main/java/fr/gravencyg/menus/variables/VariableMenu.java b/src/main/java/fr/gravencyg/menus/variables/VariableMenu.java new file mode 100644 index 0000000..33cdc1c --- /dev/null +++ b/src/main/java/fr/gravencyg/menus/variables/VariableMenu.java @@ -0,0 +1,103 @@ +package fr.gravencyg.menus.variables; + +import fr.gravencyg.CYG; +import fr.gravencyg.items.ItemBuilder; +import fr.gravencyg.menus.core.CustomMenu; +import fr.gravencyg.model.Storage; +import org.bukkit.ChatColor; +import org.bukkit.Material; +import org.bukkit.entity.Player; +import org.bukkit.inventory.Inventory; +import org.bukkit.inventory.ItemStack; + +import java.util.Arrays; +import java.util.List; +import java.util.Map; + +public class VariableMenu implements CustomMenu { + + private CYG main; + + public VariableMenu(CYG main) { + this.main = main; + } + + @Override + public String name() { + return "Les Variables"; + } + + @Override + public void contents(Player player, Inventory inv) { + + inv.clear(); + + Storage playerStorage = main.getDataManager().getStorages().get(player.getName()); + int currentPage = main.getMenuManager().getCurrentPage(player); + int maxItemPerPage = 45; + + if(playerStorage.getPlot(player.getWorld().getName()) != null) { + + Map variables = playerStorage.getPlot(player.getWorld().getName()).getVariables(); + int numberOfMessages = variables.size(); + + + // place locations + int start = currentPage * maxItemPerPage; + int stop = (currentPage * maxItemPerPage) + maxItemPerPage; + + List key = Arrays.asList(variables.keySet().toArray(new String[0])); + + int count = 0; + + for(int i = start; i < stop; i++){ + + if(key.size() <= i) break; + + String k = key.get(i); + String v = variables.get(k); + + // place beacon item + ItemStack locationItem = new ItemBuilder(Material.PAPER, 1) + .setName(ChatColor.BLUE+ k) + .addLoreLine(ChatColor.GRAY + v) + .toItemStack(); + + inv.setItem(count, locationItem); + count++; + } + + // multi page required + if(numberOfMessages > maxItemPerPage) + { + if(currentPage != 0) inv.setItem(45, new ItemBuilder(Material.ARROW, 1).setName("§9Revenir à la page " + (currentPage - 1)).toItemStack()); // previous button + if(key.size() > maxItemPerPage * (currentPage + 1)) inv.setItem(53, new ItemBuilder(Material.ARROW, 1).setName("§9Aller à la page " + (currentPage + 1)).toItemStack()); // next button + } + + } + + + } + + @Override + public void onClick(Player player, Inventory inv, ItemStack current, int slot) { + + if(slot == 45 && current.getType() == Material.ARROW) + { + inv.clear(); + main.getMenuManager().previousPage(player); + contents(player, inv); + } + + if(slot == 53 && current.getType() == Material.ARROW) + { + inv.clear(); + main.getMenuManager().nextPage(player); + contents(player, inv); + } + } + + @Override + public int getSize() { return 54; } + +} diff --git a/src/main/java/fr/gravencyg/menus/variables/VariableSelectMenu.java b/src/main/java/fr/gravencyg/menus/variables/VariableSelectMenu.java new file mode 100644 index 0000000..e2af7c9 --- /dev/null +++ b/src/main/java/fr/gravencyg/menus/variables/VariableSelectMenu.java @@ -0,0 +1,145 @@ +package fr.gravencyg.menus.variables; + +import fr.gravencyg.CYG; +import fr.gravencyg.items.ItemBuilder; +import fr.gravencyg.menus.core.CustomMenu; +import fr.gravencyg.model.Plot; +import fr.gravencyg.model.Storage; +import fr.gravencyg.utils.LocationUtils; +import org.bukkit.ChatColor; +import org.bukkit.Material; +import org.bukkit.block.Block; +import org.bukkit.enchantments.Enchantment; +import org.bukkit.entity.Player; +import org.bukkit.inventory.Inventory; +import org.bukkit.inventory.ItemStack; + +import java.util.Arrays; +import java.util.List; +import java.util.Map; + +public class VariableSelectMenu implements CustomMenu { + + private CYG main; + + public VariableSelectMenu(CYG main) { + this.main = main; + } + + @Override + public String name() { + return "Choisir une variable"; + } + + @Override + public void contents(Player player, Inventory inv) { + + inv.clear(); + + Storage playerStorage = main.getDataManager().getStorages().get(player.getName()); + int currentPage = main.getMenuManager().getCurrentPage(player); + int maxItemPerPage = 45; + + if(playerStorage.getPlot(player.getWorld().getName()) != null) { + + Map messages = playerStorage.getPlot(player.getWorld().getName()).getMessages(); + int numberOfMessages = messages.size(); + + // place locations + int start = currentPage * maxItemPerPage; + int stop = (currentPage * maxItemPerPage) + maxItemPerPage; + + List key = Arrays.asList(messages.keySet().toArray(new String[0])); + + int count = 0; + + for(int i = start; i < stop; i++){ + + if(key.size() <= i) break; + + String k = key.get(i); + String v = messages.get(k).replace("&"," §"); + boolean applyEnchant = false; + + // get selected event name to apply enchantment + if(main.getEventBlockCache().containsKey(player)) { + + Block selectedBlockInCache = main.getEventBlockCache().get(player); + Plot plot = main.getDataManager().getStorages().get(player.getName()).getPlot(player.getWorld().getName()); + + if(plot.getMessageSet().containsKey(LocationUtils.fromLocToString(selectedBlockInCache.getLocation()))) + { + if(plot.getMessageSet().get(LocationUtils.fromLocToString(selectedBlockInCache.getLocation())).equals(v)){ + applyEnchant = true; + } + } + + } + + // place beacon item + inv.setItem(count, getMessagesBlock(ChatColor.BLUE+ k, ChatColor.GRAY+ v, applyEnchant)); + + count++; + } + + // multi page required + if(numberOfMessages > maxItemPerPage) + { + if(currentPage != 0) inv.setItem(45, new ItemBuilder(Material.ARROW, 1).setName("§9Revenir à la page " + (currentPage - 1)).toItemStack()); // previous button + if(key.size() > maxItemPerPage * (currentPage + 1)) inv.setItem(53, new ItemBuilder(Material.ARROW, 1).setName("§9Aller à la page " + (currentPage + 1)).toItemStack()); // next button + } + + } + + + } + + public ItemStack getMessagesBlock(String name, String lore, boolean applyEnchant) { + ItemBuilder itemBuilder = new ItemBuilder(Material.PAPER, 1) + .setName(name) + .addLoreLine(lore); + + if(applyEnchant) + itemBuilder.addEnchant(Enchantment.DURABILITY, 10); + + return itemBuilder.toItemStack(); + } + + @Override + public void onClick(Player player, Inventory inv, ItemStack current, int slot) { + + if(slot == 45 && current.getType() == Material.ARROW) + { + inv.clear(); + main.getMenuManager().previousPage(player); + contents(player, inv); + } + + if(slot == 53 && current.getType() == Material.ARROW) + { + inv.clear(); + main.getMenuManager().nextPage(player); + contents(player, inv); + } + + if (current != null && current.getType() == Material.PAPER && current.hasItemMeta() && current.getItemMeta().hasLore() + && main.getEventBlockCache().containsKey(player)) + { + + Block selectedBlockInCache = main.getEventBlockCache().get(player); + + String name = current.getItemMeta().getDisplayName().replace("§9",""); + + main.getDataManager().addMessageSet(player, selectedBlockInCache.getLocation(), name); + + player.sendMessage("§e"+name + "§r définit !"); + + player.closeInventory(); + } + + } + + @Override + public int getSize() { return 54; } + +} diff --git a/src/main/java/fr/gravencyg/model/ActionProcess.java b/src/main/java/fr/gravencyg/model/ActionProcess.java new file mode 100644 index 0000000..ccdf6b0 --- /dev/null +++ b/src/main/java/fr/gravencyg/model/ActionProcess.java @@ -0,0 +1,39 @@ +package fr.gravencyg.model; + +import fr.gravencyg.utils.CEvent; +import org.bukkit.Material; +import org.bukkit.block.Block; +import org.bukkit.entity.Player; + +import java.util.List; + +public class ActionProcess { + + private List players; + private List processedBlocks; + private Block block; + private Material material; + + public ActionProcess(List players, List processedBlocks, Block block, Material material) + { + this.players = players; + this.processedBlocks = processedBlocks; + this.block = block; + this.material = material; + } + + public Material getMaterial() { return material; } + + public List getPlayers() { + return players; + } + + public List getProcessedBlocks() { + return processedBlocks; + } + + public Block getBlock() { + return block; + } + +} diff --git a/src/main/java/fr/gravencyg/model/CYGameMode.java b/src/main/java/fr/gravencyg/model/CYGameMode.java new file mode 100644 index 0000000..a4bf5ac --- /dev/null +++ b/src/main/java/fr/gravencyg/model/CYGameMode.java @@ -0,0 +1,7 @@ +package fr.gravencyg.model; + +public enum CYGameMode { + + DEATH_MATCH, POINTS; + +} diff --git a/src/main/java/fr/gravencyg/model/GameConfig.java b/src/main/java/fr/gravencyg/model/GameConfig.java new file mode 100644 index 0000000..1468926 --- /dev/null +++ b/src/main/java/fr/gravencyg/model/GameConfig.java @@ -0,0 +1,63 @@ +package fr.gravencyg.model; + +import org.bukkit.entity.Player; + +public class GameConfig { + + private String gameName; + + private int autoStartPlayer; + + private int autoStartTime; + + private int maxPlayers; + + private boolean whitelist; + + private int lifes; + + public GameConfig(Player player) { + this.gameName = "Jeu de " + player.getName(); + this.autoStartPlayer = 2; + this.maxPlayers = 10; + this.autoStartTime = 10; + this.whitelist = true; + this.lifes = 1; + } + + public String getGameName() { + return gameName; + } + + public int getAutoStartPlayer() { + return autoStartPlayer; + } + + public int getAutoStartTime() { return autoStartTime; } + + public boolean isWhitelist() { + return whitelist; + } + + public void setAutoStartTime(int autoStartTime) { this.autoStartTime = autoStartTime;} + + public void setLifes(int lifes) { this.lifes = lifes;} + + public void setMaxPlayers(int maxPlayers) { this.maxPlayers = maxPlayers;} + + public void setAutoStartPlayer(int autoStartPlayer) { this.autoStartPlayer = autoStartPlayer;} + + public void setWhitelist(boolean whitelist) { this.whitelist = whitelist;} + + public int getMaxPlayers() { + if(maxPlayers == 0) return 10; + return maxPlayers; + } + + public int getLifes() { + if(lifes == 0) return 1; + return lifes; + } + + public void setName(String name) { this.gameName = name; } +} diff --git a/src/main/java/fr/gravencyg/model/MaterialAndData.java b/src/main/java/fr/gravencyg/model/MaterialAndData.java new file mode 100644 index 0000000..f6d504b --- /dev/null +++ b/src/main/java/fr/gravencyg/model/MaterialAndData.java @@ -0,0 +1,27 @@ +package fr.gravencyg.model; + +import org.bukkit.Material; +import org.bukkit.block.Block; +import org.bukkit.entity.Player; + +import java.util.List; + +public class MaterialAndData { + + private Material material; + private byte data; + + public MaterialAndData(Material material, byte data) + { + this.material = material; + this.data = data; + } + + public byte getData() { + return data; + } + + public Material getMaterial(){ + return material; + } +} diff --git a/src/main/java/fr/gravencyg/model/Plot.java b/src/main/java/fr/gravencyg/model/Plot.java new file mode 100644 index 0000000..a1a2b50 --- /dev/null +++ b/src/main/java/fr/gravencyg/model/Plot.java @@ -0,0 +1,139 @@ +package fr.gravencyg.model; + +import fr.gravencyg.utils.CEvent; +import fr.gravencyg.utils.LocationUtils; +import org.bukkit.Location; +import org.bukkit.entity.Player; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import static fr.gravencyg.utils.LocationUtils.defaultSpawn; + +public class Plot { + + private String name; + + private Map events = new HashMap<>(); + + private Map locations = new HashMap<>(); + + private Map locationsSet = new HashMap<>(); + + private Map messages = new HashMap<>(); + + private Map messagesSet = new HashMap<>(); + + private Map variables = new HashMap<>(); + + private List friends = new ArrayList<>(); + + private List blacklisted = new ArrayList<>(); + + private String spawn = defaultSpawn(); + private String code = defaultSpawn(); + + private GameConfig gameConfig; + + private VerifyGameConfig verifyGameConfig; + + public Plot(Player player) { + this.gameConfig = new GameConfig(player); + this.verifyGameConfig = new VerifyGameConfig(); + + for(CEvent event : CEvent.values()) { + this.events.put(event.getEventName(), null); + } + } + + public void updateEvent(String key, String value) { + if(this.events.containsKey(key)) + { + this.events.remove(key); + } + + this.events.put(key, value); + } + + public void addLocationSet(String key, String value) { locationsSet.put(key, value); } + + public void addMessageSet(String key, String value) { messagesSet.put(key, value); } + + public void addLocation(String key, String value) { locations.put(key, value); } + + public void addVariable(String key, String value) { variables.put(key, value); } + + public void addMessage(String key, String value) { messages.put(key, value); } + + public void removeLocation(String key) { locations.remove(key); } + + public void removeMessage(String key) { messages.remove(key); } + + public boolean checkLocationExist(String key) { return locations.containsKey(key); } + + public boolean checkMessages(String key) { return messages.containsKey(key); } + + public boolean checkVariables(String key) { + if(variables == null) variables = new HashMap<>(); + return variables.containsKey(key); } + + public void removeEvent(String key) { + this.events.remove(key); + } + + public void removeVariable(String key) { + this.variables.remove(key); + } + + public Map getEvents() { + return events; + } + + public Map getLocations() { return locations; } + + public Map getLocationsSet() { return locationsSet; } + + public Map getMessageSet() { return messagesSet; } + + public String getName() { return gameConfig.getGameName(); } + + public GameConfig getConfig() { return gameConfig; } + + public VerifyGameConfig getVerifyConfig() { return verifyGameConfig; } + + public boolean hasEvent(String key) { return events.containsKey(key); } + + public List getFriends() { return friends; } + + public void setSpawn(String spawn) { this.spawn = spawn; } + + public void setCode(String code) { this.code = code; } + + public Location getSpawn(String uuid) { + if(spawn == null) + { + return LocationUtils.fromStringToLoc(uuid, LocationUtils.defaultSpawn()); + } + + return LocationUtils.fromStringToLocComplete(uuid, spawn); + + } + + public Location getCode(String uuid) { + if(code == null) + { + return LocationUtils.fromStringToLoc(uuid, LocationUtils.defaultSpawn()); + } + + return LocationUtils.fromStringToLocComplete(uuid, code); + + } + + public Map getMessages() { return messages; } + + public Map getVariables() { return variables; } + + +} diff --git a/src/main/java/fr/gravencyg/model/Storage.java b/src/main/java/fr/gravencyg/model/Storage.java new file mode 100644 index 0000000..0e18351 --- /dev/null +++ b/src/main/java/fr/gravencyg/model/Storage.java @@ -0,0 +1,79 @@ +package fr.gravencyg.model; + +import fr.gravencyg.utils.CLevel; +import org.bukkit.Bukkit; +import org.bukkit.entity.Player; + +import java.util.ArrayList; +import java.util.List; + +public class Storage { + + private String displayName; + private String uuid; + private String rank; + private int level; + private int trophys; + private List plots; + + public Storage() { + this.displayName = "Undefined"; + this.uuid = "X9X9"; + this.rank = "Joueur"; + this.plots = new ArrayList<>(); + this.level = 1; + this.trophys = 0; + } + + public Storage(Player player) { + this.displayName = player.getDisplayName(); + this.uuid = player.getUniqueId().toString(); + this.rank = "Joueur"; + this.plots = new ArrayList<>(); + this.level = 1; + this.trophys = 0; + } + + public void createPlot(Player player) { + this.plots.add(new Plot(player)); + } + + public void setPseudo(Player player) { + this.displayName = player.getDisplayName(); + } + + public void addTrophy(int amount) { this.trophys += amount; } + + public void setLevel(int newLevel) { this.level = newLevel; } + + public String getDisplayName() { + return displayName; + } + + public void setRank(String rankS) { + this.rank = rankS; + } + + public void setTrophy(int trophys) { this.trophys = trophys;} + + public String getRank() { + return rank; + } + + public int getLevel() { return level; } + + public String getUUID() { return uuid; } + + public int getTrophys() { return trophys; } + + public GameConfig getConfig(String worldName) { return getPlot(worldName).getConfig(); } + + public List getPlots(){ + return plots; + } + + public Plot getPlot(String worldName) { + Bukkit.getServer().broadcastMessage(getPlots().size()+"sss"); + return getPlots().get(Integer.parseInt(worldName.split("_")[1])); + } +} diff --git a/src/main/java/fr/gravencyg/model/VerifyGameConfig.java b/src/main/java/fr/gravencyg/model/VerifyGameConfig.java new file mode 100644 index 0000000..b600efc --- /dev/null +++ b/src/main/java/fr/gravencyg/model/VerifyGameConfig.java @@ -0,0 +1,40 @@ +package fr.gravencyg.model; + +import org.bukkit.Material; +import org.bukkit.entity.Player; + +import java.util.Arrays; + +public class VerifyGameConfig { + + private boolean isVerify = false; + private String icon = "DIAMOND_SWORD"; + + private int slot = 0; + + public VerifyGameConfig() { + this.icon = icon; + } + + public int getSlot(){ return slot; } + + public Material getMaterial(){ + for(Material mat : Material.values()) + { + if(mat.name().equalsIgnoreCase(icon.toUpperCase())) + { + return mat; + } + } + + return Material.STONE; + } + + public boolean isVerify() { return this.isVerify; } + + public void setVerify(boolean verify) { this.isVerify = verify;} + + public void setIcon(String material) { this.icon = material; } + + public void setSlot(int numberSlot) { this.slot = numberSlot; } +} diff --git a/src/main/java/fr/gravencyg/npcs/NPC.java b/src/main/java/fr/gravencyg/npcs/NPC.java new file mode 100644 index 0000000..1f29752 --- /dev/null +++ b/src/main/java/fr/gravencyg/npcs/NPC.java @@ -0,0 +1,58 @@ +package fr.gravencyg.npcs; + +import com.mojang.authlib.GameProfile; +import fr.gravencyg.CYG; +import net.minecraft.server.v1_16_R1.EntityPlayer; +import net.minecraft.server.v1_16_R1.MinecraftServer; +import net.minecraft.server.v1_16_R1.PlayerInteractManager; +import net.minecraft.server.v1_16_R1.WorldServer; +import org.bukkit.Bukkit; +import org.bukkit.Location; +import org.bukkit.craftbukkit.v1_16_R1.CraftServer; +import org.bukkit.craftbukkit.v1_16_R1.CraftWorld; +import org.bukkit.entity.ArmorStand; +import org.bukkit.entity.Player; + +import java.util.UUID; + +public abstract class NPC { + + private String displayName; + + private ArmorStand stand; + + protected CYG main; + + private Location location; + + public NPC(CYG main, String displayName, double x, double y, double z, float yaw, float pitch) { + this.main = main; + this.displayName = displayName; + this.location = new Location(Bukkit.getWorld("world"), x, y, z, yaw, pitch); + } + + public abstract String skinUUID(); + + public abstract String hologramMessage(); + + public abstract double[] colliderOffset(); + + public abstract void onClick(Player player); + + public Location getLocation() { return location; } + + public EntityPlayer create() { + MinecraftServer nmsServer = ((CraftServer) Bukkit.getServer()).getServer(); + WorldServer nmsWorld = ((CraftWorld) Bukkit.getWorld("world")).getHandle(); // Change "world" to the world the NPC should be spawned in. + GameProfile gameProfile = new GameProfile(UUID.fromString(skinUUID()), "[NPC] "+displayName); // Change "playername" to the name the NPC should have, max 16 characters. + EntityPlayer npc = new EntityPlayer(nmsServer, nmsWorld, gameProfile, new PlayerInteractManager(nmsWorld)); // This will be the EntityPlayer (NPC) we send with the sendNPCPacket method. + npc.setLocation(location.getX(), location.getY(), location.getZ(), location.getYaw(), location.getPitch()); + return npc; + } + + public void setTopArmorstand(ArmorStand stand) { + this.stand = stand; + } + + public ArmorStand getStand() { return stand; } +} diff --git a/src/main/java/fr/gravencyg/npcs/NPCClickListener.java b/src/main/java/fr/gravencyg/npcs/NPCClickListener.java new file mode 100644 index 0000000..b5673bb --- /dev/null +++ b/src/main/java/fr/gravencyg/npcs/NPCClickListener.java @@ -0,0 +1,42 @@ +package fr.gravencyg.npcs; + +import fr.gravencyg.CYG; +import org.bukkit.Location; +import org.bukkit.entity.ArmorStand; +import org.bukkit.entity.Entity; +import org.bukkit.entity.EntityType; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; +import org.bukkit.event.Listener; +import org.bukkit.event.player.PlayerInteractAtEntityEvent; +import org.bukkit.event.player.PlayerInteractEvent; + +public class NPCClickListener implements Listener { + + private CYG main; + + public NPCClickListener(CYG main) { this.main = main;} + + @EventHandler(priority= EventPriority.HIGH) + public void onPlayerClick(PlayerInteractAtEntityEvent event) { + Player player = event.getPlayer(); + Location loc = player.getLocation(); + Entity entity = event.getRightClicked(); + + if(entity.getType() == EntityType.ARMOR_STAND && loc.getWorld().getName().equalsIgnoreCase("world")) + { + for(int i = 0; i < main.getNpcManager().getNPCSObj().size(); i++) + { + NPC npcObj = main.getNpcManager().getNPCSObj().get(i); + ArmorStand stand = npcObj.getStand(); + + if(stand.getCustomName().equalsIgnoreCase(entity.getCustomName())) + { + npcObj.onClick(player); + } + } + } + } + +} diff --git a/src/main/java/fr/gravencyg/npcs/NPCManager.java b/src/main/java/fr/gravencyg/npcs/NPCManager.java new file mode 100644 index 0000000..4f82108 --- /dev/null +++ b/src/main/java/fr/gravencyg/npcs/NPCManager.java @@ -0,0 +1,73 @@ +package fr.gravencyg.npcs; + +import fr.gravencyg.CYG; +import fr.gravencyg.npcs.all.DevNPC; +import fr.gravencyg.npcs.all.PlayNPC; +import fr.gravencyg.npcs.all.UpgradeNPC; +import net.minecraft.server.v1_16_R1.*; +import org.bukkit.Bukkit; +import org.bukkit.ChatColor; +import org.bukkit.Location; +import org.bukkit.World; +import org.bukkit.craftbukkit.v1_16_R1.entity.CraftPlayer; +import org.bukkit.entity.ArmorStand; +import org.bukkit.entity.Entity; +import org.bukkit.entity.EntityType; +import org.bukkit.entity.Player; + +import java.util.ArrayList; +import java.util.List; + +public class NPCManager { + + private List npcs = new ArrayList<>(); + private List npcsObj = new ArrayList<>(); + private CYG main; + + public NPCManager(CYG main) { + this.main = main; + + registerNPC(new DevNPC(main)); + registerNPC(new PlayNPC(main)); + registerNPC(new UpgradeNPC(main)); + + for(int i = 0; i < npcs.size(); i++) { + EntityPlayer npc = npcs.get(i); + NPC npcObj = npcsObj.get(i); + Location location = npc.getBukkitEntity().getLocation(); + + ArmorStand top = main.getHologramManager().registerHologram(location, "§e>> "+ npcObj.hologramMessage() +" <<"); + + Location adjust = new Location(location.getWorld(), location.getX() + npcObj.colliderOffset()[0], location.getY(), location.getZ() + npcObj.colliderOffset()[1]); + ArmorStand stand = main.getHologramManager().registerBoxCollider(adjust, "§e>> "+ npcObj.hologramMessage() +" <<"); + npcObj.setTopArmorstand(stand); + + } + } + + public void registerNPC(NPC npc) { + npcs.add(npc.create()); + npcsObj.add(npc); + } + + public void display(Player player) { + for (EntityPlayer npc : npcs) { + PlayerConnection connection = ((CraftPlayer) player).getHandle().playerConnection; + connection.sendPacket(new PacketPlayOutPlayerInfo(PacketPlayOutPlayerInfo.EnumPlayerInfoAction.ADD_PLAYER, npc)); // "Adds the player data for the client to use when spawning a player" - https://wiki.vg/Protocol#Spawn_Player + connection.sendPacket(new PacketPlayOutNamedEntitySpawn(npc)); // Spawns the NPC for the player client. + connection.sendPacket(new PacketPlayOutEntityHeadRotation(npc, (byte) (npc.yaw * 256 / 360))); // Correct head rotation when spawned in player look direction. + } + } + + public List getNPCSObj() { return npcsObj; } + + public void killAll() { + for(World world : Bukkit.getWorlds()) { + for (Entity entity : world.getEntities()) { + if (entity.getType() == EntityType.ARMOR_STAND) { + entity.remove(); + } + } + } + } +} diff --git a/src/main/java/fr/gravencyg/npcs/all/DevNPC.java b/src/main/java/fr/gravencyg/npcs/all/DevNPC.java new file mode 100644 index 0000000..f600edf --- /dev/null +++ b/src/main/java/fr/gravencyg/npcs/all/DevNPC.java @@ -0,0 +1,28 @@ +package fr.gravencyg.npcs.all; + +import fr.gravencyg.CYG; +import fr.gravencyg.menus.plot.PlotMenu; +import fr.gravencyg.npcs.NPC; +import org.bukkit.entity.Player; + +public class DevNPC extends NPC { + + public DevNPC(CYG main) { + super(main, "Développer", -21.530, 22, 9.495, -113.7f, 3.7f); + } + + public String skinUUID() { + return "a3208407-feaf-470b-ba15-0b7e67cb0ac9"; + } + + public String hologramMessage() { return "Rejoindre ta parcelle"; } + + @Override + public double[] colliderOffset() { return new double[]{0.3, -0.2}; } + + @Override + public void onClick(Player player) { + main.getMenuManager().open(player, PlotMenu.class); + } + +} diff --git a/src/main/java/fr/gravencyg/npcs/all/PlayNPC.java b/src/main/java/fr/gravencyg/npcs/all/PlayNPC.java new file mode 100644 index 0000000..8b5cf2a --- /dev/null +++ b/src/main/java/fr/gravencyg/npcs/all/PlayNPC.java @@ -0,0 +1,29 @@ +package fr.gravencyg.npcs.all; + +import fr.gravencyg.CYG; +import fr.gravencyg.menus.all.PlayMenu; +import fr.gravencyg.npcs.NPC; +import org.bukkit.entity.Player; + +public class PlayNPC extends NPC { + + public PlayNPC(CYG main) { + super(main, "Jouer", -29.47, 22, 1.4, -90f, 0f); + } + + public String skinUUID() { + return "4ddcd747-679e-4fc1-93fd-04904e0a0260"; + } + + @Override + public String hologramMessage() { return "Jouer à un Jeu"; } + + @Override + public double[] colliderOffset() { return new double[]{0.5, 0}; } + + @Override + public void onClick(Player player) { + main.getMenuManager().open(player, PlayMenu.class); + } + +} diff --git a/src/main/java/fr/gravencyg/npcs/all/UpgradeNPC.java b/src/main/java/fr/gravencyg/npcs/all/UpgradeNPC.java new file mode 100644 index 0000000..b235669 --- /dev/null +++ b/src/main/java/fr/gravencyg/npcs/all/UpgradeNPC.java @@ -0,0 +1,29 @@ +package fr.gravencyg.npcs.all; + +import fr.gravencyg.CYG; +import fr.gravencyg.menus.all.UpgradeMenu; +import fr.gravencyg.npcs.NPC; +import org.bukkit.entity.Player; + +public class UpgradeNPC extends NPC { + + public UpgradeNPC(CYG main) { + super(main, "Améliorer", -21.570, 22, -6.535f, -63.2f, 1f); + } + + public String skinUUID() { + return "e9c3d931-16ac-4683-aaf4-35707bac4948"; + } + + @Override + public String hologramMessage() { return "Débloquer des niveaux"; } + + @Override + public double[] colliderOffset() { return new double[]{0.3, 0.3}; } + + @Override + public void onClick(Player player) { + main.getMenuManager().open(player, UpgradeMenu.class); + } + +} \ No newline at end of file diff --git a/src/main/java/fr/gravencyg/schedule/CYGExecutionTask.java b/src/main/java/fr/gravencyg/schedule/CYGExecutionTask.java new file mode 100644 index 0000000..727d1c9 --- /dev/null +++ b/src/main/java/fr/gravencyg/schedule/CYGExecutionTask.java @@ -0,0 +1,103 @@ +package fr.gravencyg.schedule; + +import fr.gravencyg.CYG; +import fr.gravencyg.game.CYGame; +import fr.gravencyg.model.ActionProcess; +import fr.gravencyg.model.Storage; +import org.bukkit.Bukkit; +import org.bukkit.Material; +import org.bukkit.World; +import org.bukkit.block.Block; +import org.bukkit.entity.Entity; +import org.bukkit.entity.EntityType; +import org.bukkit.entity.Player; +import org.bukkit.scheduler.BukkitRunnable; + +import java.util.ArrayList; +import java.util.List; +import java.util.Map; + +public class CYGExecutionTask extends BukkitRunnable { + + private CYG main; + private List lapisPreview = new ArrayList<>(); + + public CYGExecutionTask(CYG main){ + this.main = main; + } + + @Override + public void run() { + + + for(Block lapis : lapisPreview) + { + lapis.setType(Material.AIR); + } + + lapisPreview.clear(); + + main.getGameManager().playLoop(); + + for(World world : Bukkit.getWorlds()) + { + for(Entity entity : world.getEntities()) + { + if(entity.getType() == EntityType.ENDER_DRAGON) { + entity.remove(); + } + if(entity.getType() == EntityType.BOAT) { + entity.remove(); + } + + } + } + + if( main.getCompilerManager().getProcessedBlocks().size() != 0) { + + List actionProcessesToRemove = new ArrayList<>(); + + + for (ActionProcess actionProcess : main.getCompilerManager().getProcessedBlocks()) { + + if (actionProcess.getProcessedBlocks().size() >= 1) { + + + + Block currentBlock = actionProcess.getProcessedBlocks().get(0); + + if (currentBlock.getType() != Material.LAPIS_BLOCK) { + main.getActionBlocks().execute(actionProcess, currentBlock); + + Block top = currentBlock.getLocation().add(0, 1, 0).getBlock(); + + if (top.getType() == Material.AIR) { + top.setType(actionProcess.getMaterial()); + lapisPreview.add(top); + } + + // remove first action from list + actionProcess.getProcessedBlocks().remove(currentBlock); + + // remove action list to processed blocks + if (actionProcess.getProcessedBlocks().size() == 0) { + actionProcessesToRemove.add(actionProcess); + + Storage storage = main.getDataManager().getStorageByUUID(actionProcess.getPlayers().get(0).getWorld().getName()); + main.getGameManager().removeLoopStorage(storage); + } + } + else{ + actionProcess.getProcessedBlocks().remove(currentBlock); + } + + + } + } + + actionProcessesToRemove.forEach(main.getCompilerManager().getProcessedBlocks()::remove); + } + + } + +} diff --git a/src/main/java/fr/gravencyg/schedule/CYGGameCycle.java b/src/main/java/fr/gravencyg/schedule/CYGGameCycle.java new file mode 100644 index 0000000..6a435ce --- /dev/null +++ b/src/main/java/fr/gravencyg/schedule/CYGGameCycle.java @@ -0,0 +1,149 @@ +package fr.gravencyg.schedule; + +import fr.gravencyg.CYG; +import fr.gravencyg.actions.team.Team; +import fr.gravencyg.game.CYGame; +import fr.gravencyg.game.CYGameState; +import fr.gravencyg.model.CYGameMode; +import fr.gravencyg.utils.CEvent; +import org.bukkit.Bukkit; +import org.bukkit.Material; +import org.bukkit.block.Block; +import org.bukkit.entity.Player; +import org.bukkit.scheduler.BukkitRunnable; + +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.Set; + +public class CYGGameCycle extends BukkitRunnable { + + private CYG main; + + public CYGGameCycle(CYG main){ + this.main = main; + } + + @Override + public void run() { + + for(Map.Entry> g : main.getGameManager().getGames().entrySet()) + { + for(CYGame game : g.getValue()) { + if (game.getAutoStartMin() == game.getPlayers().size() && game.isState(CYGameState.WAITING)) { + game.setState(CYGameState.STARTING); + main.getScoreboardManager().updateInGameState(game); + main.getGameManager().broadcast(game, "§6Démarrage du jeu dans:"); + } + + if (game.getPlayers().size() < game.getAutoStartMin() && game.isState(CYGameState.STARTING)) { + game.setState(CYGameState.WAITING); + main.getScoreboardManager().updateInGameState(game); + main.getGameManager().broadcast(game, "§cPas assez de joueur... Phase d'attente"); + } + + if (game.isState(CYGameState.STARTING)) { + + if (game.getCountdown() == 0) { + + // assign player to team + List teams = new ArrayList<>(game.getTeams().keySet()); + if (teams.size() >= 2) { + + int teamId = 0; + for (Player player : game.getPlayers()) { + Team selected = teams.get(teamId); + game.getTeams().get(selected).add(player); + + // dispatch team + if (teamId == game.getTeams().size()) { + teamId = 0; + } else { + teamId++; + } + + player.sendMessage("Vous faites partie de l'équipe " + selected.getColor() + selected.getName()); + } + + } + + game.setState(CYGameState.PLAYING); + main.getScoreboardManager().updateInGameState(game); + main.getGameManager().runEvent(CEvent.START, game, game.getPlayers().get(0)); + main.getGameManager().broadcast(game, "§cGO !"); + + } else { + main.getGameManager().broadcast(game, "§c" + game.getCountdown() + "§es"); + game.decrementCountdown(); + } + + } + + if (game.isState(CYGameState.PLAYING)) { + + if (game.hasTeamSystem()) { + if ((game.getPlayers().size() == game.getTeams().get(game.getTeamPlayer(game.getPlayers().get(0))).size()) && game.getAutoStartMin() != 1) { + Team team = game.getTeamPlayer(game.getPlayers().get(0)); + main.getGameManager().broadcast(game, "Victoire de l'equipe " + team.getColor() + team.getName()); + main.getGameManager().runEvent(CEvent.FINISH, game, game.getPlayers().get(0)); + + for (Player winner : game.getPlayers()) { + if (game.getAutoStartMin() != 1) { + winner.sendMessage("§r+ §e7§r Trophés de victoire !"); + main.getDataManager().addTrophy(winner, 7); + } + winner.teleport(main.spawnLocation); + } + + game.setState(CYGameState.FINISH); + main.getScoreboardManager().updateInGameState(game); + game.setCountdown(5); + } + } + } + + if (game.isState(CYGameState.PLAYING) && game.isMode(CYGameMode.DEATH_MATCH) && game.getPlayers().size() <= 1 && game.getAutoStartMin() != 1) { + game.setState(CYGameState.FINISH); + main.getScoreboardManager().updateInGameState(game); + game.setCountdown(5); + + if (!game.hasTeamSystem()) { + Player winner = game.getPlayers().get(0); + + if (game.getAutoStartMin() != 1) { + winner.sendMessage("§r+ §e7§r Trophées de victoire !"); + + main.getDataManager().addTrophy(winner, 7); + + } + winner.teleport(main.spawnLocation); + } + + if (game.getPlayers().size() == 1 && game.getAutoStartMin() != 1) { + main.getGameManager().runEvent(CEvent.FINISH, game, game.getPlayers().get(0)); + } + + } + + if (!game.isState(CYGameState.WAITING) && !game.isState(CYGameState.STARTING) && game.getPlayers().size() == 0) { + main.getGameManager().stop(game); + main.getGameManager().runEvent(CEvent.FINISH, game, null); + + } + + if (game.isState(CYGameState.FINISH)) { + game.decrementCountdown(); + if (game.getPlayers().size() != 0) { + main.getGameManager().quit(game.getPlayers().get(0)); + } + main.getGameManager().stop(game); + + } + } + + } + + } + +} diff --git a/src/main/java/fr/gravencyg/scoreboards/ScoreboardManager.java b/src/main/java/fr/gravencyg/scoreboards/ScoreboardManager.java new file mode 100644 index 0000000..aed19b1 --- /dev/null +++ b/src/main/java/fr/gravencyg/scoreboards/ScoreboardManager.java @@ -0,0 +1,137 @@ +package fr.gravencyg.scoreboards; + +import fr.gravencyg.CYG; +import fr.gravencyg.game.CYGame; +import fr.gravencyg.utils.CRank; +import org.bukkit.Bukkit; +import org.bukkit.entity.Player; +import org.bukkit.scoreboard.Team; + +import java.util.HashMap; +import java.util.Map; + +public class ScoreboardManager { + + private CYG main; + private Map scoreboards = new HashMap<>(); + private Map scoreboardsGame = new HashMap<>(); + private Map teamMap = new HashMap<>(); + + public ScoreboardManager(CYG main) { + this.main = main; + + for(CRank rank: CRank.values()) + { + teamMap.put(rank, Bukkit.getScoreboardManager().getNewScoreboard().registerNewTeam("0000"+rank.getName())); + } + } + + + public void load(Player player) { + ScoreboardSign board = new ScoreboardSign(player, "§eGravenMC v§c" + main.getDescription().getVersion()); + board.create(); + + board.setLine(0, "§e"); + board.setLine(1, "En ligne§r: §71"); + board.setLine(2, "§5"); + board.setLine(3, "§fGrade§f:§r ?"); + board.setLine(4, "§fNiveau§f: §e?§7/§e30"); + board.setLine(5, "§fTrophés§f: §e?"); + board.setLine(6, "§d"); + board.setLine(7, "§eplay.gravenmc.fr"); + + scoreboards.put(player, board); + + updateTotalPlayers(); + updatePlayerRank(player); + updatePlayerLevel(player); + updatePlayerTrophy(player); + + } + + + public void loadGame(Player player, CYGame game) { + + unload(player); + + ScoreboardSign board = new ScoreboardSign(player, "§e" + game.getName()); + board.create(); + + board.setLine(0, "§e"); + board.setLine(1, "§rJoueurs§r: §7" + "?§r/§7?"); + board.setLine(2, "§fStatut§f:§r En attente"); + board.setLine(3, "§d"); + board.setLine(4, "§eplay.gravenmc.fr"); + + scoreboardsGame.put(player, board); + } + + public void updateTotalPlayers() { + for(Map.Entry board : scoreboards.entrySet()) { + board.getValue().setLine(1, "En ligne§r: §7" + Bukkit.getOnlinePlayers().size()); + } + } + + public void updateInGameTotalPlayers(CYGame game) { + for(Player player : game.getPlayers()) { + ScoreboardSign board = scoreboardsGame.get(player); + board.removeLine(1); + board.setLine(1, "§rJoueurs§r: §7" + game.getPlayers().size() + "§r/§7" + game.getMaxPlayers()); + } + } + + public void updateInGameState(CYGame game) { + for(Player player : game.getPlayers()) { + ScoreboardSign board = scoreboardsGame.get(player); + board.removeLine(2); + board.setLine(2, "§fStatut§f:§r " + game.getState().getName()); + } + } + + public void updatePlayerRank(Player player) { + if(scoreboards.containsKey(player)){ + ScoreboardSign board = scoreboards.get(player); + CRank rank = main.getDataManager().getRank(player); + board.setLine(3, "§fGrade§f:§r " + rank.getColor() + rank.getName()); + } + } + + public void updatePlayerLevel(Player player) { + if(scoreboards.containsKey(player)){ + ScoreboardSign board = scoreboards.get(player); + board.setLine(4, "§fNiveau§f: §e"+ main.getDataManager().getLevel(player.getName())+"/§e30"); + } + } + + public void updatePlayerTrophy(Player player) { + if(scoreboards.containsKey(player)){ + ScoreboardSign board = scoreboards.get(player); + board.setLine(5, "§fTrophés§f: §e" +main.getDataManager().getTrophys(player.getName())+""); + } + } + + public void unload(Player player) { + if(scoreboards.containsKey(player)) { + ScoreboardSign board = scoreboards.get(player); + board.destroy(); + + teamMap.get(main.getDataManager().getRank(player)).removeEntry(player.getName()); + + scoreboards.remove(player); + + for(Map.Entry b : scoreboards.entrySet()) { + b.getValue().setLine(1, "Joueurs§r: §7" + (Bukkit.getOnlinePlayers().size()-1)); + } + + } + + if(scoreboardsGame.containsKey(player)) { + ScoreboardSign board = scoreboardsGame.get(player); + board.destroy(); + + scoreboardsGame.remove(player); + + } + } + +} diff --git a/src/main/java/fr/gravencyg/scoreboards/ScoreboardSign.java b/src/main/java/fr/gravencyg/scoreboards/ScoreboardSign.java new file mode 100644 index 0000000..153237c --- /dev/null +++ b/src/main/java/fr/gravencyg/scoreboards/ScoreboardSign.java @@ -0,0 +1,368 @@ +package fr.gravencyg.scoreboards; + +import java.lang.reflect.Field; +import java.util.ArrayList; +import java.util.List; + +import net.minecraft.server.v1_16_R1.*; +import org.bukkit.craftbukkit.v1_16_R1.entity.CraftPlayer; +import org.bukkit.entity.Player; +/** + * @author zyuiop + */ + +public class ScoreboardSign { + + private boolean created = false; + private final VirtualTeam[] lines = new VirtualTeam[15]; + private final Player player; + private String objectiveName; + + /** + * Create a scoreboard sign for a given player and using a specifig objective name + * @param player the player viewing the scoreboard sign + * @param objectiveName the name of the scoreboard sign (displayed at the top of the scoreboard) + */ + public ScoreboardSign(Player player, String objectiveName) { + this.player = player; + this.objectiveName = objectiveName; + } + + /** + * Send the initial creation packets for this scoreboard sign. Must be called at least once. + */ + public void create() { + if (created) + return; + + PlayerConnection player = getPlayer(); + player.sendPacket(createObjectivePacket(0, objectiveName)); + player.sendPacket(setObjectiveSlot()); + int i = 0; + while (i < lines.length) + sendLine(i++); + + created = true; + } + + /** + * Send the packets to remove this scoreboard sign. A destroyed scoreboard sign must be recreated using {@link ScoreboardSign#create()} in order + * to be used again + */ + public void destroy() { + if (!created) + return; + + getPlayer().sendPacket(createObjectivePacket(1, null)); + for (VirtualTeam team : lines) + if (team != null) + getPlayer().sendPacket(team.removeTeam()); + + created = false; + } + + /** + * Change the name of the objective. The name is displayed at the top of the scoreboard. + * @param name the name of the objective, max 32 char + */ + public void setObjectiveName(String name) { + this.objectiveName = name; + if (created) + getPlayer().sendPacket(createObjectivePacket(2, name)); + } + + /** + * Change a scoreboard line and send the packets to the player. Can be called async. + * @param line the number of the line (0 <= line < 15) + * @param value the new value for the scoreboard line + */ + public void setLine(int line, String value) { + VirtualTeam team = getOrCreateTeam(line); + String old = team.getCurrentPlayer(); + + if (old != null && created) + getPlayer().sendPacket(removeLine(old)); + + team.setValue(value); + sendLine(line); + } + + /** + * Remove a given scoreboard line + * @param line the line to remove + */ + public void removeLine(int line) { + VirtualTeam team = getOrCreateTeam(line); + String old = team.getCurrentPlayer(); + + if (old != null && created) { + getPlayer().sendPacket(removeLine(old)); + getPlayer().sendPacket(team.removeTeam()); + } + + lines[line] = null; + } + + /** + * Get the current value for a line + * @param line the line + * @return the content of the line + */ + public String getLine(int line) { + if (line > 14) + return null; + if (line < 0) + return null; + return getOrCreateTeam(line).getValue(); + } + + /** + * Get the team assigned to a line + * @return the {@link VirtualTeam} used to display this line + */ + public VirtualTeam getTeam(int line) { + if (line > 14) + return null; + if (line < 0) + return null; + return getOrCreateTeam(line); + } + + private PlayerConnection getPlayer() { + return ((CraftPlayer) player).getHandle().playerConnection; + } + + @SuppressWarnings("rawtypes") + private void sendLine(int line) { + if (line > 14) + return; + if (line < 0) + return; + if (!created) + return; + + int score = (15 - line); + VirtualTeam val = getOrCreateTeam(line); + for (Packet packet : val.sendLine()) + getPlayer().sendPacket(packet); + getPlayer().sendPacket(sendScore(val.getCurrentPlayer(), score)); + val.reset(); + } + + private VirtualTeam getOrCreateTeam(int line) { + if (lines[line] == null) + lines[line] = new VirtualTeam("__fakeScore" + line); + + return lines[line]; + } + + /* + Factories + */ + private PacketPlayOutScoreboardObjective createObjectivePacket(int mode, String displayName) { + PacketPlayOutScoreboardObjective packet = new PacketPlayOutScoreboardObjective(); + // Nom de l'objectif + setField(packet, "a", player.getName()); + + // Mode + // 0 : créer + // 1 : Supprimer + // 2 : Mettre à jour + setField(packet, "d", mode); + + if (mode == 0 || mode == 2) { + setField(packet, "b", IChatBaseComponent.ChatSerializer.a("{\"text\":\"" + displayName + "\"}")); + setField(packet, "c", IScoreboardCriteria.EnumScoreboardHealthDisplay.INTEGER); + } + + return packet; + } + + private PacketPlayOutScoreboardDisplayObjective setObjectiveSlot() { + PacketPlayOutScoreboardDisplayObjective packet = new PacketPlayOutScoreboardDisplayObjective(); + // Slot + setField(packet, "a", 1); + setField(packet, "b", player.getName()); + + return packet; + } + + private PacketPlayOutScoreboardScore sendScore(String line, int score) { + PacketPlayOutScoreboardScore packet = new PacketPlayOutScoreboardScore(ScoreboardServer.Action.CHANGE, player.getName(), line, score); + + return packet; + } + + private PacketPlayOutScoreboardScore removeLine(String line) { + return new PacketPlayOutScoreboardScore(ScoreboardServer.Action.REMOVE, player.getName(), line, 0); + } + + /** + * This class is used to manage the content of a line. Advanced users can use it as they want, but they are encouraged to read and understand the + * code before doing so. Use these methods at your own risk. + */ + public class VirtualTeam { + private final String name; + private String prefix; + private String suffix; + private String currentPlayer; + private String oldPlayer; + + private boolean prefixChanged, suffixChanged, playerChanged = false; + private boolean first = true; + + private VirtualTeam(String name, String prefix, String suffix) { + this.name = name; + this.prefix = prefix; + this.suffix = suffix; + } + + private VirtualTeam(String name) { + this(name, "", ""); + } + + public String getName() { + return name; + } + + public String getPrefix() { + return prefix; + } + + public void setPrefix(String prefix) { + if (this.prefix == null || !this.prefix.equals(prefix)) + this.prefixChanged = true; + this.prefix = prefix; + } + + public String getSuffix() { + return suffix; + } + + public void setSuffix(String suffix) { + if (this.suffix == null || !this.suffix.equals(prefix)) + this.suffixChanged = true; + this.suffix = suffix; + } + + private PacketPlayOutScoreboardTeam createPacket(int mode) { + PacketPlayOutScoreboardTeam packet = new PacketPlayOutScoreboardTeam(); + setField(packet, "a", name); + setField(packet, "c", new ChatComponentText(prefix)); + setField(packet, "d", new ChatComponentText(suffix)); + setField(packet, "i", 0); + setField(packet, "e", "always"); + setField(packet, "i", mode); + + return packet; + } + + public PacketPlayOutScoreboardTeam createTeam() { + return createPacket(0); + } + + public PacketPlayOutScoreboardTeam updateTeam() { + return createPacket(2); + } + + public PacketPlayOutScoreboardTeam removeTeam() { + PacketPlayOutScoreboardTeam packet = new PacketPlayOutScoreboardTeam(); + setField(packet, "a", name); + setField(packet, "i", 1); + first = true; + return packet; + } + + public void setPlayer(String name) { + if (this.currentPlayer == null || !this.currentPlayer.equals(name)) + this.playerChanged = true; + this.oldPlayer = this.currentPlayer; + this.currentPlayer = name; + } + + public Iterable sendLine() { + List packets = new ArrayList<>(); + + if (first) { + packets.add(createTeam()); + } else if (prefixChanged || suffixChanged) { + packets.add(updateTeam()); + } + + if (first || playerChanged) { + if (oldPlayer != null) // remove these two lines ? + packets.add(addOrRemovePlayer(4, oldPlayer)); // + packets.add(changePlayer()); + } + + if (first) + first = false; + + return packets; + } + + public void reset() { + prefixChanged = false; + suffixChanged = false; + playerChanged = false; + oldPlayer = null; + } + + public PacketPlayOutScoreboardTeam changePlayer() { + return addOrRemovePlayer(3, currentPlayer); + } + + @SuppressWarnings("unchecked") + public PacketPlayOutScoreboardTeam addOrRemovePlayer(int mode, String playerName) { + PacketPlayOutScoreboardTeam packet = new PacketPlayOutScoreboardTeam(); + setField(packet, "a", name); + setField(packet, "i", mode); + + try { + Field f = packet.getClass().getDeclaredField("h"); + f.setAccessible(true); + ((List) f.get(packet)).add(playerName); + } catch (NoSuchFieldException | IllegalAccessException e) { + e.printStackTrace(); + } + + return packet; + } + + public String getCurrentPlayer() { + return currentPlayer; + } + + public String getValue() { + return getPrefix() + getCurrentPlayer() + getSuffix(); + } + + public void setValue(String value) { + if (value.length() <= 16) { + setPrefix(""); + setSuffix(""); + setPlayer(value); + } else if (value.length() <= 32) { + setPrefix(value.substring(0, 16)); + setPlayer(value.substring(16)); + setSuffix(""); + } else if (value.length() <= 48) { + setPrefix(value.substring(0, 16)); + setPlayer(value.substring(16, 32)); + setSuffix(value.substring(32)); + } else { + throw new IllegalArgumentException("Too long value ! Max 48 characters, value was " + value.length() + " !"); + } + } + } + + private static void setField(Object edit, String fieldName, Object value) { + try { + Field field = edit.getClass().getDeclaredField(fieldName); + field.setAccessible(true); + field.set(edit, value); + } catch (NoSuchFieldException | IllegalAccessException e) { + e.printStackTrace(); + } + } +} \ No newline at end of file diff --git a/src/main/java/fr/gravencyg/utils/CEvent.java b/src/main/java/fr/gravencyg/utils/CEvent.java new file mode 100644 index 0000000..a5d2948 --- /dev/null +++ b/src/main/java/fr/gravencyg/utils/CEvent.java @@ -0,0 +1,54 @@ +package fr.gravencyg.utils; + +import org.bukkit.Material; + +public enum CEvent { + + JOIN("onJoin", Material.PLAYER_HEAD, "Lorsqu'un joueur rejoint votre jeu", false, false), + START("onStart", Material.SPECTRAL_ARROW, "Lorsque le jeu demarre", false, true), + FINISH("onFinish", Material.DRAGON_EGG, "Lorsque le jeu s'arrete", false, true), + QUIT("onQuit", Material.RED_BED, "Lorsqu'un joueur quitte le jeu", false, false), + VOID("onFallVoid", Material.END_PORTAL_FRAME, "Lorsqu'un joueur tombe dans le vide", false, false), + + PLACE("onPlace", Material.STONE, "Lorsqu'un joueur place un bloc", true, false), + BREAK("onBreak", Material.GOLDEN_PICKAXE, "Lorsqu'un joueur casse un bloc", true, false), + WALK("onWalk", Material.IRON_BOOTS, "Lorsqu'un joueur marche sur un bloc", true, false), + + DEATH("onPlayerDeath", Material.SKELETON_SKULL, "Lorsqu'un joueur meurt", false, false), + KILL("onPlayerKill", Material.DIAMOND_SWORD, "Lorsqu'un joueur tue un autre joueur", false, false), + + RIGHT_CLICK("onRightClick", Material.TORCH, "Lorsqu'un joueur fais un clic droit", false, false), + LEFT_CLICK("onLeftClick", Material.LEVER, "Lorsqu'un joueur fais un clic gauche", false, false), + + LOOP("onLoop", Material.LEGACY_LEASH, "Repeter des évenements chaque seconde", false, true),; + + private String eventName; + + private String description; + + private boolean requireBlock; + + private boolean affectAllPlayers; + + private Material material; + + CEvent(String eventName, Material material, String description, boolean requireBlock, boolean affectAllPlayers){ + this.eventName = eventName; + this.description = description; + this.requireBlock = requireBlock; + this.material = material; + this.affectAllPlayers = affectAllPlayers; + } + + public String getDescription() { + return description; + } + + public boolean isAffectingAllPlayers() { return affectAllPlayers; } + + public String getEventName() { + return eventName; + } + + public Material getMaterial() { return material; } +} diff --git a/src/main/java/fr/gravencyg/utils/CLevel.java b/src/main/java/fr/gravencyg/utils/CLevel.java new file mode 100644 index 0000000..bd2f383 --- /dev/null +++ b/src/main/java/fr/gravencyg/utils/CLevel.java @@ -0,0 +1,165 @@ +package fr.gravencyg.utils; + +import java.util.*; + +public enum CLevel { + + LEVEL1(1, 0, PlotSize.NORMAL, Arrays.asList( + "§e/play§f pour jouer à un jeu", + "§e/plot§f pour obtenir une parcelle", + "§e/locations§f pour gérer les zones du jeu", + "§e/friend§f pour gerer vos co-constructeurs" + ), Arrays.asList( + "§6Bloc onEvent()§f pour gérer les évenements", + "§6Bloc Random()§f pour ajouter du hasard", + "§6Bloc TogglePvP()§f pour on/off le pvp", + "§6Bloc Eliminate()§f pour eliminer un joueur", + "§6Bloc Stuff()§f pour give des items", + "§6Bloc Clear()§f pour enlever les items", + "§6Bloc Teleport()§f pour tp un joueur" + )), + + LEVEL2(2, 15, PlotSize.NORMAL, Arrays.asList( + "§e/messages§f pour gérer les messages du jeu" + ), Arrays.asList( + "§6Bloc SendMessage()§f pour un message", + "§6Bloc SendTitle()§f pour fait un /tellraw", + "§6Bloc Wait()§f pour attendre 1 seconde" + )), + + LEVEL3(3, 50, PlotSize.NORMAL, Arrays.asList( + "§e/barriere§f pour obtenir bloc incassable", + "§e/gamemode§f pour changer de mode" + ), Arrays.asList( + "§6Bloc ChangeGameMode()§f pour /gm un joueur", + "§6Bloc ToggleFreeze()§f pour geler/degeler un joueur", + "§6Bloc ToggleFallDamage()§f pour on/off la chute" + )), + + LEVEL4(4, 75, PlotSize.NORMAL, Arrays.asList(), Arrays.asList( + "§6Bloc Wait()§f pour attendre 10s", + "§6Bloc ToggleBuild()§f pour on/off le build" + )), + + LEVEL5(5, 100, PlotSize.MEDIUM, Collections.emptyList(), Arrays.asList( + "§6Bloc RegenMap()§f pour regen la map", + "§6Bloc StopGame()§f pour stop le jeu", + "§6Bloc Win()§f pour forcer un gagnant" + )), + + LEVEL6(6, 150, PlotSize.MEDIUM, Collections.singletonList( + "§e/head§f pour obtenir une tête du joueur" + ), Arrays.asList( + "§6Bloc SetBlock()§f pour placer un bloc", + "§6Bloc RemoveBlock()§f pour retirer un bloc" + )), + + LEVEL7(7, 250, PlotSize.MEDIUM, Collections.emptyList(), Arrays.asList( + "§6Bloc SendPotionEffect()§f pour un effet de potion", + "§6Bloc ClearPotionEffects()§f pour retirer les effets" + )), + + LEVEL8(8, 500, PlotSize.MEDIUM, Collections.emptyList(), Arrays.asList( + "§f§lBloc Team()§f pour gérer les équipes", + "§6Bloc DropItem()§f pour loop un item" + )), + + LEVEL9(9, 750, PlotSize.MEDIUM, Collections.emptyList(), Arrays.asList( + "§6Bloc SendBossBar()§f pour message en bar de boss", + "§6Bloc ResetBossBar()§f pour supprimer les bars" + )), + + LEVEL10(10, 1200, PlotSize.BIG, Arrays.asList(), Collections.emptyList()), + + LEVEL11(11, 1500, PlotSize.BIG, Collections.emptyList(), Arrays.asList( + "§6Bloc SpawnMonster()§f pour spawn un monstre", + "§6Bloc KillMonster()§f pour tuer tout les monstres" + )), + + LEVEL12(12, 2000, PlotSize.BIG, Collections.emptyList(), Collections.singletonList( + "§6Bloc Restore()§f pour se heal() et feed()" + )), + + LEVEL13(13, 2500, PlotSize.BIG, Collections.emptyList(), Collections.singletonList( + "§6Bloc ToggleFly()§f pour on/off le fly du joueur" + )), + + LEVEL14(14, 3200, PlotSize.BIG, Collections.emptyList(), Collections.emptyList()), + LEVEL15(15, 5000, PlotSize.LARGE, Arrays.asList( + "§f§n/we§f pour l'accès au Mini Worldedit" + ), Collections.emptyList()), + + LEVEL16(16, 7000, PlotSize.LARGE, Collections.emptyList(), Arrays.asList( + "§6Bloc Glow()§f pour on/off l'effet glow" + )), + + LEVEL17(17, 8000, PlotSize.LARGE, Arrays.asList(), Arrays.asList()), + LEVEL18(18, 9000, PlotSize.LARGE, Arrays.asList(), Arrays.asList()), + LEVEL19(19, 10000, PlotSize.LARGE, Arrays.asList(), Arrays.asList()), + LEVEL20(20, 12000, PlotSize.MEGA, Arrays.asList(), Arrays.asList()), + + LEVEL21(21, 15000, PlotSize.MEGA, Arrays.asList(), Arrays.asList()), + LEVEL22(22, 17000, PlotSize.MEGA, Arrays.asList(), Arrays.asList()), + LEVEL23(23, 19000, PlotSize.MEGA, Arrays.asList(), Arrays.asList()), + LEVEL24(24, 21000, PlotSize.MEGA, Arrays.asList(), Arrays.asList()), + LEVEL25(25, 22000, PlotSize.EXTREME, Arrays.asList(), Arrays.asList()), + LEVEL26(26, 25000, PlotSize.EXTREME, Arrays.asList(), Arrays.asList()), + LEVEL27(27, 30000, PlotSize.EXTREME, Arrays.asList(), Arrays.asList()), + LEVEL28(28, 32000, PlotSize.EXTREME, Arrays.asList(), Arrays.asList()), + LEVEL29(29, 35000, PlotSize.EXTREME, Arrays.asList(), Arrays.asList()), + LEVEL30(30, 50000, PlotSize.GOD, Arrays.asList(), Arrays.asList()); + + static Map levels = new HashMap<>(); + + static { + int count = 0; + for(CLevel level : CLevel.values()) + { + levels.put(count, level); + count++; + } + } + + private List loreCommands; + private List loreActions; + + private int realLevel; + private int trophyMin; + private PlotSize plotSize; + + CLevel(int realLevel, int trophyMin, PlotSize plotSize, List loreCommands, List loreActions){ + this.realLevel = realLevel; + this.trophyMin = trophyMin; + this.loreCommands = loreCommands; + this.loreActions = loreActions; + this.plotSize = plotSize; + } + + public static CLevel findLevelByTrophy(int trophy){ + for(Map.Entry lvl : levels.entrySet()){ + if(trophy > lvl.getValue().getTrophy()) continue; + return lvl.getValue(); + } + return CLevel.LEVEL1; + } + + public int getRealLevel(){ + return realLevel; + } + + public int getTrophy(){ + return trophyMin; + } + + public List getCommands(){ + return loreCommands; + } + + public List getLoreActions(){ + return loreActions; + } + + public PlotSize getPlotSize() { + return plotSize; + } +} diff --git a/src/main/java/fr/gravencyg/utils/CRank.java b/src/main/java/fr/gravencyg/utils/CRank.java new file mode 100644 index 0000000..24578bf --- /dev/null +++ b/src/main/java/fr/gravencyg/utils/CRank.java @@ -0,0 +1,34 @@ +package fr.gravencyg.utils; + +import org.bukkit.ChatColor; + +public enum CRank { + JOUEUR(ChatColor.GRAY), + PREMIUM(ChatColor.GOLD), + YOUTUBEUR(ChatColor.RED), + BUILDER(ChatColor.BLUE), + MODÉRATION(ChatColor.BLUE), + ADMIN(ChatColor.RED); + + private ChatColor color; + + CRank(ChatColor color){ + this.color = color; + } + + public ChatColor getColor() { + return color; + } + + public Object getName() { return getSigle() + name().substring(1).toLowerCase(); } + + public Object getSigle() { return name().toUpperCase().substring(0, 1); } + + public boolean isNotMod() { + return this != CRank.MODÉRATION && this != CRank.ADMIN; + } + + public boolean isMod() { + return this == CRank.MODÉRATION || this == CRank.ADMIN; + } +} diff --git a/src/main/java/fr/gravencyg/utils/LocationUtils.java b/src/main/java/fr/gravencyg/utils/LocationUtils.java new file mode 100644 index 0000000..0246f15 --- /dev/null +++ b/src/main/java/fr/gravencyg/utils/LocationUtils.java @@ -0,0 +1,56 @@ +package fr.gravencyg.utils; + +import org.bukkit.Bukkit; +import org.bukkit.Location; + +public class LocationUtils { + + public static String fromLocToString(Location location) { + return location.getX() + "/" + location.getY() + "/" + location.getZ(); + } + + public static String fromLocToString2(Location location) { + return "x:" + (int)location.getX() + " y:" + (int)location.getY() + " z:" + (int)location.getZ() + " yaw:" + (int)location.getYaw() + " pitch:" + (int)location.getPitch(); + } + + public static Location fromString2toLoc(String ownerUUID, String string) { + String[] sloc = string.split(" "); + double x = Double.valueOf(sloc[0].replace("x:","")); + double y = Double.valueOf(sloc[1].replace("y:","")); + double z = Double.valueOf(sloc[2].replace("z:","")); + float yaw = Float.valueOf(sloc[3].replace("yaw:","")); + float pitch = Float.valueOf(sloc[4].replace("pitch:","")); + return new Location(Bukkit.getWorld(ownerUUID), x, y, z, yaw, pitch); + } + + public static Location fromStringToLoc(String uuid, String string) { + String[] sloc = string.split("/"); + double x = Double.valueOf(sloc[0]); + double y = Double.valueOf(sloc[1]); + double z = Double.valueOf(sloc[2]); + return new Location(Bukkit.getWorld(uuid), x, y, z); + } + + public static Location fromStringToLocComplete(String uuid, String string) { + String[] sloc = string.split("/"); + double x = Double.valueOf(sloc[0]); + double y = Double.valueOf(sloc[1]); + double z = Double.valueOf(sloc[2]); + float yaw = Float.valueOf(sloc[3]); + float pitch = Float.valueOf(sloc[4]); + return new Location(Bukkit.getWorld(uuid), x, y, z, yaw, pitch); + } + + public static String fromLocToStringComplete(Location location) { + return location.getX() + "/" + location.getY() + "/" + location.getZ() + + "/" + location.getYaw() + "/" + location.getPitch(); + } + + public static String fromStringToSimpleString(String uuid, String string) { + return fromLocToString2(fromStringToLocComplete(uuid, string)); + } + + public static String defaultSpawn() { + return "0/50/0/0/0"; + } +} diff --git a/src/main/java/fr/gravencyg/utils/PlotSize.java b/src/main/java/fr/gravencyg/utils/PlotSize.java new file mode 100644 index 0000000..c860ed2 --- /dev/null +++ b/src/main/java/fr/gravencyg/utils/PlotSize.java @@ -0,0 +1,28 @@ +package fr.gravencyg.utils; + +public enum PlotSize { + + NONE(0), + NORMAL(75), + MEDIUM(100), + BIG(150), + LARGE(200), + MEGA(250), + EXTREME(500), + GOD(1000); + + private int borderSize; + + PlotSize(int borderSize) + { + this.borderSize = borderSize; + } + + public int getBorderSize() { + return borderSize; + } + + public String getName(){ + return name().toUpperCase().charAt(0) + name().toLowerCase().substring(1); + } +} diff --git a/src/main/resources/plugin.yml b/src/main/resources/plugin.yml new file mode 100644 index 0000000..6788414 --- /dev/null +++ b/src/main/resources/plugin.yml @@ -0,0 +1,88 @@ +name: CYG +version: 0.0.7 +api-version: 1.13 +author: Graven +main: fr.gravencyg.CYG +commands: + plot: + description: Se teleporter vers sa parcelle + aliases: [pt] + locations: + aliases: [loc] + ev: + description: Obtenir un bloc d'evenement + actions: + description: Ouvrir le menu des actions + aliases: [ac, pa] + options: + aliases: [po] + setspawn: + setcode: + if: + description: Obtenir un bloc de condition + hub: + description: Se teleporter au Hub + messages: + description: Ouvrir le menu de gestion des messages + aliases: [msg] + play: + description: Jouer au jeu d'un joueur en ligne + aliases: [p] + pa: + description: Plot actions + po: + description: Plot options + pc: + description: Plot code + ptp: + description: Plot tp + rank: + description: rank + permission: rank.change + verifygame: + description: verify + fly: + description: Activer le vol doiseau + friend: + description: Invitez des amis sur votre parcelle + mute: + description: Mute un joueur + unmute: + description: Demute un joueur + kick: + description: Ejecte un joueur du serveur + freeze: + description: Gele un joueur du serveur + uuid: + description: Donne luuid du joueur + leave: + description: Quitter un jeu + barriere: + description: Barriere + we: + description: Mini worldedit pour les joueurs + ping: + description: Ping + head: + description: Donne la tete d'un joueur + gamemode: + description: Changement de gamemode + gamename: + refreshlevel: + permission: perm.full + forcelevel: + permission: perm.full + premium: + permission: shop.premium + discord: + description: Discord lien + shop: + description: Shop lien + twitter: + description: Twitter lien + hat: + description: Change hat + npc: + description: Gérer les personnages on joueurs + updateholo: + permission: update.holo \ No newline at end of file