Merge branch 'development' into FS-309

This commit is contained in:
Video 2021-06-29 22:00:13 -06:00 committed by GitHub
commit e4a0943af2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 120 additions and 21 deletions

View File

@ -8,10 +8,20 @@ jobs:
runs-on: ubuntu-latest
steps:
# Java 11 Builds
- uses: actions/checkout@v1
- name: Set up JDK 1.8
- name: Set up JDK 11
uses: actions/setup-java@v1
with:
java-version: 11
- name: Build with Maven
run: mvn -B package --file pom.xml
# Java 16 Builds
- uses: actions/checkout@v1
- name: Set up JDK 16
uses: actions/setup-java@v1
with:
java-version: 16
- name: Build with Maven
run: mvn -B package --file pom.xml

View File

@ -1,13 +0,0 @@
language: java
jdk:
- oraclejdk11
- openjdk11
notifications:
email: false
addons:
apt:
packages:
- sshpass
script: mvn clean install
after_success:
- ./travis-upload.sh

View File

@ -163,9 +163,9 @@
</dependency>
<dependency>
<groupId>com.github.TotalFreedomMC</groupId>
<groupId>com.github.AtlasMediaGroup</groupId>
<artifactId>TF-LibsDisguises</artifactId>
<version>48f01cf2fe</version>
<version>5a340341b0</version>
<scope>provided</scope>
</dependency>

View File

@ -0,0 +1,97 @@
package me.totalfreedom.totalfreedommod.command;
import me.totalfreedom.totalfreedommod.rank.Rank;
import net.md_5.bungee.api.chat.BaseComponent;
import net.md_5.bungee.api.chat.ClickEvent;
import net.md_5.bungee.api.chat.HoverEvent;
import net.md_5.bungee.api.chat.TextComponent;
import net.md_5.bungee.api.chat.TranslatableComponent;
import net.md_5.bungee.api.chat.hover.content.Text;
import org.bukkit.ChatColor;
import org.bukkit.World;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import java.util.ArrayList;
import java.util.List;
@CommandPermissions(level = Rank.NON_OP, source = SourceType.BOTH)
@CommandParameters(description = "Get the seed of the world you are currently in.", usage = "/seed [world]")
public class Command_seed extends FreedomCommand
{
@Override
public boolean run(CommandSender sender, Player playerSender, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
{
World world;
if (args.length > 0)
{
world = server.getWorld(args[0]);
if (world == null)
{
msg("That world could not be found", ChatColor.RED);
return true;
}
}
else
{
// If the sender is a Player, use that world. Otherwise, use the overworld as a fallback.
if (!senderIsConsole)
{
world = playerSender.getWorld();
}
else
{
world = server.getWorlds().get(0);
}
}
// If the sender is not a Player, use the usual msg method to
if (senderIsConsole)
{
msg("Seed: [" + ChatColor.GREEN + world.getSeed() + ChatColor.WHITE + "]", ChatColor.WHITE);
}
else
{
// Gets the seed for later uses
String seed = String.valueOf(world.getSeed());
// This is a really stupid hack to get things to play nicely, but it works so I don't give a damn
BaseComponent[] components = {new TranslatableComponent("chat.copy.click")};
TextComponent seedAsComponent = new TextComponent(seed);
// Style the message like in vanilla Minecraft.
seedAsComponent.setColor(ChatColor.GREEN.asBungee());
seedAsComponent.setClickEvent(new ClickEvent(ClickEvent.Action.COPY_TO_CLIPBOARD, seed));
seedAsComponent.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new Text(components)));
// Enclose the seed with brackets
TextComponent seedString = new TextComponent("[");
seedString.addExtra(seedAsComponent);
seedString.addExtra("]");
// Send the message to the player.
TranslatableComponent response = new TranslatableComponent("commands.seed.success", seedString);
playerSender.spigot().sendMessage(response);
}
return true;
}
@Override
public List<String> getTabCompleteOptions(CommandSender sender, Command command, String alias, String[] args)
{
if (args.length == 1)
{
// Returns a list of worlds on the server and returns it
List<String> worlds = new ArrayList<>();
for (World world : server.getWorlds())
{
worlds.add(world.getName());
}
return worlds;
}
return null;
}
}

View File

@ -1,7 +1,5 @@
package me.totalfreedom.totalfreedommod.player;
import java.util.ArrayList;
import java.util.List;
import me.totalfreedom.totalfreedommod.TotalFreedomMod;
import me.totalfreedom.totalfreedommod.caging.CageData;
import me.totalfreedom.totalfreedommod.config.ConfigEntry;
@ -16,8 +14,12 @@ import org.bukkit.entity.Player;
import org.bukkit.scheduler.BukkitRunnable;
import org.bukkit.scheduler.BukkitTask;
import java.util.ArrayList;
import java.util.List;
public class FPlayer
{
public static final long AUTO_PURGE_TICKS = 5L * 60L * 20L;
@ -247,7 +249,7 @@ public class FPlayer
public void startArrowShooter(TotalFreedomMod plugin)
{
this.stopArrowShooter();
this.mp44ScheduleTask = new ArrowShooter(this.player).runTaskTimer(plugin, 1L, 1L);
this.mp44ScheduleTask = new ArrowShooter(getPlayer()).runTaskTimer(plugin, 1L, 1L);
this.mp44Firing = true;
}
@ -708,9 +710,12 @@ public class FPlayer
@Override
public void run()
{
if (player != null)
{
Arrow shot = player.launchProjectile(Arrow.class);
shot.setVelocity(shot.getVelocity().multiply(2.0));
}
}
}
}