Skip to content

Commit

Permalink
Release 1.0
Browse files Browse the repository at this point in the history
Reeling in a catch will move the players look direction slightly thus canceling out auto fishing clients/machines
  • Loading branch information
JulianBooleanLau committed Jul 1, 2022
1 parent 21f53c1 commit a3d6fdd
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ public final class AntiFishing extends JavaPlugin {
@Override
public void onEnable() {
// Plugin startup logic
Bukkit.getLogger().info("STARTING UP");
Bukkit.getLogger().info("AntiFishing starting up");

//Registering new event handler
//Placing torch will say hi back
Expand All @@ -18,5 +18,6 @@ public void onEnable() {
@Override
public void onDisable() {
// Plugin shutdown logic
Bukkit.getLogger().info("AntiFishing shutting down");
}
}
26 changes: 13 additions & 13 deletions src/main/java/com/julianbooleanlau/antifishing/FishingListener.java
Original file line number Diff line number Diff line change
@@ -1,31 +1,31 @@
package com.julianbooleanlau.antifishing;

import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.block.BlockPlaceEvent;
import org.bukkit.event.player.PlayerFishEvent;
import java.util.Random;

public class FishingListener implements Listener {

@EventHandler
public void onFishReel(PlayerFishEvent event) {
public void onFish(PlayerFishEvent event) {
if (event.getCaught() != null) {
Player player = event.getPlayer();
player.sendMessage("Fishing!");
player.giveExp(100);
}
}
//player.sendMessage("Nice Catch!");

Location location = player.getLocation();
location.setYaw(location.getYaw() + 2.0f);
location.setPitch(location.getPitch() + 2.0f);

@EventHandler
public void onBlockPlace(BlockPlaceEvent event) {
Material type = event.getBlock().getType();
if (type == Material.TORCH) {
Player player = event.getPlayer();
player.sendMessage("Hello there");
//player.sendMessage("Yaw: " + location.getYaw() + 10.0f);
//player.sendMessage("Yaw: " + location.getPitch() + 10.0f);

player.teleport(location);
}
}

}

0 comments on commit a3d6fdd

Please sign in to comment.