create my project

master
M_ZRK 2 years ago
commit 994d54f714

113
.gitignore vendored

@ -0,0 +1,113 @@
# User-specific stuff
.idea/
*.iml
*.ipr
*.iws
# IntelliJ
out/
# Compiled class file
*.class
# Log file
*.log
# BlueJ files
*.ctxt
# Package Files #
*.jar
*.war
*.nar
*.ear
*.zip
*.tar.gz
*.rar
# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
hs_err_pid*
*~
# temporary files which can be created if a process still has a handle open of a deleted file
.fuse_hidden*
# KDE directory preferences
.directory
# Linux trash folder which might appear on any partition or disk
.Trash-*
# .nfs files are created when an open file is removed but is still being accessed
.nfs*
# General
.DS_Store
.AppleDouble
.LSOverride
# Icon must end with two \r
Icon
# Thumbnails
._*
# Files that might appear in the root of a volume
.DocumentRevisions-V100
.fseventsd
.Spotlight-V100
.TemporaryItems
.Trashes
.VolumeIcon.icns
.com.apple.timemachine.donotpresent
# Directories potentially created on remote AFP share
.AppleDB
.AppleDesktop
Network Trash Folder
Temporary Items
.apdisk
# Windows thumbnail cache files
Thumbs.db
Thumbs.db:encryptable
ehthumbs.db
ehthumbs_vista.db
# Dump file
*.stackdump
# Folder config file
[Dd]esktop.ini
# Recycle Bin used on file shares
$RECYCLE.BIN/
# Windows Installer files
*.cab
*.msi
*.msix
*.msm
*.msp
# Windows shortcuts
*.lnk
target/
pom.xml.tag
pom.xml.releaseBackup
pom.xml.versionsBackup
pom.xml.next
release.properties
dependency-reduced-pom.xml
buildNumber.properties
.mvn/timing.properties
.mvn/wrapper/maven-wrapper.jar
.flattened-pom.xml
# Common working directory
run/

@ -0,0 +1,74 @@
<?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>me.john.amiscaray</groupId>
<artifactId>EmeraldSolution</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>jar</packaging>
<name>EmeraldSolution</name>
<properties>
<java.version>1.8</java.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version>
<configuration>
<source>${java.version}</source>
<target>${java.version}</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>3.2.4</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
<configuration>
<createDependencyReducedPom>false</createDependencyReducedPom>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
<resources>
<resource>
<directory>src/main/resources</directory>
<filtering>true</filtering>
</resource>
</resources>
</build>
<repositories>
<repository>
<id>spigotmc-repo</id>
<url>https://hub.spigotmc.org/nexus/content/repositories/snapshots/</url>
</repository>
<repository>
<id>sonatype</id>
<url>https://oss.sonatype.org/content/groups/public/</url>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>org.spigotmc</groupId>
<artifactId>spigot-api</artifactId>
<version>1.16.3-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
</dependencies>
</project>

@ -0,0 +1,19 @@
package me.john.amiscaray.emeraldsolution;
import me.john.amiscaray.emeraldsolution.listeners.ChunkLoadListener;
import org.bukkit.plugin.java.JavaPlugin;
public final class EmeraldSolution extends JavaPlugin {
@Override
public void onEnable() {
getServer().getPluginManager().registerEvents(new ChunkLoadListener(), this);
}
@Override
public void onDisable() {
// Plugin shutdown logic
}
}

@ -0,0 +1,34 @@
package me.john.amiscaray.emeraldsolution.listeners;
import org.bukkit.Bukkit;
import org.bukkit.Chunk;
import org.bukkit.Material;
import org.bukkit.block.Block;
import org.bukkit.block.Sign;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.world.ChunkLoadEvent;
public class ChunkLoadListener implements Listener {
@EventHandler
public void onChunkLoad(ChunkLoadEvent e){
Chunk chunk = e.getChunk();
// Check if the chunk contains
if (chunk.contains(Bukkit.createBlockData(Material.EMERALD_ORE))){
int highestY = chunk.getChunkSnapshot().getHighestBlockYAt(7,7);
Block b = chunk.getBlock(7, highestY, 7);
b.setType(Material.OAK_SIGN);
Sign sign = (Sign) b.getState();
sign.setLine(0, "EMERALD");
sign.update();
}
}
}

@ -0,0 +1,4 @@
name: EmeraldSolution
version: ${project.version}
main: me.john.amiscaray.emeraldsolution.EmeraldSolution
api-version: 1.16

@ -0,0 +1,2 @@
<h2 lang="fa" dir="rtl" align="center"> راه‌حل‌های پیشنهادی برای مشکلات احتمالی </h2>
<p lang="fa" dir="rtl" align="right"> راه‌حل‌های پیشنهادی من برای حل مشکلات احتمالی. راه‌حل‌های من لزوما بی‌نقص نیستند پس اگر شما راه‌حل بهتری پیدا کردید حتما یک پول ریکوییست ارسال کنید. </p>

@ -0,0 +1,74 @@
<?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>me.john.amiscaray</groupId>
<artifactId>WitherSolution</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>jar</packaging>
<name>WitherSolution</name>
<properties>
<java.version>1.8</java.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version>
<configuration>
<source>${java.version}</source>
<target>${java.version}</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>3.2.4</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
<configuration>
<createDependencyReducedPom>false</createDependencyReducedPom>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
<resources>
<resource>
<directory>src/main/resources</directory>
<filtering>true</filtering>
</resource>
</resources>
</build>
<repositories>
<repository>
<id>spigotmc-repo</id>
<url>https://hub.spigotmc.org/nexus/content/repositories/snapshots/</url>
</repository>
<repository>
<id>sonatype</id>
<url>https://oss.sonatype.org/content/groups/public/</url>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>org.spigotmc</groupId>
<artifactId>spigot-api</artifactId>
<version>1.16.3-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
</dependencies>
</project>

@ -0,0 +1,23 @@
package me.john.amiscaray.withersolution;
import me.john.amiscaray.withersolution.commands.StopWitherExecutor;
import me.john.amiscaray.withersolution.commands.WitherSpawnExecutor;
import org.bukkit.plugin.java.JavaPlugin;
public final class WitherSolution extends JavaPlugin {
@Override
public void onEnable() {
getConfig().options().copyDefaults();
saveDefaultConfig();
getServer().getPluginCommand("continuous_wither_spawn").setExecutor(new WitherSpawnExecutor());
getServer().getPluginCommand("stop_withers").setExecutor(new StopWitherExecutor());
}
@Override
public void onDisable() {
// Plugin shutdown logic
}
}

@ -0,0 +1,27 @@
package me.john.amiscaray.withersolution.commands;
import me.john.amiscaray.withersolution.tasks.WitherSpawnTask;
import me.john.amiscaray.withersolution.util.ActiveEvents;
import me.john.amiscaray.withersolution.util.CommandResponse;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
public class StopWitherExecutor implements CommandExecutor {
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
if(ActiveEvents.taskActive(WitherSpawnTask.ID)){
ActiveEvents.endTask(WitherSpawnTask.ID);
CommandResponse.sendCommandResponse("Successfully ended withers spawning", sender);
return true;
}
return true;
}
}

@ -0,0 +1,76 @@
package me.john.amiscaray.withersolution.commands;
import me.john.amiscaray.withersolution.WitherSolution;
import me.john.amiscaray.withersolution.tasks.WitherSpawnTask;
import me.john.amiscaray.withersolution.util.ActiveEvents;
import me.john.amiscaray.withersolution.util.CommandResponse;
import org.bukkit.ChatColor;
import org.bukkit.Location;
import org.bukkit.World;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.bukkit.plugin.Plugin;
public class WitherSpawnExecutor implements CommandExecutor {
private Plugin plugin = WitherSolution.getPlugin(WitherSolution.class);
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
if(!ActiveEvents.taskActive(WitherSpawnTask.ID)){
return spawnWither(args, sender);
}else{
CommandResponse.sendCommandResponse("Wither spawn already initiated. Cancel it first with /stop_withers", sender);
return false;
}
}
private boolean spawnWither(String[] args, CommandSender sender){
Location spawn = null;
World world = plugin.getServer().getWorld(plugin.getConfig().getString("world-name"));
if(args.length != 2 && args.length != 5){
String response = ChatColor.RED + "2 or 5 arguments expected, received " + args.length;
CommandResponse.sendCommandResponse(response, sender);
return false;
}else if(args.length == 2){
spawn = world.getSpawnLocation();
}else{
double x = Double.parseDouble(args[2]);
double y = Double.parseDouble(args[3]);
double z = Double.parseDouble(args[4]);
spawn = new Location(world, x, y, z);
}
long initDelay = Long.parseLong(args[0]);
long spawnDelay = Long.parseLong(args[1]);
String response = ChatColor.AQUA + "Started Wither Spawn Successfully";
CommandResponse.sendCommandResponse(response, sender);
ActiveEvents.addTask(WitherSpawnTask.ID, new WitherSpawnTask(plugin, spawn).runTaskTimer(plugin, initDelay, spawnDelay));
return true;
}
}

@ -0,0 +1,28 @@
package me.john.amiscaray.withersolution.tasks;
import org.bukkit.Location;
import org.bukkit.World;
import org.bukkit.entity.EntityType;
import org.bukkit.plugin.Plugin;
import org.bukkit.scheduler.BukkitRunnable;
public class WitherSpawnTask extends BukkitRunnable {
private Plugin plugin;
private Location spawn;
public static final String ID = "WITHER_TASK";
public WitherSpawnTask(Plugin plugin, Location spawn) {
this.plugin = plugin;
this.spawn = spawn;
}
@Override
public void run() {
String name = plugin.getConfig().getString("world-name");
World w = plugin.getServer().getWorld(name);
w.spawnEntity(spawn, EntityType.WITHER);
}
}

@ -0,0 +1,36 @@
package me.john.amiscaray.withersolution.util;
import org.bukkit.scheduler.BukkitTask;
import java.util.HashMap;
import java.util.Map;
public class ActiveEvents {
private static Map<String, BukkitTask> activeTasks = new HashMap<>();
/*
Add a task with a specific ID in the activeEvents HashMap. This way active tasks can be accessed and cancelled within
our classes separate from where they are declared. The ID's for a particular Task will be stored as a static final
member of the class.
*/
public static void addTask(String id, BukkitTask task){
activeTasks.put(id, task);
}
public static void endTask(String id){
activeTasks.get(id).cancel();
activeTasks.remove(id);
}
public static boolean taskActive(String id){
return activeTasks.containsKey(id);
}
}

@ -0,0 +1,23 @@
package me.john.amiscaray.withersolution.util;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
public class CommandResponse {
public static void sendCommandResponse(String response, CommandSender sender){
if(sender instanceof Player){
Player player = (Player) sender;
player.sendMessage(response);
}else{
System.out.println(response);
}
}
}

@ -0,0 +1,13 @@
name: WitherSolution
version: ${project.version}
main: me.john.amiscaray.withersolution.WitherSolution
api-version: 1.16
commands:
continuous_wither_spawn:
description: Continuously spawns withers on a fixed interval. Intervals are given in ticks.
usage: /<command> <initDelay> <spawnDelay> (x) (y) (z)
aliases: [wither, unleash_hell]
stop_withers:
description: Stops withers from spawning due to the continuous_wither_spawn command
usage: /<command>
aliases: [stop_plz, chicken_out]

@ -0,0 +1,113 @@
# User-specific stuff
.idea/
*.iml
*.ipr
*.iws
# IntelliJ
out/
# Compiled class file
*.class
# Log file
*.log
# BlueJ files
*.ctxt
# Package Files #
*.jar
*.war
*.nar
*.ear
*.zip
*.tar.gz
*.rar
# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
hs_err_pid*
*~
# temporary files which can be created if a process still has a handle open of a deleted file
.fuse_hidden*
# KDE directory preferences
.directory
# Linux trash folder which might appear on any partition or disk
.Trash-*
# .nfs files are created when an open file is removed but is still being accessed
.nfs*
# General
.DS_Store
.AppleDouble
.LSOverride
# Icon must end with two \r
Icon
# Thumbnails
._*
# Files that might appear in the root of a volume
.DocumentRevisions-V100
.fseventsd
.Spotlight-V100
.TemporaryItems
.Trashes
.VolumeIcon.icns
.com.apple.timemachine.donotpresent
# Directories potentially created on remote AFP share
.AppleDB
.AppleDesktop
Network Trash Folder
Temporary Items
.apdisk
# Windows thumbnail cache files
Thumbs.db
Thumbs.db:encryptable
ehthumbs.db
ehthumbs_vista.db
# Dump file
*.stackdump
# Folder config file
[Dd]esktop.ini
# Recycle Bin used on file shares
$RECYCLE.BIN/
# Windows Installer files
*.cab
*.msi
*.msix
*.msm
*.msp
# Windows shortcuts
*.lnk
target/
pom.xml.tag
pom.xml.releaseBackup
pom.xml.versionsBackup
pom.xml.next
release.properties
dependency-reduced-pom.xml
buildNumber.properties
.mvn/timing.properties
.mvn/wrapper/maven-wrapper.jar
.flattened-pom.xml
# Common working directory
run/

@ -0,0 +1,2 @@
<h2 lang="fa" dir="rtl" align="center"> کد نهایی </h2>
<p lang="fa" dir="rtl" align="right"> کد نهایی مقاله برای پلاگین. </p>

@ -0,0 +1,74 @@
<?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>me.john.amiscaray</groupId>
<artifactId>MinecraftPluginDevelopmentTutorialFinalCode</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>jar</packaging>
<name>MinecraftPluginDevelopmentTutorialFinalCode</name>
<properties>
<java.version>1.8</java.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version>
<configuration>
<source>${java.version}</source>
<target>${java.version}</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>3.2.4</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
<configuration>
<createDependencyReducedPom>false</createDependencyReducedPom>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
<resources>
<resource>
<directory>src/main/resources</directory>
<filtering>true</filtering>
</resource>
</resources>
</build>
<repositories>
<repository>
<id>spigotmc-repo</id>
<url>https://hub.spigotmc.org/nexus/content/repositories/snapshots/</url>
</repository>
<repository>
<id>sonatype</id>
<url>https://oss.sonatype.org/content/groups/public/</url>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>org.spigotmc</groupId>
<artifactId>spigot-api</artifactId>
<version>1.16.3-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
</dependencies>
</project>

@ -0,0 +1,26 @@
package me.john.amiscaray.minecraftplugindevelopmenttutorialfinalcode;
import me.john.amiscaray.minecraftplugindevelopmenttutorialfinalcode.commandexecutors.TowerCommandExecutor;
import me.john.amiscaray.minecraftplugindevelopmenttutorialfinalcode.commandexecutors.WitherSpawnExecutor;
import me.john.amiscaray.minecraftplugindevelopmenttutorialfinalcode.eventlisteners.MobSpawnListener;
import me.john.amiscaray.minecraftplugindevelopmenttutorialfinalcode.eventlisteners.PlayerMovementListener;
import org.bukkit.plugin.java.JavaPlugin;
public final class MinecraftPluginTutorialFinal extends JavaPlugin {
@Override
public void onEnable() {
saveDefaultConfig();
getServer().getPluginManager().registerEvents(new PlayerMovementListener(), this);
getServer().getPluginManager().registerEvents(new MobSpawnListener(), this);
getServer().getPluginCommand("mark-location").setExecutor(new TowerCommandExecutor());
getServer().getPluginCommand("continuous-wither-spawn").setExecutor(new WitherSpawnExecutor());
}
@Override
public void onDisable() {
// Plugin shutdown logic
}
}

@ -0,0 +1,46 @@
package me.john.amiscaray.minecraftplugindevelopmenttutorialfinalcode.commandexecutors;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
public class TowerCommandExecutor implements CommandExecutor {
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
if(sender instanceof Player){
Player p = (Player) sender;
// Get the location 2 blocks in the x-axis next to the player
Location origin = p.getLocation().add(2,0,0);
// Set 50 blocks on the y-axis of the location to cobblestone
for(int i = 0; i < 50; i++){
origin.getBlock().setType(Material.COBBLESTONE);
origin.add(0,1,0);
}
// Send the player a message about what just occurred
p.sendMessage("Successfully added marker at your location");
return true;
}else{
// Print to the command line that you need to be a player to execute this command
System.out.println("Cannot execute this command on the command line");
return false;
}
}
}

@ -0,0 +1,34 @@
package me.john.amiscaray.minecraftplugindevelopmenttutorialfinalcode.commandexecutors;
import me.john.amiscaray.minecraftplugindevelopmenttutorialfinalcode.MinecraftPluginTutorialFinal;
import me.john.amiscaray.minecraftplugindevelopmenttutorialfinalcode.runnables.WitherSpawnRunnable;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.bukkit.plugin.Plugin;
public class WitherSpawnExecutor implements CommandExecutor {
private Plugin plugin = MinecraftPluginTutorialFinal.getPlugin(MinecraftPluginTutorialFinal.class);
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
// If the user gave the correct number of arguments (2 arguments, initial delay, spawn delay)
if(args.length == 2){
// Get the initial delay and delay between spawns from the arguments. Must cast them to be Longs.
Long initialDelay = Long.parseLong(args[0]);
Long spawnDelay = Long.parseLong(args[1]);
// Run the BukkitRunnable with the above timing
new WitherSpawnRunnable(plugin).runTaskTimer(plugin, initialDelay, spawnDelay);
return true;
}
return false;
}
}

@ -0,0 +1,48 @@
package me.john.amiscaray.minecraftplugindevelopmenttutorialfinalcode.eventlisteners;
import org.bukkit.Material;
import org.bukkit.enchantments.Enchantment;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Monster;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.entity.CreatureSpawnEvent;
import org.bukkit.inventory.ItemStack;
public class MobSpawnListener implements Listener {
@EventHandler
public void onMobSpawn(CreatureSpawnEvent event){
LivingEntity entity = event.getEntity();
if(entity instanceof Monster){
// Give the Monster full diamond armor.
entity.getEquipment().setBoots(new ItemStack(Material.DIAMOND_BOOTS));
entity.getEquipment().setChestplate(new ItemStack(Material.DIAMOND_CHESTPLATE));
entity.getEquipment().setHelmet(new ItemStack(Material.DIAMOND_HELMET));
entity.getEquipment().setLeggings(new ItemStack(Material.DIAMOND_LEGGINGS));
if(entity.getType() == EntityType.SKELETON){
// Create an enchanted bow and give it to the skeleton.
ItemStack bow = new ItemStack(Material.BOW);
bow.addEnchantment(Enchantment.ARROW_DAMAGE, 4);
entity.getEquipment().setItemInMainHand(bow);
}
if (entity.getType() == EntityType.CREEPER){
entity.setInvisible(true);
}
}
}
}

@ -0,0 +1,34 @@
package me.john.amiscaray.minecraftplugindevelopmenttutorialfinalcode.eventlisteners;
import org.bukkit.Material;
import org.bukkit.World;
import org.bukkit.block.Block;
import org.bukkit.block.BlockFace;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.player.PlayerMoveEvent;
public class PlayerMovementListener implements Listener {
@EventHandler
public void onPlayerMove(PlayerMoveEvent event){
// Get the player that just moved
Player p = event.getPlayer();
// Get the Block right below the player
Block b = p.getLocation().getBlock().getRelative(BlockFace.DOWN);
// Create an explosion of power 5 on the player's location
if (b.getType() == Material.GRASS_BLOCK){
World w = p.getWorld();
w.createExplosion(p.getLocation(), 5);
}
}
}

@ -0,0 +1,31 @@
package me.john.amiscaray.minecraftplugindevelopmenttutorialfinalcode.runnables;
import org.bukkit.World;
import org.bukkit.entity.EntityType;
import org.bukkit.plugin.Plugin;
import org.bukkit.scheduler.BukkitRunnable;
public class WitherSpawnRunnable extends BukkitRunnable {
private final Plugin plugin;
public WitherSpawnRunnable(Plugin plugin) {
// Get the main class that extends JavaPlugin so we can access config variables.
this.plugin = plugin;
}
@Override
public void run() {
// Get the world the players are in.
String name = plugin.getConfig().getString("world-name");
World w = plugin.getServer().getWorld(name);
// Spawn a wither at the world spawn location
w.spawnEntity(w.getSpawnLocation(), EntityType.WITHER);
}
}

@ -0,0 +1,17 @@
name: MinecraftPluginDevelopmentTutorialFinalCode
version: ${project.version}
main: me.john.amiscaray.minecraftplugindevelopmenttutorialfinalcode.MinecraftPluginTutorialFinal
api-version: 1.16
# defining our commands.
commands:
# create a new command called mark-location.
mark-location:
description: create a 50 block tall cobblestone tower to mark a location
# show to the player how they should call the command. You would also show arguments here.
usage: /<command>
# create other names we can call the command by.
aliases: [mark, tower]
continuous-wither-spawn:
description: Continuously spawns withers on a fixed interval. Intervals are given in ticks.
usage: /<command> <initDelay> <spawnDelay>
aliases: [ wither, unleash_hell ]

@ -0,0 +1,2 @@
<h2 lang="fa" dir="rtl" align="center"> آماده سازی و راه اندازی اولیه پلاگین </h2>
<p dir="rtl" align="right"> من این ریپوزیتوری را برای مقاله خود ایجاد کرده‌ام. اگر نیاز به کمک دارید این ریپوزیتوری را دانلود کنید تا اولین پروژه خود را در این ریپوزیتوری راه اندازی کنید. همچنین توجه داشته باشید که باید گروپ آیدی و نام پکیج را تغییر دهید تا پروژه منحصر به شما شود. برای این منظور در فایل pom.xml تگ گروپ آیدی را به تگ گروپ آیدی خود تغییر دهید. همچنین، نام پکیج را از "me.john.amiscaray.minecraftplugindevelopmenttutorial" به "(yourgroupid).minecraftplugindevelopmenttutorial تغییر دهید. پس از انجام این کار، محتویات "main" در فایل plugin.yml را از "me.john.amiscaray.minecraftplugindevelopmenttutorial.MinecraftPluginDevelopmentTutorial"، به "(yourgroupid).minecraftplugindevelopmenttutorial.MinecraftPluginDevelopmentu تغییر دهید. </p>

@ -0,0 +1,74 @@
<?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>me.john.amiscaray</groupId>
<artifactId>MinecraftPluginDevelopmentTutorial</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>jar</packaging>
<name>MinecraftPluginDevelopmentTutorial</name>
<properties>
<java.version>1.8</java.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version>
<configuration>
<source>${java.version}</source>
<target>${java.version}</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>3.2.4</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
<configuration>
<createDependencyReducedPom>false</createDependencyReducedPom>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
<resources>
<resource>
<directory>src/main/resources</directory>
<filtering>true</filtering>
</resource>
</resources>
</build>
<repositories>
<repository>
<id>spigotmc-repo</id>
<url>https://hub.spigotmc.org/nexus/content/repositories/snapshots/</url>
</repository>
<repository>
<id>sonatype</id>
<url>https://oss.sonatype.org/content/groups/public/</url>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>org.spigotmc</groupId>
<artifactId>spigot-api</artifactId>
<version>1.16.3-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
</dependencies>
</project>

@ -0,0 +1,17 @@
package me.john.amiscaray.minecraftplugindevelopmenttutorial;
import org.bukkit.plugin.java.JavaPlugin;
public final class MinecraftPluginDevelopmentTutorial extends JavaPlugin {
@Override
public void onEnable() {
// Plugin startup logic
System.out.println("Hello World");
}
@Override
public void onDisable() {
// Plugin shutdown logic
}
}

@ -0,0 +1,4 @@
name: MinecraftPluginDevelopmentTutorial
version: ${project.version}
main: me.john.amiscaray.minecraftplugindevelopmenttutorial.MinecraftPluginDevelopmentTutorial
api-version: 1.16

@ -0,0 +1,2 @@
<h2 lang="fa" dir="rtl" align="center"> آموزش شروع پلاگین نویسی ماینکرافت </h2>
<p lang="fa" dir="rtl" align="right"> در این ریپوزیتوری منابعی برای مقاله در مورد پلاگین های ماینکرافت وجود دارد. این منابع شامل راه اندازی پروژه، کد نهایی و راه حل هایی برای مشکلات احتمالی می باشد. هر پوشه حاوی اطلاعات بیشتر در مورد هر منبع است. </p>
Loading…
Cancel
Save