Skip to content
This repository was archived by the owner on Dec 11, 2022. It is now read-only.

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
xiaozhangup committed Mar 5, 2022
1 parent 1dc16fe commit 7d768d9
Show file tree
Hide file tree
Showing 22 changed files with 228 additions and 83 deletions.
18 changes: 9 additions & 9 deletions .github/workflows/maven.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,12 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- name: Set up JDK 17
uses: actions/setup-java@v2
with:
java-version: '17'
distribution: 'temurin'
cache: maven
- name: Build with Maven
run: mvn -B package --file pom.xml
- uses: actions/checkout@v2
- name: Set up JDK 17
uses: actions/setup-java@v2
with:
java-version: '17'
distribution: 'temurin'
cache: maven
- name: Build with Maven
run: mvn -B package --file pom.xml
13 changes: 0 additions & 13 deletions .idea/libraries/Maven__com_arcaniax_HeadDatabase_API_1_3_0.xml

This file was deleted.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 13 additions & 0 deletions .idea/libraries/Maven__com_mojang_authlib_1_5_25.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 13 additions & 0 deletions .idea/libraries/Maven__commons_codec_commons_codec_1_10.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 13 additions & 0 deletions .idea/libraries/Maven__commons_io_commons_io_2_4.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 13 additions & 0 deletions .idea/libraries/Maven__org_apache_commons_commons_lang3_3_5.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 6 additions & 2 deletions Natunology.iml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
<orderEntry type="library" scope="PROVIDED" name="Maven: com.google.guava:guava:31.0.1-jre" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: com.google.guava:failureaccess:1.0.1" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: com.google.guava:listenablefuture:9999.0-empty-to-avoid-conflict-with-guava" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: com.google.code.findbugs:jsr305:3.0.2" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: com.google.errorprone:error_prone_annotations:2.7.1" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: com.google.j2objc:j2objc-annotations:1.3" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: com.google.code.gson:gson:2.8.8" level="project" />
Expand All @@ -38,6 +37,11 @@
<orderEntry type="library" scope="PROVIDED" name="Maven: org.ow2.asm:asm-commons:9.2" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: org.ow2.asm:asm-tree:9.2" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: org.ow2.asm:asm-analysis:9.2" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: com.arcaniax:HeadDatabase-API:1.3.0" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: com.mojang:authlib:1.5.25" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: com.google.code.findbugs:jsr305:2.0.1" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: commons-codec:commons-codec:1.10" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: commons-io:commons-io:2.4" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: org.apache.commons:commons-lang3:3.5" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: org.apache.logging.log4j:log4j-core:2.8.1" level="project" />
</component>
</module>
13 changes: 7 additions & 6 deletions pom.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?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"
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://maven.apache.org/POM/4.0.0"
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>

Expand All @@ -14,7 +14,7 @@
<groupId>me.xiaozhangup.natunology</groupId>
<artifactId>Natunology</artifactId>
<name>Natunology</name>
<version>1.1.0</version>
<version>1.1.2</version>

<dependencies>
<dependency>
Expand All @@ -24,11 +24,12 @@
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.arcaniax</groupId>
<artifactId>HeadDatabase-API</artifactId>
<version>1.3.0</version>
<groupId>com.mojang</groupId>
<artifactId>authlib</artifactId>
<version>1.5.25</version>
<scope>provided</scope>
</dependency>

</dependencies>
<repositories>
<repository>
Expand Down
10 changes: 3 additions & 7 deletions src/main/java/me/xiaozhangup/natunology/Main.java
Original file line number Diff line number Diff line change
@@ -1,17 +1,13 @@
package me.xiaozhangup.natunology;

import me.xiaozhangup.natunology.commands.Commands;
import me.xiaozhangup.natunology.event.BlockHolo;
import me.xiaozhangup.natunology.event.Invkeep;
import me.xiaozhangup.natunology.event.MovePart;
import me.xiaozhangup.natunology.techcore.events.Books;
import me.xiaozhangup.natunology.techcore.views.MainTap;
import org.bukkit.Bukkit;
import org.bukkit.plugin.Plugin;
import org.bukkit.plugin.java.JavaPlugin;

import java.awt.print.Book;

public class Main extends JavaPlugin {

public static Plugin plugin;
Expand All @@ -27,15 +23,15 @@ public void onEnable() {

if (getConfig().getBoolean("Step.enable")) {
MovePart.runStep();
Bukkit.getPluginManager().registerEvents(new MovePart() , this);
Bukkit.getPluginManager().registerEvents(new MovePart(), this);
getLogger().info("Step Loaded!");
}

Commands.regCommands();
getLogger().info("Commands Loaded!");

Bukkit.getPluginManager().registerEvents(new Books() , this);
Bukkit.getPluginManager().registerEvents(new MainTap() , this);
Bukkit.getPluginManager().registerEvents(new Books(), this);
Bukkit.getPluginManager().registerEvents(new MainTap(), this);

// if (getConfig().getBoolean("Dead.enable")) {
// Bukkit.getPluginManager().registerEvents(new Invkeep() , this);
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/me/xiaozhangup/natunology/api/Holo.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@

public class Holo {

public static void createHoloTime(String s , Location loc , int i) {
public static void createHoloTime(String s, Location loc, int i) {
loc.setX(loc.getX() + 0.5);
loc.setZ(loc.getZ() + 0.5);
AreaEffectCloud flag = (AreaEffectCloud) (loc.getWorld().spawnEntity(loc , EntityType.AREA_EFFECT_CLOUD));
AreaEffectCloud flag = (AreaEffectCloud) (loc.getWorld().spawnEntity(loc, EntityType.AREA_EFFECT_CLOUD));
flag.setRadius(-10.0F);
flag.setParticle(Particle.ASH);
flag.setCustomName(s);
Expand Down
13 changes: 5 additions & 8 deletions src/main/java/me/xiaozhangup/natunology/api/Message.java
Original file line number Diff line number Diff line change
@@ -1,18 +1,15 @@
package me.xiaozhangup.natunology.api;

import com.sun.org.apache.xerces.internal.xs.StringList;
import org.bukkit.entity.Player;

import java.util.List;

public class Message {
public static void send(Player p , String s) {
p.sendMessage(s.replace("&" , getCode()));
public static void send(Player p, String s) {
p.sendMessage(s.replace("&", getCode()));
}

public static void send(Player p , String... s) {
public static void send(Player p, String... s) {
for (String message : s) {
p.sendMessage(message.replace("&" , getCode()));
p.sendMessage(message.replace("&", getCode()));
}
}

Expand All @@ -21,6 +18,6 @@ public static String getCode() {
}

public static String color(String s) {
return s.replace("&" , getCode());
return s.replace("&", getCode());
}
}
2 changes: 1 addition & 1 deletion src/main/java/me/xiaozhangup/natunology/api/NString.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ public class NString {
public static List<String> toStringlist(String... s) {
List<String> strings = new ArrayList<>();
for (String string : s) {
strings.add(string.replace("&" , getCode()));
strings.add(string.replace("&", getCode()));
}
return strings;
}
Expand Down
31 changes: 18 additions & 13 deletions src/main/java/me/xiaozhangup/natunology/commands/Commands.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,15 @@ public static void regCommands() {
Player p = (Player) commandSender;
try {
if (inside[0].equals("version")) {
Message.send(p , " ",
" &7&lNatunology HAPPYLAND" ,
" &f运行时版本: &7" + Bukkit.getPluginManager().getPlugin(Main.plugin.getName()).getDescription().getVersion() ,
Message.send(p, " ",
" &7&lNatunology HAPPYLAND",
" &f运行时版本: &7" + Bukkit.getPluginManager().getPlugin(Main.plugin.getName()).getDescription().getVersion(),
" &f开发者: &7" + Bukkit.getPluginManager().getPlugin("Natunology").getDescription().getAuthors(),
" &f自述信息: &7" + Bukkit.getPluginManager().getPlugin("Natunology").getDescription().getDescription(),
" &c&l开放源代码 &7https://github.com/xiaozhangup/Natunology",
" ");
} else if (inside[0].equals("help")) {
Message.send(p , " ",
Message.send(p, " ",
" &f&lNatunology 命令帮助",
" &7&lCode By HAPPYLAND Team",
" ",
Expand All @@ -35,27 +35,32 @@ public static void regCommands() {
" &7/ntg reload - &c重载配置文件(不安全)",
" ");
} else if (inside[0].equals("reload")) {
try {
Main.plugin.reloadConfig();
Message.send(p , "&f[&7科技&f] &a重载已完成,没有错误!");
} catch (Exception e) {
Message.send(p , "&f[&7科技&f] 重载可能已执行,但是 &c" + e.getMessage());
if (p.isOp()) {
try {
Main.plugin.reloadConfig();
Message.send(p, "&f[&7科技&f] &a重载已完成,没有错误!");
} catch (Exception e) {
Message.send(p, "&f[&7科技&f] 重载可能已执行,但是 &c" + e.getMessage());
}
} else {
Message.send(p, "&f[&7科技&f] &c你没有权限执行这个命令");
}

} else if (inside[0].equals("book")) {
p.getInventory().addItem(Items.guide());
} else if (inside[0].equals("getid")) {
try {
Message.send(p , "&f[&7科技&f] 这个物品的NTGID是: " + p.getInventory().getItemInMainHand().getItemMeta().getCustomModelData());
Message.send(p, "&f[&7科技&f] 这个物品的NTGID是: " + p.getInventory().getItemInMainHand().getItemMeta().getCustomModelData());
} catch (Exception e) {
Message.send(p , "&f[&7科技&f] &c这个物品没有 NTGID");
Message.send(p, "&f[&7科技&f] &c这个物品没有 NTGID");
}
} else if (inside[0].equals("guide")) {
MainTap.openMainTap(p);
} else {
Message.send(p , "&f[&7科技&f] &c没有这个命令!" , "&f[&7科技&f] 输入/ntg help 查看帮助");
Message.send(p, "&f[&7科技&f] &c没有这个命令!", "&f[&7科技&f] 输入/ntg help 查看帮助");
}
} catch (Exception e) {
Message.send(p , "&f[&7科技&f] 执行命令时遇到错误! 内容: &c" + e.getMessage() , "&f[&7科技&f] 输入/ntg help 查看帮助");
Message.send(p, "&f[&7科技&f] 执行命令时遇到错误! 内容: &c" + e.getMessage(), "&f[&7科技&f] 输入/ntg help 查看帮助");
}
return false;
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@ public class BlockHolo implements Listener {

@EventHandler
public void onBlockPlace(BlockPlaceEvent e) {
Holo.createHoloTime(e.getBlock().getBlockData().getMaterial().toString() , e.getBlock().getLocation(), 20);
Holo.createHoloTime(e.getBlock().getBlockData().getMaterial().toString(), e.getBlock().getLocation(), 20);
}
}
4 changes: 2 additions & 2 deletions src/main/java/me/xiaozhangup/natunology/event/Invkeep.java
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,13 @@ public class Invkeep implements Listener {

@EventHandler
public void onWorldLoad(WorldLoadEvent e) {
e.getWorld().setGameRule(GameRule.KEEP_INVENTORY , true);
e.getWorld().setGameRule(GameRule.KEEP_INVENTORY, true);
}

@EventHandler
public void onPlayerJoin(PlayerJoinEvent e) {
for (World world : Bukkit.getWorlds()) {
world.setGameRule(GameRule.KEEP_INVENTORY , true);
world.setGameRule(GameRule.KEEP_INVENTORY, true);
}
}
}
10 changes: 5 additions & 5 deletions src/main/java/me/xiaozhangup/natunology/event/MovePart.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
public class MovePart implements Listener {

public static void runStep() {
Bukkit.getScheduler().runTaskTimer(Main.plugin , () -> {
Bukkit.getScheduler().runTaskTimer(Main.plugin, () -> {
for (Player p : Bukkit.getOnlinePlayers()) {
Location location = p.getLocation();
location.setY(location.getY() - 1D);
Expand All @@ -26,19 +26,19 @@ public static void runStep() {
return;
}
location.setY(p.getLocation().toBlockLocation().getY() - Main.plugin.getConfig().getDouble("Step.size"));
ArmorStand armorStand = (ArmorStand) location.getWorld().spawnEntity(location , EntityType.ARMOR_STAND);
ArmorStand armorStand = (ArmorStand) location.getWorld().spawnEntity(location, EntityType.ARMOR_STAND);
armorStand.setVisible(false);
armorStand.setSmall(true);
armorStand.setCanMove(false);
armorStand.setNoDamageTicks(100);
armorStand.setCanPickupItems(false);
armorStand.setHelmet(new ItemStack(location.getBlock().getBlockData().getMaterial()));

Bukkit.getScheduler().runTaskLater(Main.plugin , () -> {
Bukkit.getScheduler().runTaskLater(Main.plugin, () -> {
armorStand.remove();
} , 50L);
}, 50L);
}
} , 1L , 16L);
}, 1L, 16L);
}

@EventHandler
Expand Down
Loading

0 comments on commit 7d768d9

Please sign in to comment.