Initial commit
This commit is contained in:
commit
a8093f071c
2
.gitignore
vendored
Normal file
2
.gitignore
vendored
Normal file
@ -0,0 +1,2 @@
|
||||
# Project exclude paths
|
||||
/out/
|
3
.idea/.gitignore
generated
vendored
Normal file
3
.idea/.gitignore
generated
vendored
Normal file
@ -0,0 +1,3 @@
|
||||
# Default ignored files
|
||||
/shelf/
|
||||
/workspace.xml
|
1
.idea/.name
generated
Normal file
1
.idea/.name
generated
Normal file
@ -0,0 +1 @@
|
||||
Lobby control.iml
|
9
.idea/artifacts/Lobby_control_jar.xml
generated
Normal file
9
.idea/artifacts/Lobby_control_jar.xml
generated
Normal file
@ -0,0 +1,9 @@
|
||||
<component name="ArtifactManager">
|
||||
<artifact type="jar" name="Lobby control:jar">
|
||||
<output-path>$PROJECT_DIR$/../Server/plugins</output-path>
|
||||
<root id="archive" name="Lobby control.jar">
|
||||
<element id="module-output" name="Lobby control" />
|
||||
<element id="extracted-dir" path="$PROJECT_DIR$/../Dependencies/spigot-api-1.16.5.jar" path-in-jar="/" />
|
||||
</root>
|
||||
</artifact>
|
||||
</component>
|
11
.idea/misc.xml
generated
Normal file
11
.idea/misc.xml
generated
Normal file
@ -0,0 +1,11 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="EntryPointsManager">
|
||||
<list size="1">
|
||||
<item index="0" class="java.lang.String" itemvalue="org.bukkit.event.EventHandler" />
|
||||
</list>
|
||||
</component>
|
||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" default="true" project-jdk-name="1.8 (2)" project-jdk-type="JavaSDK">
|
||||
<output url="file://$PROJECT_DIR$/out" />
|
||||
</component>
|
||||
</project>
|
8
.idea/modules.xml
generated
Normal file
8
.idea/modules.xml
generated
Normal file
@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ProjectModuleManager">
|
||||
<modules>
|
||||
<module fileurl="file://$PROJECT_DIR$/Lobby control.iml" filepath="$PROJECT_DIR$/Lobby control.iml" />
|
||||
</modules>
|
||||
</component>
|
||||
</project>
|
29
Lobby control.iml
Normal file
29
Lobby control.iml
Normal file
@ -0,0 +1,29 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module type="JAVA_MODULE" version="4">
|
||||
<component name="FacetManager">
|
||||
<facet type="minecraft" name="Minecraft">
|
||||
<configuration>
|
||||
<autoDetectTypes>
|
||||
<platformType>SPIGOT</platformType>
|
||||
</autoDetectTypes>
|
||||
</configuration>
|
||||
</facet>
|
||||
</component>
|
||||
<component name="NewModuleRootManager" inherit-compiler-output="true">
|
||||
<exclude-output />
|
||||
<content url="file://$MODULE_DIR$">
|
||||
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
|
||||
</content>
|
||||
<orderEntry type="inheritedJdk" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
<orderEntry type="module-library" exported="">
|
||||
<library>
|
||||
<CLASSES>
|
||||
<root url="jar://$MODULE_DIR$/../Dependencies/spigot-api-1.16.5.jar!/" />
|
||||
</CLASSES>
|
||||
<JAVADOC />
|
||||
<SOURCES />
|
||||
</library>
|
||||
</orderEntry>
|
||||
</component>
|
||||
</module>
|
28
src/com/lubek/lobbycontrol/cmds/commands.java
Normal file
28
src/com/lubek/lobbycontrol/cmds/commands.java
Normal file
@ -0,0 +1,28 @@
|
||||
package com.lubek.lobbycontrol.cmds;
|
||||
|
||||
import com.lubek.lobbycontrol.files.config;
|
||||
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;
|
||||
import org.bukkit.scoreboard.*;
|
||||
|
||||
public class commands implements CommandExecutor {
|
||||
@Override
|
||||
public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
|
||||
String prefix_lc = ChatColor.BLUE +"[Lobby Control] ";
|
||||
if (!(sender instanceof Player)) {
|
||||
sender.sendMessage(prefix_lc+"only players can use this command");
|
||||
return true;
|
||||
}
|
||||
Player player = (Player) sender;
|
||||
if (cmd.getName().equalsIgnoreCase("reloadlc")) {
|
||||
config.reload();
|
||||
}
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
66
src/com/lubek/lobbycontrol/events/lobbycontrolevents.java
Normal file
66
src/com/lubek/lobbycontrol/events/lobbycontrolevents.java
Normal file
@ -0,0 +1,66 @@
|
||||
package com.lubek.lobbycontrol.events;
|
||||
|
||||
import com.lubek.lobbycontrol.files.config;
|
||||
import com.lubek.lobbycontrol.files.jumps;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.Particle;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.player.PlayerChangedWorldEvent;
|
||||
import org.bukkit.event.player.PlayerJoinEvent;
|
||||
import org.bukkit.event.player.PlayerMoveEvent;
|
||||
import org.bukkit.potion.PotionEffect;
|
||||
import org.bukkit.potion.PotionEffectType;
|
||||
import org.bukkit.scoreboard.*;
|
||||
import com.lubek.lobbycontrol.files.scoreboard;
|
||||
import java.util.List;
|
||||
|
||||
public class lobbycontrolevents implements Listener {
|
||||
@EventHandler
|
||||
public static void OnPlayerJoin(PlayerJoinEvent event) {
|
||||
Player player = event.getPlayer();
|
||||
jumps.get().addDefault(player.getName(),0);
|
||||
jumps.get().options().copyDefaults(true);
|
||||
jumps.save();
|
||||
scoreboard.resetscoreboard(player);
|
||||
}
|
||||
@EventHandler
|
||||
public static void onWorldChange(PlayerChangedWorldEvent event) {
|
||||
scoreboard.resetscoreboard(event.getPlayer());
|
||||
}
|
||||
@EventHandler
|
||||
public static void onPlayerWalk(PlayerMoveEvent event) {
|
||||
Player player = event.getPlayer();
|
||||
PotionEffect potionEffect = new PotionEffect(PotionEffectType.JUMP, 25, 3);
|
||||
List<String> whitelist = config.get().getStringList("Whitelist");
|
||||
int x = player.getLocation().getBlockX();
|
||||
int y = player.getLocation().getBlockY();
|
||||
int z = player.getLocation().getBlockZ();
|
||||
Material block = player.getWorld().getBlockAt(x,y-1,z).getType();
|
||||
if(block.equals(Material.BLACK_WOOL)) {
|
||||
for(int i = 0; i < whitelist.size(); i++) {
|
||||
if (player.getWorld().getName().equals(whitelist.get(i))) {
|
||||
|
||||
player.addPotionEffect(potionEffect);
|
||||
} else {
|
||||
if(config.get().getBoolean("Debug")) {
|
||||
player.sendMessage("Else world index: "+i);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
if(player.getWorld().getBlockAt(x,y-2,z).getType().equals(Material.BLACK_WOOL)&& !player.isOnGround() && config.get().getBoolean("Particles")) {
|
||||
player.getWorld().spawnParticle(Particle.TOTEM,x,y,z,5);
|
||||
jumps.get().set(player.getName(),jumps.get().getInt(player.getName())+1);
|
||||
jumps.get().options().copyDefaults(true);
|
||||
jumps.save();
|
||||
scoreboard.resetscoreboard(player);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
43
src/com/lubek/lobbycontrol/files/config.java
Normal file
43
src/com/lubek/lobbycontrol/files/config.java
Normal file
@ -0,0 +1,43 @@
|
||||
package com.lubek.lobbycontrol.files;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.configuration.file.FileConfiguration;
|
||||
import org.bukkit.configuration.file.YamlConfiguration;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
|
||||
public class config {
|
||||
private static File file;
|
||||
private static FileConfiguration customFile;
|
||||
//finds or generates the custom config file
|
||||
public static void setup(){
|
||||
file = new File(Bukkit.getServer().getPluginManager().getPlugin("LobbyControl").getDataFolder(), "config.yml");
|
||||
if(!file.exists()){
|
||||
try {
|
||||
file.createNewFile();
|
||||
}
|
||||
catch (IOException e) {
|
||||
//owww
|
||||
}
|
||||
}
|
||||
customFile = YamlConfiguration.loadConfiguration(file);
|
||||
}
|
||||
|
||||
public static FileConfiguration get(){
|
||||
return customFile;
|
||||
}
|
||||
|
||||
public static void save() {
|
||||
try {
|
||||
customFile.save(file);
|
||||
}
|
||||
catch (IOException e) {
|
||||
System.out.println("Couldnt save file");
|
||||
}
|
||||
}
|
||||
|
||||
public static void reload(){
|
||||
customFile = YamlConfiguration.loadConfiguration(file);
|
||||
}
|
||||
}
|
43
src/com/lubek/lobbycontrol/files/jumps.java
Normal file
43
src/com/lubek/lobbycontrol/files/jumps.java
Normal file
@ -0,0 +1,43 @@
|
||||
package com.lubek.lobbycontrol.files;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.configuration.file.FileConfiguration;
|
||||
import org.bukkit.configuration.file.YamlConfiguration;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
|
||||
public class jumps {
|
||||
private static File file;
|
||||
private static FileConfiguration customFile;
|
||||
//finds or generates the custom config file
|
||||
public static void setup(){
|
||||
file = new File(Bukkit.getServer().getPluginManager().getPlugin("LobbyControl").getDataFolder(), "jumps.yml");
|
||||
if(!file.exists()){
|
||||
try {
|
||||
file.createNewFile();
|
||||
}
|
||||
catch (IOException e) {
|
||||
//owww
|
||||
}
|
||||
}
|
||||
customFile = YamlConfiguration.loadConfiguration(file);
|
||||
}
|
||||
|
||||
public static FileConfiguration get(){
|
||||
return customFile;
|
||||
}
|
||||
|
||||
public static void save() {
|
||||
try {
|
||||
customFile.save(file);
|
||||
}
|
||||
catch (IOException e) {
|
||||
System.out.println("Couldnt save file");
|
||||
}
|
||||
}
|
||||
|
||||
public static void reload(){
|
||||
customFile = YamlConfiguration.loadConfiguration(file);
|
||||
}
|
||||
}
|
37
src/com/lubek/lobbycontrol/files/scoreboard.java
Normal file
37
src/com/lubek/lobbycontrol/files/scoreboard.java
Normal file
@ -0,0 +1,37 @@
|
||||
package com.lubek.lobbycontrol.files;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.scoreboard.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class scoreboard {
|
||||
|
||||
public static void resetscoreboard(Player player) {
|
||||
List<String> scoreboardworlds = config.get().getStringList("ScoreboardWorld");
|
||||
for(int i = 0; i < scoreboardworlds.size(); i++) {
|
||||
if (player.getWorld().getName().equals(scoreboardworlds.get(i))) {
|
||||
|
||||
jumps.get().addDefault(player.getName(), 0);
|
||||
jumps.get().options().copyDefaults(true);
|
||||
jumps.save();
|
||||
ScoreboardManager m = Bukkit.getScoreboardManager();
|
||||
Scoreboard b = m.getNewScoreboard();
|
||||
Objective o = b.registerNewObjective("Gold", "");
|
||||
o.setDisplaySlot(DisplaySlot.SIDEBAR);
|
||||
o.setDisplayName(ChatColor.GREEN + "[LUBEK SERVER]");
|
||||
Score Przywitanie = o.getScore("Witaj Drogi graczu");
|
||||
Score plr = o.getScore("Nazwa: " + player.getName());
|
||||
|
||||
Score diamond = o.getScore("Skoków: " + com.lubek.lobbycontrol.files.jumps.get().getInt(player.getName()));
|
||||
Przywitanie.setScore(9);
|
||||
plr.setScore(8);
|
||||
diamond.setScore(7);
|
||||
|
||||
player.setScoreboard(b);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
45
src/com/lubek/lobbycontrol/lobbycontrol.java
Normal file
45
src/com/lubek/lobbycontrol/lobbycontrol.java
Normal file
@ -0,0 +1,45 @@
|
||||
package com.lubek.lobbycontrol;
|
||||
import com.lubek.lobbycontrol.cmds.commands;
|
||||
import com.lubek.lobbycontrol.events.lobbycontrolevents;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.plugin.Plugin;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.List;
|
||||
|
||||
public class lobbycontrol extends JavaPlugin {
|
||||
@Override
|
||||
public void onEnable() {
|
||||
com.lubek.lobbycontrol.stats.lcstats.setup();
|
||||
commands allcommands = new commands();
|
||||
getServer().getPluginManager().registerEvents(new lobbycontrolevents(), this);
|
||||
getCommand("reloadlc").setExecutor(allcommands);
|
||||
getServer().getConsoleSender().sendMessage(ChatColor.GREEN+"[Lobby Control]: Plugin started");
|
||||
getConfig().options().copyDefaults();
|
||||
saveDefaultConfig();
|
||||
|
||||
com.lubek.lobbycontrol.files.config.setup();
|
||||
com.lubek.lobbycontrol.files.config.get().options().copyDefaults(true);
|
||||
Plugin[] Plugins = getServer().getPluginManager().getPlugins();
|
||||
for(int i = 0; i < Plugins.length; i++) {
|
||||
if (Plugins[i].getName().equals("Sandbox")) {
|
||||
com.lubek.lobbycontrol.files.config.get().addDefault("SandboxWorld","World");
|
||||
com.lubek.lobbycontrol.files.config.get().addDefault("Sandbox-gold-X",86);
|
||||
com.lubek.lobbycontrol.files.config.get().addDefault("Sandbox-gold-Y",222);
|
||||
com.lubek.lobbycontrol.files.config.get().addDefault("Sandbox-gold-Z",000);
|
||||
com.lubek.lobbycontrol.files.config.get().addDefault("Sandbox-diamond-X",86);
|
||||
com.lubek.lobbycontrol.files.config.get().addDefault("Sandbox-diamond-Y",222);
|
||||
com.lubek.lobbycontrol.files.config.get().addDefault("Sandbox-diamond-Z",000);
|
||||
}
|
||||
}
|
||||
com.lubek.lobbycontrol.files.config.save();
|
||||
com.lubek.lobbycontrol.files.jumps.setup();
|
||||
com.lubek.lobbycontrol.files.jumps.get().options().copyDefaults(true);
|
||||
com.lubek.lobbycontrol.files.jumps.save();
|
||||
|
||||
}
|
||||
public void onDisable() {
|
||||
getServer().getConsoleSender().sendMessage(ChatColor.RED+"[Lobby Control]: Plugin disabled");
|
||||
}
|
||||
}
|
7
src/com/lubek/lobbycontrol/stats/lcstats.java
Normal file
7
src/com/lubek/lobbycontrol/stats/lcstats.java
Normal file
@ -0,0 +1,7 @@
|
||||
package com.lubek.lobbycontrol.stats;
|
||||
|
||||
public class lcstats {
|
||||
public static void setup() {
|
||||
int jumps;
|
||||
}
|
||||
}
|
22
src/config.yml
Normal file
22
src/config.yml
Normal file
@ -0,0 +1,22 @@
|
||||
|
||||
# bbbbbbbb
|
||||
# LLLLLLLLLLL b::::::b kkkkkkkk
|
||||
# L:::::::::L b::::::b k::::::k
|
||||
# L:::::::::L b::::::b k::::::k
|
||||
# LL:::::::LL b:::::b k::::::k
|
||||
# L:::::L uuuuuu uuuuuu b:::::bbbbbbbbb eeeeeeeeeeee k:::::k kkkkkkk
|
||||
# L:::::L u::::u u::::u b::::::::::::::bb ee::::::::::::ee k:::::k k:::::k
|
||||
# L:::::L u::::u u::::u b::::::::::::::::b e::::::eeeee:::::eek:::::k k:::::k
|
||||
# L:::::L u::::u u::::u b:::::bbbbb:::::::be::::::e e:::::ek:::::k k:::::k
|
||||
# L:::::L u::::u u::::u b:::::b b::::::be:::::::eeeee::::::ek::::::k:::::k
|
||||
# L:::::L u::::u u::::u b:::::b b:::::be:::::::::::::::::e k:::::::::::k
|
||||
# L:::::L u::::u u::::u b:::::b b:::::be::::::eeeeeeeeeee k:::::::::::k
|
||||
# L:::::L LLLLLLu:::::uuuu:::::u b:::::b b:::::be:::::::e k::::::k:::::k
|
||||
# LL:::::::LLLLLLLLL:::::Lu:::::::::::::::uub:::::bbbbbb::::::be::::::::e k::::::k k:::::k
|
||||
# L::::::::::::::::::::::L u:::::::::::::::ub::::::::::::::::b e::::::::eeeeeeee k::::::k k:::::k
|
||||
# L::::::::::::::::::::::L uu::::::::uu:::ub:::::::::::::::b ee:::::::::::::e k::::::k k:::::k
|
||||
# LLLLLLLLLLLLLLLLLLLLLLLL uuuuuuuu uuuubbbbbbbbbbbbbbbb eeeeeeeeeeeeee kkkkkkkk kkkkkkk
|
||||
Whitelist: ['EXAMPLE','EXAMPLE']
|
||||
Particles: True
|
||||
ScoreboardWorld: ['world','world']
|
||||
Debug: False
|
12
src/plugin.yml
Normal file
12
src/plugin.yml
Normal file
@ -0,0 +1,12 @@
|
||||
name: LobbyControl
|
||||
main: com.lubek.lobbycontrol.lobbycontrol
|
||||
version: 1.1
|
||||
author: lubek
|
||||
api-version: 1.16
|
||||
commands:
|
||||
reloadlc:
|
||||
description: Removes world from blacklist
|
||||
usage: /<command> <args>
|
||||
permission: lc.rmworld
|
||||
aliases:
|
||||
- rlc
|
Loading…
x
Reference in New Issue
Block a user