Skip to content

Commit

Permalink
Particle生成の文法テスト、libsに net.minecraft.server のライブラリを追加、build.gradelに追加
Browse files Browse the repository at this point in the history
  • Loading branch information
shibomb committed Dec 8, 2018
1 parent 8f243cd commit 4ae8d2c
Show file tree
Hide file tree
Showing 10 changed files with 56 additions and 2 deletions.
9 changes: 9 additions & 0 deletions .idea/modules/MyFirstSpigotPlugin_main.iml

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

9 changes: 9 additions & 0 deletions .idea/modules/MyFirstSpigotPlugin_test.iml

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

5 changes: 5 additions & 0 deletions MyFirstSpigotPlugin.iml
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<module external.linked.project.id="MyFirstSpigotPlugin" external.linked.project.path="$MODULE_DIR$" external.root.project.path="$MODULE_DIR$" external.system.id="GRADLE" external.system.module.group="xyz.shibomb" external.system.module.version="1.0.0" type="JAVA_MODULE" version="4">
<component name="FacetManager">
<facet type="minecraft" name="Minecraft">
<configuration />
</facet>
</component>
<component name="NewModuleRootManager" inherit-compiler-output="true">
<exclude-output />
<content url="file://$MODULE_DIR$">
Expand Down
1 change: 1 addition & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ repositories {
dependencies {
testCompile group: 'junit', name: 'junit', version: '4.12'
compile 'org.spigotmc:spigot-api:1.13.2-R0.1-SNAPSHOT'
compile files('libs/spigot-1.12.2.jar')
}

import org.apache.tools.ant.filters.ReplaceTokens
Expand Down
3 changes: 2 additions & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#Sat Dec 08 19:37:28 JST 2018
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.4.1-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-4.4.1-all.zip
Binary file added libs/craftbukkit-1.12.2.jar
Binary file not shown.
Binary file added libs/spigot-1.12.2.jar
Binary file not shown.
25 changes: 25 additions & 0 deletions src/main/java/xyz/shibomb/myfirstspigotplugin/CommandHello.java
Original file line number Diff line number Diff line change
@@ -1,9 +1,16 @@
package xyz.shibomb.myfirstspigotplugin;

import net.minecraft.server.v1_12_R1.EnumParticle;
import net.minecraft.server.v1_12_R1.PacketPlayOutWorldParticles;
import org.bukkit.ChatColor;
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;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.PlayerInventory;

import java.util.Arrays;

Expand All @@ -19,10 +26,28 @@ public boolean onCommand(CommandSender sender, Command cmd, String label, String

if (sender instanceof Player) {
Player player = (Player) sender;
ItemStack items = player.getInventory().getItemInMainHand();
int currentAmount = items.getAmount();
if (currentAmount > 0) {
items.setAmount(currentAmount);
}


if (label.compareToIgnoreCase("hello") == 0) {
sender.sendMessage("Hello!! " + player.getDisplayName());
}
else if (label.compareToIgnoreCase("givemediamond") == 0) {
PlayerInventory inventory = player.getInventory(); // プレイヤーのインベントリ
ItemStack diamondstack = new ItemStack(Material.DIAMOND, 64); // 山積みのダイヤモンド!

if (inventory.contains(diamondstack)) {
inventory.addItem(diamondstack); // プレイヤーインベントリに山積みのダイヤモンドを加える
player.sendMessage(ChatColor.GOLD + "よく来たな!もっとダイヤモンドをくれてやろう、このとんでもない成金め!!");
}

Location loc = player.getLocation();
PacketPlayOutWorldParticles packet = new PacketPlayOutWorldParticles(EnumParticle.CLOUD, true, 0, 0, 0, 1, 0, 0, 1, 10);
}
}

// If the player (or console) uses our command correct, we can return true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ public void onEnable() {
// Plugin startup logic

this.getCommand("hello").setExecutor(new CommandHello());
this.getCommand("givemediamond").setExecutor(new CommandHello());
this.getCommand("seeyou").setExecutor(new CommandSeeyou());
}

Expand Down
5 changes: 4 additions & 1 deletion src/main/resources/plugin.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,7 @@ commands:
usage: /hello
seeyou:
description: Reply See you to player
usage: /seeyou
usage: /seeyou
givemediamond:
description: Give the gift to player
usage: /givemediamond

0 comments on commit 4ae8d2c

Please sign in to comment.