-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #39 from UltiKits/alpha
Release 6.0.1
- Loading branch information
Showing
112 changed files
with
3,540 additions
and
1,977 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
53 changes: 53 additions & 0 deletions
53
BasicFunctions/src/main/java/com/ultikits/plugins/commands/SpeedCommands.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
package com.ultikits.plugins.commands; | ||
|
||
import com.ultikits.plugins.BasicFunctions; | ||
import com.ultikits.ultitools.abstracts.AbstractTabExecutor; | ||
import org.bukkit.ChatColor; | ||
import org.bukkit.command.Command; | ||
import org.bukkit.command.CommandSender; | ||
import org.bukkit.entity.Player; | ||
import org.jetbrains.annotations.NotNull; | ||
import org.jetbrains.annotations.Nullable; | ||
|
||
import java.util.Arrays; | ||
import java.util.List; | ||
|
||
import static com.ultikits.ultitools.utils.MessageUtils.info; | ||
import static com.ultikits.ultitools.utils.MessageUtils.warning; | ||
|
||
|
||
public class SpeedCommands extends AbstractTabExecutor { | ||
List<String> speeds = Arrays.asList("0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "10"); | ||
|
||
@Override | ||
protected boolean onPlayerCommand(@NotNull Command command, @NotNull String[] strings, @NotNull Player player) { | ||
if (player.hasPermission("ultikits.tools.command.speed")) { | ||
if (!speeds.contains(strings[0])) { | ||
return false; | ||
} | ||
player.setWalkSpeed(Float.parseFloat(strings[0]) / 10); | ||
player.setFlySpeed(Float.parseFloat(strings[0]) / 10); | ||
player.sendMessage(ChatColor.YELLOW + String.format(BasicFunctions.getInstance().i18n("行走/飞行速度已设置为%s,默认速度为2"), strings[0])); | ||
return true; | ||
} | ||
player.sendMessage(warning(BasicFunctions.getInstance().i18n("你没有权限使用此指令!"))); | ||
return true; | ||
} | ||
|
||
@Nullable | ||
@Override | ||
protected List<String> onPlayerTabComplete(@NotNull Command command, @NotNull String[] strings, @NotNull Player player) { | ||
if (!player.hasPermission("ultikits.tools.commands.speed")) { | ||
return null; | ||
} | ||
if (strings.length == 1) { | ||
return speeds; | ||
} | ||
return null; | ||
} | ||
|
||
@Override | ||
protected void sendHelpMessage(CommandSender sender) { | ||
sender.sendMessage(info(BasicFunctions.getInstance().i18n("/speed <0-10> 设置速度"))); | ||
} | ||
} |
107 changes: 107 additions & 0 deletions
107
BasicFunctions/src/main/java/com/ultikits/plugins/commands/TpaCommands.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,107 @@ | ||
package com.ultikits.plugins.commands; | ||
|
||
import com.ultikits.plugins.BasicFunctions; | ||
import com.ultikits.plugins.tasks.TpTimerTask; | ||
import com.ultikits.ultitools.abstracts.AbstractTabExecutor; | ||
import com.ultikits.ultitools.utils.MessageUtils; | ||
import net.kyori.adventure.text.Component; | ||
import net.kyori.adventure.text.TextComponent; | ||
import net.kyori.adventure.text.event.ClickEvent; | ||
import net.kyori.adventure.text.format.TextColor; | ||
import org.bukkit.Bukkit; | ||
import org.bukkit.command.Command; | ||
import org.bukkit.command.CommandSender; | ||
import org.bukkit.entity.Player; | ||
import org.jetbrains.annotations.NotNull; | ||
import org.jetbrains.annotations.Nullable; | ||
|
||
import java.util.List; | ||
|
||
import static com.ultikits.ultitools.utils.MessageUtils.info; | ||
import static com.ultikits.ultitools.utils.MessageUtils.warning; | ||
|
||
|
||
public class TpaCommands extends AbstractTabExecutor { | ||
|
||
@Override | ||
protected boolean onPlayerCommand(@NotNull Command command, @NotNull String[] strings, @NotNull Player player) { | ||
if (!player.isOp() && !player.hasPermission("ultikits.tools.command.tpa")) { | ||
player.sendMessage(warning(BasicFunctions.getInstance().i18n("你没有权限使用此指令!"))); | ||
return false; | ||
} | ||
switch (strings.length) { | ||
case 1: | ||
switch (strings[0]) { | ||
case "accept": | ||
Player teleporter = TpTimerTask.tpTemp.get(player); | ||
if (teleporter == null) { | ||
player.sendMessage(warning(BasicFunctions.getInstance().i18n("并没有玩家给你发送传送请求!"))); | ||
return true; | ||
} | ||
TpTimerTask.tpTemp.put(player, null); | ||
TpTimerTask.tpTimer.put(player, 0); | ||
teleporter.teleport(player.getLocation()); | ||
teleporter.sendMessage(info(BasicFunctions.getInstance().i18n("传送成功!"))); | ||
return true; | ||
case "reject": | ||
Player teleporter2 = TpTimerTask.tpTemp.get(player); | ||
if (teleporter2 == null) { | ||
player.sendMessage(warning(BasicFunctions.getInstance().i18n("并没有玩家给你发送传送请求!"))); | ||
return true; | ||
} | ||
teleporter2.sendMessage(warning(BasicFunctions.getInstance().i18n("对方拒绝了你的传送请求 :("))); | ||
player.sendMessage(info(BasicFunctions.getInstance().i18n("已拒绝!"))); | ||
TpTimerTask.tpTemp.put(player, null); | ||
TpTimerTask.tpTimer.put(player, 0); | ||
return true; | ||
default: | ||
Player target = Bukkit.getPlayerExact(strings[0]); | ||
if (target == null) { | ||
player.sendMessage(warning(BasicFunctions.getInstance().i18n("未找到目标,无法请求传送!"))); | ||
return true; | ||
} | ||
if (TpTimerTask.tpTemp.get(target) != null) { | ||
player.sendMessage(warning(BasicFunctions.getInstance().i18n("对方正在处理另一个传送请求!"))); | ||
return true; | ||
} | ||
TpTimerTask.tpTemp.put(target, player); | ||
TpTimerTask.tpTimer.put(target, 20); | ||
player.sendMessage(info(String.format(BasicFunctions.getInstance().i18n("你已向%s发送TP请求!"), target.getName()))); | ||
target.sendMessage(info(String.format(BasicFunctions.getInstance().i18n("%s请求传送到您的位置"), player.getName()))); | ||
TextComponent ask = Component | ||
.text(BasicFunctions.getInstance().i18n("[同意]")) | ||
.color(TextColor.color(0x00FF00)) | ||
.hoverEvent(Component.text(BasicFunctions.getInstance().i18n("点击同意传送"))) | ||
.clickEvent(ClickEvent.runCommand("/tpa accept")) | ||
.append(Component.text(" ")) | ||
.append( | ||
Component | ||
.text(BasicFunctions.getInstance().i18n("[拒绝]")) | ||
.color(TextColor.color(0xFF0000)) | ||
.hoverEvent(Component.text(BasicFunctions.getInstance().i18n("点击拒绝传送"))) | ||
.clickEvent(ClickEvent.runCommand("/tpa reject")) | ||
); | ||
MessageUtils.sendMessage(target, ask); | ||
return true; | ||
} | ||
default: | ||
return false; | ||
} | ||
} | ||
|
||
@Override | ||
protected @Nullable | ||
List<String> onPlayerTabComplete(@NotNull Command command, @NotNull String[] strings, @NotNull Player player) { | ||
return TpaHereCommands.getTpTabList(strings); | ||
} | ||
|
||
@Override | ||
protected void sendHelpMessage(CommandSender sender) { | ||
sender.sendMessage(info(BasicFunctions.getInstance().i18n("----传送请求帮助----"))); | ||
sender.sendMessage(info(BasicFunctions.getInstance().i18n("/tpa [玩家名] 向玩家发送传送请求"))); | ||
sender.sendMessage(info(BasicFunctions.getInstance().i18n("/tpa accept 接受传送请求"))); | ||
sender.sendMessage(info(BasicFunctions.getInstance().i18n("/tpa reject 拒绝传送请求"))); | ||
} | ||
|
||
} | ||
|
113 changes: 113 additions & 0 deletions
113
BasicFunctions/src/main/java/com/ultikits/plugins/commands/TpaHereCommands.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,113 @@ | ||
package com.ultikits.plugins.commands; | ||
|
||
import com.ultikits.plugins.BasicFunctions; | ||
import com.ultikits.plugins.tasks.TpTimerTask; | ||
import com.ultikits.ultitools.abstracts.AbstractTabExecutor; | ||
import com.ultikits.ultitools.utils.MessageUtils; | ||
import net.kyori.adventure.text.Component; | ||
import net.kyori.adventure.text.TextComponent; | ||
import net.kyori.adventure.text.event.ClickEvent; | ||
import net.kyori.adventure.text.format.TextColor; | ||
import org.bukkit.Bukkit; | ||
import org.bukkit.command.Command; | ||
import org.bukkit.command.CommandSender; | ||
import org.bukkit.entity.Player; | ||
import org.jetbrains.annotations.NotNull; | ||
import org.jetbrains.annotations.Nullable; | ||
|
||
import java.util.ArrayList; | ||
import java.util.List; | ||
|
||
import static com.ultikits.ultitools.utils.MessageUtils.info; | ||
import static com.ultikits.ultitools.utils.MessageUtils.warning; | ||
|
||
|
||
public class TpaHereCommands extends AbstractTabExecutor { | ||
@Nullable | ||
public static List<String> getTpTabList(@NotNull String[] strings) { | ||
List<String> tabCommands = new ArrayList<>(); | ||
if (strings.length == 1) { | ||
tabCommands.add("accept"); | ||
tabCommands.add("reject"); | ||
for (Player player1 : Bukkit.getOnlinePlayers()) { | ||
tabCommands.add(player1.getName()); | ||
} | ||
return tabCommands; | ||
} | ||
return null; | ||
} | ||
|
||
@Override | ||
protected boolean onPlayerCommand(@NotNull Command command, @NotNull String[] strings, @NotNull Player player) { | ||
if (!player.isOp() && !player.hasPermission("ultikits.tools.command.tphere")) { | ||
player.sendMessage(warning(BasicFunctions.getInstance().i18n("你没有权限使用此指令!"))); | ||
return false; | ||
} | ||
if (strings.length == 1) { | ||
switch (strings[0]) { | ||
case "accept": | ||
Player teleporter = TpTimerTask.tphereTemp.get(player); | ||
if (teleporter == null) { | ||
player.sendMessage(warning(BasicFunctions.getInstance().i18n("并没有玩家给你发送传送请求!"))); | ||
return true; | ||
} | ||
TpTimerTask.tphereTemp.put(player, null); | ||
TpTimerTask.tphereTimer.put(player, 0); | ||
player.teleport(teleporter.getLocation()); | ||
teleporter.sendMessage(info(BasicFunctions.getInstance().i18n("传送成功!"))); | ||
return true; | ||
case "reject": | ||
Player teleporter2 = TpTimerTask.tphereTemp.get(player); | ||
if (teleporter2 == null) { | ||
player.sendMessage(warning(BasicFunctions.getInstance().i18n("并没有玩家给你发送传送请求!"))); | ||
return true; | ||
} | ||
teleporter2.sendMessage(warning(BasicFunctions.getInstance().i18n("对方拒绝了你的传送请求 :("))); | ||
player.sendMessage(info(BasicFunctions.getInstance().i18n("已拒绝!"))); | ||
TpTimerTask.tphereTemp.put(player, null); | ||
TpTimerTask.tphereTimer.put(player, 0); | ||
return true; | ||
default: | ||
Player target = Bukkit.getPlayerExact(strings[0]); | ||
if (target == null) { | ||
player.sendMessage(warning(BasicFunctions.getInstance().i18n("未找到目标,无法请求传送!"))); | ||
return true; | ||
} | ||
TpTimerTask.tphereTemp.put(target, player); | ||
TpTimerTask.tphereTimer.put(target, 20); | ||
player.sendMessage(info(String.format(BasicFunctions.getInstance().i18n("你已向%s发送TP请求!"), target.getName()))); | ||
target.sendMessage(info(String.format(BasicFunctions.getInstance().i18n("%s请求您传送至他的位置"), player.getName()))); | ||
TextComponent ask = Component | ||
.text(BasicFunctions.getInstance().i18n("[同意]")) | ||
.color(TextColor.color(0x00FF00)) | ||
.hoverEvent(Component.text(BasicFunctions.getInstance().i18n("点击同意传送"))) | ||
.clickEvent(ClickEvent.runCommand("/tphere accept")) | ||
.append(Component.text(" ")) | ||
.append( | ||
Component | ||
.text(BasicFunctions.getInstance().i18n("[拒绝]")) | ||
.color(TextColor.color(0xFF0000)) | ||
.hoverEvent(Component.text(BasicFunctions.getInstance().i18n("点击拒绝传送"))) | ||
.clickEvent(ClickEvent.runCommand("/tphere reject")) | ||
); | ||
MessageUtils.sendMessage(target, ask); | ||
return true; | ||
} | ||
} | ||
return false; | ||
} | ||
|
||
@Nullable | ||
@Override | ||
protected List<String> onPlayerTabComplete(@NotNull Command command, @NotNull String[] strings, @NotNull Player player) { | ||
return getTpTabList(strings); | ||
} | ||
|
||
@Override | ||
protected void sendHelpMessage(CommandSender sender) { | ||
sender.sendMessage(info(BasicFunctions.getInstance().i18n("----传送至此请求帮助----"))); | ||
sender.sendMessage(info(BasicFunctions.getInstance().i18n("/tphere accept 接受传送请求"))); | ||
sender.sendMessage(info(BasicFunctions.getInstance().i18n("/tphere reject 拒绝传送请求"))); | ||
sender.sendMessage(info(BasicFunctions.getInstance().i18n("/tphere [玩家名] 向玩家发送传送至此请求"))); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.