测试版
This commit is contained in:
commit
b800ceea8d
40
.gitignore
vendored
Normal file
40
.gitignore
vendored
Normal file
|
@ -0,0 +1,40 @@
|
|||
target/
|
||||
!.mvn/wrapper/maven-wrapper.jar
|
||||
!**/src/main/**/target/
|
||||
!**/src/test/**/target/
|
||||
|
||||
### IntelliJ IDEA ###
|
||||
.idea/modules.xml
|
||||
.idea/jarRepositories.xml
|
||||
.idea/compiler.xml
|
||||
.idea/libraries/
|
||||
*.iws
|
||||
*.iml
|
||||
*.ipr
|
||||
|
||||
### Eclipse ###
|
||||
.apt_generated
|
||||
.classpath
|
||||
.factorypath
|
||||
.project
|
||||
.settings
|
||||
.springBeans
|
||||
.sts4-cache
|
||||
|
||||
### NetBeans ###
|
||||
/nbproject/private/
|
||||
/nbbuild/
|
||||
/dist/
|
||||
/nbdist/
|
||||
/.nb-gradle/
|
||||
build/
|
||||
!**/src/main/**/build/
|
||||
!**/src/test/**/build/
|
||||
|
||||
### VS Code ###
|
||||
.vscode/
|
||||
|
||||
### Mac OS ###
|
||||
.DS_Store
|
||||
/.idea/
|
||||
/out/
|
42
pom.xml
Normal file
42
pom.xml
Normal file
|
@ -0,0 +1,42 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<groupId>org.example</groupId>
|
||||
<artifactId>DemonJoinPro</artifactId>
|
||||
<version>1.0-SNAPSHOT</version>
|
||||
|
||||
<properties>
|
||||
<maven.compiler.source>8</maven.compiler.source>
|
||||
<maven.compiler.target>8</maven.compiler.target>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
</properties>
|
||||
|
||||
<repositories>
|
||||
<repository>
|
||||
<id>public-rpg</id>
|
||||
<url>https://repo.aurora-pixels.com/repository/public-rpg/</url>
|
||||
</repository>
|
||||
</repositories>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.spigotmc</groupId>
|
||||
<artifactId>spigot-api</artifactId>
|
||||
<version>1.12.2</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>me.clip.placeholderapi</groupId>
|
||||
<artifactId>PlaceholderAPI</artifactId>
|
||||
<version>2.9.2</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>me.Demon.DemonPlugin</groupId>
|
||||
<artifactId>DemonAPI</artifactId>
|
||||
<version>1.2.0</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
</project>
|
43
src/main/java/me/Demon/DemonJoinPro/Main.java
Normal file
43
src/main/java/me/Demon/DemonJoinPro/Main.java
Normal file
|
@ -0,0 +1,43 @@
|
|||
package me.Demon.DemonJoinPro;
|
||||
|
||||
import me.Demon.DemonJoinPro.listener.PlayerJoin;
|
||||
import me.Demon.DemonJoinPro.util.ConfigYml;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class Main extends JavaPlugin {
|
||||
|
||||
public static String pluginName = "DemonJoinPro";
|
||||
public static Main plugin;
|
||||
public static String prefix = "§7[§6战争领域§7] §f";
|
||||
public static List<String> Today_Motd = new ArrayList<>();
|
||||
|
||||
@Override
|
||||
public void onEnable() {
|
||||
plugin = this;
|
||||
saveDefaultConfig();
|
||||
ConfigYml.init(getConfig());
|
||||
Bukkit.getServer().getPluginManager().registerEvents(new PlayerJoin(), plugin);
|
||||
Bukkit.getConsoleSender().sendMessage("§6[" + Main.pluginName + "] §f插件加載成功!");
|
||||
Bukkit.getConsoleSender().sendMessage("§6[" + Main.pluginName + "] §f作者QQ:1763917516");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDisable() {
|
||||
Bukkit.getConsoleSender().sendMessage("§6[" + Main.pluginName + "] §f插件已安全卸載!");
|
||||
}
|
||||
|
||||
public boolean onCommand(CommandSender sender, Command cmd, String Command, String[] args) {
|
||||
if (Command.equalsIgnoreCase("djoin") && sender.isOp()) {
|
||||
if (args.length == 0) {
|
||||
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
67
src/main/java/me/Demon/DemonJoinPro/listener/PlayerJoin.java
Normal file
67
src/main/java/me/Demon/DemonJoinPro/listener/PlayerJoin.java
Normal file
|
@ -0,0 +1,67 @@
|
|||
package me.Demon.DemonJoinPro.listener;
|
||||
|
||||
import me.Demon.DemonJoinPro.Main;
|
||||
import me.Demon.DemonJoinPro.util.ConfigYml;
|
||||
import me.Demon.DemonPlugin.DemonAPI;
|
||||
import me.clip.placeholderapi.PlaceholderAPI;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.player.PlayerJoinEvent;
|
||||
import org.bukkit.event.player.PlayerQuitEvent;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class PlayerJoin implements Listener {
|
||||
|
||||
@EventHandler
|
||||
public void onjoin(PlayerJoinEvent e){
|
||||
Player player = e.getPlayer();
|
||||
e.setJoinMessage(null);
|
||||
if (ConfigYml.firstjoin_enabled){
|
||||
if (!player.hasPlayedBefore()) {
|
||||
String message = ConfigYml.firstjoin_actions;
|
||||
message = PlaceholderAPI.setPlaceholders(player, message);
|
||||
Bukkit.broadcastMessage(message.replace("&", "§"));
|
||||
|
||||
Bukkit.getScheduler().runTaskLater(Main.plugin, () -> {
|
||||
player.performCommand("spawn");
|
||||
}, (long) 10L);
|
||||
}
|
||||
}
|
||||
|
||||
if(ConfigYml.motds_enabled){
|
||||
if(!Main.Today_Motd.contains(player.getName())) {
|
||||
Main.Today_Motd.add(player.getName());
|
||||
List<String> motds_List = ConfigYml.motds_actions;
|
||||
for (String message : motds_List) {
|
||||
player.sendMessage(message.replace("&", "§"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(ConfigYml.join_enabled){
|
||||
String message = ConfigYml.join_actions;
|
||||
message = PlaceholderAPI.setPlaceholders(player, message);
|
||||
for (Player all : Bukkit.getOnlinePlayers()) {
|
||||
DemonAPI.sendActionBar(all,message.replace("&", "§"));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onLeave(PlayerQuitEvent e){
|
||||
Player player = e.getPlayer();
|
||||
e.setQuitMessage(null);
|
||||
if(ConfigYml.leave_enabled){
|
||||
String message = ConfigYml.leave_actions;
|
||||
message = PlaceholderAPI.setPlaceholders(player, message);
|
||||
for (Player all : Bukkit.getOnlinePlayers()) {
|
||||
DemonAPI.sendActionBar(all,message.replace("&", "§"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
62
src/main/java/me/Demon/DemonJoinPro/util/ConfigYml.java
Normal file
62
src/main/java/me/Demon/DemonJoinPro/util/ConfigYml.java
Normal file
|
@ -0,0 +1,62 @@
|
|||
package me.Demon.DemonJoinPro.util;
|
||||
|
||||
import org.bukkit.configuration.file.FileConfiguration;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class ConfigYml {
|
||||
|
||||
private static FileConfiguration yml;
|
||||
|
||||
public static boolean join_enabled;
|
||||
public static boolean leave_enabled;
|
||||
public static boolean firstjoin_enabled;
|
||||
public static boolean motds_enabled;
|
||||
public static String join_actions;
|
||||
public static String leave_actions;
|
||||
public static String firstjoin_actions;
|
||||
public static List<String> motds_actions;
|
||||
|
||||
|
||||
public static void init(FileConfiguration config) {
|
||||
yml = config;
|
||||
join_enabled = yml.getBoolean("join.enabled");
|
||||
if(join_enabled){
|
||||
String message = yml.getString("join.actions");
|
||||
if(message != null) {
|
||||
join_actions = message.replace("&", "§");
|
||||
}else{
|
||||
join_actions = "";
|
||||
}
|
||||
}
|
||||
leave_enabled = yml.getBoolean("leave.enabled");
|
||||
if(leave_enabled){
|
||||
String message = yml.getString("leave.actions");
|
||||
if(message != null) {
|
||||
leave_actions = message.replace("&", "§");
|
||||
}else{
|
||||
leave_actions = "";
|
||||
}
|
||||
}
|
||||
firstjoin_enabled = yml.getBoolean("firstjoin.enabled");
|
||||
if(firstjoin_enabled){
|
||||
String message = yml.getString("firstjoin.actions");
|
||||
if(message != null) {
|
||||
firstjoin_actions = message.replace("&", "§");
|
||||
}else{
|
||||
firstjoin_actions = "";
|
||||
}
|
||||
}
|
||||
motds_enabled = yml.getBoolean("motds.enabled");
|
||||
if(motds_enabled){
|
||||
String message = yml.getString("motds.actions");
|
||||
if(message != null) {
|
||||
motds_actions = yml.getStringList("motds.actions");
|
||||
}else{
|
||||
motds_actions = new ArrayList<>();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
32
src/main/resources/config.yml
Normal file
32
src/main/resources/config.yml
Normal file
|
@ -0,0 +1,32 @@
|
|||
join:
|
||||
enabled: true
|
||||
actions: '§7[§a§L●§7] %vault_prefix%§f%player_name%'
|
||||
leave:
|
||||
enabled: true
|
||||
actions: '§7[§c§L●§7] %vault_prefix%§f%player_name%'
|
||||
firstjoin:
|
||||
enabled: true
|
||||
actions:
|
||||
- '§7[§c§L迎新公告§7] §f欢迎 %vault_prefix%§f%player_name% §f第一次进入帝国战争Mix伺服器~!'
|
||||
motds:
|
||||
enabled: true
|
||||
actions:
|
||||
- '§6§l帝国战争§C§lMix'
|
||||
- '§7'
|
||||
- '§7*欢迎忧患帝国战争服务器。'
|
||||
- '§7'
|
||||
- '§7服务器规则:'
|
||||
- '§c1.禁止在伺服器里向任何玩家乞讨'
|
||||
- '§c2.禁止在服务器引起骂战/嘴炮'
|
||||
- '§c3.禁止使用外挂端进行游玩'
|
||||
- '§c4.禁止抢/偷其他玩家的物品'
|
||||
- '§c5.禁止发现Bug而没有回报给管理员'
|
||||
- '§c6.禁止在伺服器里宣传其他伺服器'
|
||||
- '§c7.禁止在别家服务器宣传我们服务器'
|
||||
- '§c8.禁止开分身账号刷取物品'
|
||||
- '§c9.禁止在服务器里制作连闪器'
|
||||
- '§c10.禁止在副本里刻意抢他人怪物'
|
||||
- '§c11.禁止骚扰其他玩家及乱杀其他玩家'
|
||||
- '§4§l如违反以上规则,违重者永久ban处理.'
|
||||
- '§c'
|
||||
- '§7*有任何问题可以找在线管理员。'
|
7
src/main/resources/plugin.yml
Normal file
7
src/main/resources/plugin.yml
Normal file
|
@ -0,0 +1,7 @@
|
|||
name: DemonJoinPro
|
||||
main: me.Demon.DemonJoinPro.Main
|
||||
version: 1.0.1
|
||||
depend:
|
||||
- PlaceholderAPI
|
||||
commands:
|
||||
djoin:
|
Loading…
Reference in New Issue
Block a user