测试版2.1

This commit is contained in:
yaohunya 2024-10-25 10:02:16 +08:00
parent 08ada5fdcc
commit dab09b1082
14 changed files with 57 additions and 11 deletions

BIN
lib/McLiveAPI.jar Normal file

Binary file not shown.

BIN
lib/NBTAPI.jar Normal file

Binary file not shown.

BIN
lib/PixelLiveEngine.jar Normal file

Binary file not shown.

BIN
lib/PixelLivePlugin.jar Normal file

Binary file not shown.

BIN
lib/RandomBox.jar Normal file

Binary file not shown.

Binary file not shown.

16
pom.xml
View File

@ -5,7 +5,7 @@
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<groupId>org.example</groupId> <groupId>org.example</groupId>
<artifactId>FarmingWar</artifactId> <artifactId>MinerWar</artifactId>
<version>1.0-SNAPSHOT</version> <version>1.0-SNAPSHOT</version>
<properties> <properties>
@ -15,16 +15,22 @@
<repositories> <repositories>
<repository> <repository>
<id>public-rpg</id> <id>public</id>
<url>https://repo.aurora-pixels.com/repository/public/</url> <url>https://repo.aurora-pixels.com/repository/public/</url>
</repository> </repository>
<repository>
<id>papermc-repo</id>
<url>https://repo.papermc.io/repository/maven-public/</url>
</repository>
</repositories> </repositories>
<dependencies> <dependencies>
<dependency> <dependency>
<groupId>org.spigotmc</groupId> <groupId>io.papermc.paper</groupId>
<artifactId>spigot-api</artifactId> <artifactId>paper-api</artifactId>
<version>1.18.2</version> <version>1.20.6-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency> </dependency>
<dependency> <dependency>
<groupId>net.md5.bungee</groupId> <groupId>net.md5.bungee</groupId>

View File

@ -1,5 +1,7 @@
package com.yutian.minerwar.game; package com.yutian.minerwar.game;
import com.io.yutian.pixelliveengine.api.PixelLiveEngineAPI;
import com.io.yutian.pixelliveplugin.PixelLiveAPI;
import com.sk89q.worldedit.EditSession; import com.sk89q.worldedit.EditSession;
import com.sk89q.worldedit.WorldEdit; import com.sk89q.worldedit.WorldEdit;
import com.sk89q.worldedit.bukkit.BukkitAdapter; import com.sk89q.worldedit.bukkit.BukkitAdapter;
@ -7,6 +9,7 @@ import com.sk89q.worldedit.extent.clipboard.Clipboard;
import com.sk89q.worldedit.extent.clipboard.io.ClipboardFormats; import com.sk89q.worldedit.extent.clipboard.io.ClipboardFormats;
import com.sk89q.worldedit.math.BlockVector3; import com.sk89q.worldedit.math.BlockVector3;
import com.yutian.minerwar.MinerWar; import com.yutian.minerwar.MinerWar;
import com.yutian.minerwar.listener.KeepEntitiesOnDeath;
import com.yutian.minerwar.manager.GameManager; import com.yutian.minerwar.manager.GameManager;
import com.yutian.minerwar.util.MerchantRecipeUtil; import com.yutian.minerwar.util.MerchantRecipeUtil;
import org.bukkit.*; import org.bukkit.*;
@ -141,6 +144,25 @@ public class Game {
initPlayerBackpack(player); initPlayerBackpack(player);
Location location = new Location(player.getWorld(),6.5,78.0,-75.5,90,0); Location location = new Location(player.getWorld(),6.5,78.0,-75.5,90,0);
player.teleport(location); player.teleport(location);
refreshHudMessage(player);
}
public void refreshHudMessage(Player player){
PixelLiveEngineAPI.clearHudText();
List<String> messageHud = new ArrayList<>();
int deathAmount = KeepEntitiesOnDeath.getDeathsVaule(player);
messageHud.add("§c§l嘎掉次数: "+ deathAmount+"");
double scale = 0.1;
if(deathAmount >= 21){
scale = 0.5;
}else if(deathAmount >= 16){
scale = 0.4;
}else if(deathAmount >= 11){
scale = 0.3;
}else if(deathAmount >= 6){
scale = 0.2;
}
messageHud.add("§c§l当前掉率: "+ String.format("%.1f",(scale*100)) +"%");
PixelLiveEngineAPI.setHudText(messageHud);
} }
public void initPlayerBackpack(Player player){ public void initPlayerBackpack(Player player){

View File

@ -8,7 +8,6 @@ import org.bukkit.*;
import org.bukkit.block.Block; import org.bukkit.block.Block;
import org.bukkit.entity.*; import org.bukkit.entity.*;
import org.bukkit.event.EventHandler; import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener; import org.bukkit.event.Listener;
import org.bukkit.event.block.*; import org.bukkit.event.block.*;
import org.bukkit.event.entity.*; import org.bukkit.event.entity.*;

View File

@ -26,6 +26,13 @@ public class KeepEntitiesOnDeath implements Listener {
public static HashMap<Player,Integer> deathsVaule = new HashMap<>(); public static HashMap<Player,Integer> deathsVaule = new HashMap<>();
public static int getDeathsVaule(Player player){
if(deathsVaule.containsKey(player)){
return deathsVaule.get(player);
}
return 0;
}
@EventHandler @EventHandler
public void onAutoRespawn(PlayerDeathEvent e) { public void onAutoRespawn(PlayerDeathEvent e) {
e.setDeathMessage(null); e.setDeathMessage(null);
@ -56,6 +63,7 @@ public class KeepEntitiesOnDeath implements Listener {
p.setAllowFlight(true); p.setAllowFlight(true);
} }
deathDropsCoarseGold(p,deathAmount); deathDropsCoarseGold(p,deathAmount);
game.refreshHudMessage(p);
cancel(); cancel();
} }
i++; i++;

View File

@ -74,10 +74,6 @@ public class discardCode {
block.setType(Material.AIR); block.setType(Material.AIR);
}else if(block.getType() == Material.SUNFLOWER){ }else if(block.getType() == Material.SUNFLOWER){
block.setType(Material.AIR); block.setType(Material.AIR);
}else if(block.getType() == Material.GRASS){
if(RandomUtil.getRandomInt(100,1) < 70) {
block.setType(Material.AIR);
}
} }
} }
} }

View File

@ -26,7 +26,7 @@ public class StackUtil {
ItemStack item = new ItemStack(Material.IRON_PICKAXE); ItemStack item = new ItemStack(Material.IRON_PICKAXE);
ItemMeta meta = item.getItemMeta(); ItemMeta meta = item.getItemMeta();
meta.addItemFlags(ItemFlag.HIDE_UNBREAKABLE); meta.addItemFlags(ItemFlag.HIDE_UNBREAKABLE);
meta.addEnchant(Enchantment.DIG_SPEED,3,true); meta.addEnchant(Enchantment.SOUL_SPEED,3,true);
meta.setUnbreakable(true); meta.setUnbreakable(true);
item.setItemMeta(meta); item.setItemMeta(meta);
return item; return item;

View File

@ -0,0 +1,2 @@
completeAmount: 10
countdownTime: 10

13
target/classes/plugin.yml Normal file
View File

@ -0,0 +1,13 @@
name: MinerWar
main: com.yutian.minerwar.MinerWar
version: 1.0
api-version: '1.20'
authors: [ SuperYuTian ]
softdepend:
- NBTAPI
- McLiveAPI
- FastAsyncWorldEdit
commands:
game:
gameedit:
livegift: