mirror of
https://e.coding.net/circlecloud/EquipManager.git
synced 2024-12-04 12:38:48 +00:00
init project...
Signed-off-by: 502647092 <jtb1@163.com>
This commit is contained in:
commit
ebe73712cc
31
.classpath
Normal file
31
.classpath
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<classpath>
|
||||||
|
<classpathentry kind="src" output="target/classes" path="src/main/java">
|
||||||
|
<attributes>
|
||||||
|
<attribute name="optional" value="true"/>
|
||||||
|
<attribute name="maven.pomderived" value="true"/>
|
||||||
|
</attributes>
|
||||||
|
</classpathentry>
|
||||||
|
<classpathentry excluding="**" kind="src" output="target/classes" path="src/main/resources">
|
||||||
|
<attributes>
|
||||||
|
<attribute name="maven.pomderived" value="true"/>
|
||||||
|
</attributes>
|
||||||
|
</classpathentry>
|
||||||
|
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8">
|
||||||
|
<attributes>
|
||||||
|
<attribute name="maven.pomderived" value="true"/>
|
||||||
|
</attributes>
|
||||||
|
</classpathentry>
|
||||||
|
<classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
|
||||||
|
<attributes>
|
||||||
|
<attribute name="maven.pomderived" value="true"/>
|
||||||
|
</attributes>
|
||||||
|
</classpathentry>
|
||||||
|
<classpathentry kind="src" output="target/test-classes" path="src/test/java">
|
||||||
|
<attributes>
|
||||||
|
<attribute name="optional" value="true"/>
|
||||||
|
<attribute name="maven.pomderived" value="true"/>
|
||||||
|
</attributes>
|
||||||
|
</classpathentry>
|
||||||
|
<classpathentry kind="output" path="target/classes"/>
|
||||||
|
</classpath>
|
38
.gitignore
vendored
Normal file
38
.gitignore
vendored
Normal file
@ -0,0 +1,38 @@
|
|||||||
|
# Eclipse stuff
|
||||||
|
/.settings
|
||||||
|
|
||||||
|
# netbeans
|
||||||
|
/nbproject
|
||||||
|
|
||||||
|
# we use maven!
|
||||||
|
/build.xml
|
||||||
|
|
||||||
|
# maven
|
||||||
|
/target
|
||||||
|
/repo
|
||||||
|
|
||||||
|
# vim
|
||||||
|
.*.sw[a-p]
|
||||||
|
|
||||||
|
# various other potential build files
|
||||||
|
/build
|
||||||
|
/bin
|
||||||
|
/dist
|
||||||
|
/manifest.mf
|
||||||
|
|
||||||
|
/world
|
||||||
|
|
||||||
|
# Mac filesystem dust
|
||||||
|
*.DS_Store
|
||||||
|
|
||||||
|
# intellij
|
||||||
|
*.iml
|
||||||
|
*.ipr
|
||||||
|
*.iws
|
||||||
|
.idea/
|
||||||
|
|
||||||
|
# Project Stuff
|
||||||
|
/src/main/resources/Soulbound
|
||||||
|
|
||||||
|
# Atlassian Stuff
|
||||||
|
/atlassian-ide-plugin.xml
|
23
.project
Normal file
23
.project
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<projectDescription>
|
||||||
|
<name>EquipManager</name>
|
||||||
|
<comment></comment>
|
||||||
|
<projects>
|
||||||
|
</projects>
|
||||||
|
<buildSpec>
|
||||||
|
<buildCommand>
|
||||||
|
<name>org.eclipse.jdt.core.javabuilder</name>
|
||||||
|
<arguments>
|
||||||
|
</arguments>
|
||||||
|
</buildCommand>
|
||||||
|
<buildCommand>
|
||||||
|
<name>org.eclipse.m2e.core.maven2Builder</name>
|
||||||
|
<arguments>
|
||||||
|
</arguments>
|
||||||
|
</buildCommand>
|
||||||
|
</buildSpec>
|
||||||
|
<natures>
|
||||||
|
<nature>org.eclipse.jdt.core.javanature</nature>
|
||||||
|
<nature>org.eclipse.m2e.core.maven2Nature</nature>
|
||||||
|
</natures>
|
||||||
|
</projectDescription>
|
98
pom.xml
Normal file
98
pom.xml
Normal file
@ -0,0 +1,98 @@
|
|||||||
|
<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>cn.citycraft</groupId>
|
||||||
|
<artifactId>EquipManager</artifactId>
|
||||||
|
<version>1.0</version>
|
||||||
|
<name>EquipManager</name>
|
||||||
|
<description>装备权限管理</description>
|
||||||
|
<build>
|
||||||
|
<finalName>${project.name}</finalName>
|
||||||
|
<resources>
|
||||||
|
<resource>
|
||||||
|
<directory>src/main/resources</directory>
|
||||||
|
<filtering>true</filtering>
|
||||||
|
</resource>
|
||||||
|
</resources>
|
||||||
|
<plugins>
|
||||||
|
<plugin>
|
||||||
|
<artifactId>maven-compiler-plugin</artifactId>
|
||||||
|
<version>3.1</version>
|
||||||
|
<configuration>
|
||||||
|
<source>1.8</source>
|
||||||
|
<target>1.8</target>
|
||||||
|
</configuration>
|
||||||
|
</plugin>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
|
<artifactId>maven-shade-plugin</artifactId>
|
||||||
|
<version>2.3</version>
|
||||||
|
<configuration>
|
||||||
|
<createDependencyReducedPom>false</createDependencyReducedPom>
|
||||||
|
<minimizeJar>true</minimizeJar>
|
||||||
|
<artifactSet>
|
||||||
|
<includes>
|
||||||
|
<include>cn.citycraft:PluginHelper</include>
|
||||||
|
<include>org.mcstats.*:*</include>
|
||||||
|
</includes>
|
||||||
|
</artifactSet>
|
||||||
|
<relocations>
|
||||||
|
<relocation>
|
||||||
|
<pattern>org.mcstats</pattern>
|
||||||
|
<shadedPattern>${project.groupId}.${project.artifactId}.mcstats</shadedPattern>
|
||||||
|
</relocation>
|
||||||
|
<relocation>
|
||||||
|
<pattern>cn.citycraft.PluginHelper</pattern>
|
||||||
|
<shadedPattern>${project.groupId}.${project.artifactId}</shadedPattern>
|
||||||
|
</relocation>
|
||||||
|
</relocations>
|
||||||
|
</configuration>
|
||||||
|
<executions>
|
||||||
|
<execution>
|
||||||
|
<phase>package</phase>
|
||||||
|
<goals>
|
||||||
|
<goal>shade</goal>
|
||||||
|
</goals>
|
||||||
|
</execution>
|
||||||
|
</executions>
|
||||||
|
</plugin>
|
||||||
|
</plugins>
|
||||||
|
</build>
|
||||||
|
<repositories>
|
||||||
|
<repository>
|
||||||
|
<id>spigot-repo</id>
|
||||||
|
<url>https://hub.spigotmc.org/nexus/content/groups/public/</url>
|
||||||
|
</repository>
|
||||||
|
<repository>
|
||||||
|
<id>citycraft-repo</id>
|
||||||
|
<url>http://ci.citycraft.cn:8800/jenkins/plugin/repository/everything/</url>
|
||||||
|
</repository>
|
||||||
|
<repository>
|
||||||
|
<id>Plugin Metrics</id>
|
||||||
|
<url>http://repo.mcstats.org/content/repositories/public</url>
|
||||||
|
</repository>
|
||||||
|
</repositories>
|
||||||
|
<dependencies>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.spigotmc</groupId>
|
||||||
|
<artifactId>spigot-api</artifactId>
|
||||||
|
<type>jar</type>
|
||||||
|
<version>1.8.3-R0.1-SNAPSHOT</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>cn.citycraft</groupId>
|
||||||
|
<artifactId>PluginHelper</artifactId>
|
||||||
|
<type>jar</type>
|
||||||
|
<version>1.0</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.mcstats.bukkit</groupId>
|
||||||
|
<artifactId>metrics</artifactId>
|
||||||
|
<version>R8-SNAPSHOT</version>
|
||||||
|
<scope>compile</scope>
|
||||||
|
</dependency>
|
||||||
|
</dependencies>
|
||||||
|
<properties>
|
||||||
|
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||||
|
</properties>
|
||||||
|
</project>
|
31
src/main/java/cn/citycraft/EquipManager/EquipManager.java
Normal file
31
src/main/java/cn/citycraft/EquipManager/EquipManager.java
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
package cn.citycraft.EquipManager;
|
||||||
|
|
||||||
|
import org.bukkit.configuration.file.FileConfiguration;
|
||||||
|
import org.bukkit.plugin.PluginManager;
|
||||||
|
import org.bukkit.plugin.java.JavaPlugin;
|
||||||
|
|
||||||
|
import cn.citycraft.EquipManager.listen.PlayerListen;
|
||||||
|
import cn.citycraft.PluginHelper.config.FileConfig;
|
||||||
|
|
||||||
|
public class EquipManager extends JavaPlugin {
|
||||||
|
FileConfig config;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public FileConfiguration getConfig() {
|
||||||
|
if (config == null)
|
||||||
|
config = new FileConfig(this);
|
||||||
|
return config;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onDisable() {
|
||||||
|
super.onDisable();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onEnable() {
|
||||||
|
PluginManager pm = this.getServer().getPluginManager();
|
||||||
|
pm.registerEvents(new PlayerListen(), this);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,20 @@
|
|||||||
|
package cn.citycraft.EquipManager.listen;
|
||||||
|
|
||||||
|
import org.bukkit.event.EventHandler;
|
||||||
|
import org.bukkit.event.Listener;
|
||||||
|
import org.bukkit.event.player.PlayerJoinEvent;
|
||||||
|
import org.bukkit.event.player.PlayerQuitEvent;
|
||||||
|
|
||||||
|
import cn.citycraft.EquipManager.runnable.TaskManager;
|
||||||
|
|
||||||
|
public class PlayerListen implements Listener {
|
||||||
|
@EventHandler
|
||||||
|
public void onJoin(PlayerJoinEvent e) {
|
||||||
|
TaskManager.add(e.getPlayer());
|
||||||
|
}
|
||||||
|
|
||||||
|
@EventHandler
|
||||||
|
public void onQuit(PlayerQuitEvent e) {
|
||||||
|
TaskManager.remove(e.getPlayer());
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,30 @@
|
|||||||
|
package cn.citycraft.EquipManager.runnable;
|
||||||
|
|
||||||
|
import org.bukkit.Material;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
|
||||||
|
public class ArmorHandlerTask implements Runnable {
|
||||||
|
Player p;
|
||||||
|
|
||||||
|
public ArmorHandlerTask(Player p) {
|
||||||
|
this.p = p;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
if (!p.isOnline())
|
||||||
|
return;
|
||||||
|
ItemStack[] armors = p.getInventory().getArmorContents();
|
||||||
|
for (ItemStack armor : armors) {
|
||||||
|
String armorperm = "equipmanager." + armor.getType().toString().toLowerCase();
|
||||||
|
if (!p.hasPermission(armorperm)) {
|
||||||
|
p.getInventory().addItem(armor);
|
||||||
|
p.sendMessage("§6[§b装备管理§6] §c你没有 " + armorperm + " 的权限来穿戴此装备 §a已放入背包!");
|
||||||
|
armor.setType(Material.AIR);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
p.getInventory().setArmorContents(armors);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,31 @@
|
|||||||
|
package cn.citycraft.EquipManager.runnable;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
|
||||||
|
import org.bukkit.Bukkit;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.plugin.Plugin;
|
||||||
|
import org.bukkit.scheduler.BukkitTask;
|
||||||
|
|
||||||
|
public class TaskManager {
|
||||||
|
static HashMap<String, BukkitTask> tasklist;
|
||||||
|
static Plugin plugin;
|
||||||
|
static int tasktime;
|
||||||
|
|
||||||
|
public static void add(Player p) {
|
||||||
|
BukkitTask task = Bukkit.getScheduler().runTaskTimer(plugin, new ArmorHandlerTask(p), 0, tasktime);
|
||||||
|
tasklist.put(p.getName(), task);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void init(Plugin plugin) {
|
||||||
|
TaskManager.plugin = plugin;
|
||||||
|
tasktime = plugin.getConfig().getInt("CheckTime") * 20;
|
||||||
|
tasklist = new HashMap<String, BukkitTask>();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void remove(Player p) {
|
||||||
|
if (tasklist.containsKey(p.getName()))
|
||||||
|
tasklist.remove(p.getName()).cancel();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
3
src/main/resources/config.yml
Normal file
3
src/main/resources/config.yml
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
version: 1.0
|
||||||
|
#检测时间(秒)
|
||||||
|
CheckTime: 1
|
17
src/main/resources/plugin.yml
Normal file
17
src/main/resources/plugin.yml
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
name: ${project.artifactId}
|
||||||
|
description: ${project.description}
|
||||||
|
main: ${project.groupId}.${project.artifactId}.${project.artifactId}
|
||||||
|
version: ${project.version}
|
||||||
|
auther: 喵♂呜
|
||||||
|
website: http://ci.citycraft.cn:8800/jenkins/job/${project.artifactId}/
|
||||||
|
commands:
|
||||||
|
em:
|
||||||
|
description: 装备管理
|
||||||
|
usage: §b使用/em reload 重载插件!
|
||||||
|
permissions:
|
||||||
|
em.*:
|
||||||
|
description: 穿戴所有装备的权限!
|
||||||
|
default: op
|
||||||
|
em.reload:
|
||||||
|
description: 重新载入插件!
|
||||||
|
default: op
|
Loading…
Reference in New Issue
Block a user